|
@@ -42,6 +42,9 @@ func (l *SopStageCopyLogic) SopStageCopy(req *types.StageCopyReq) (resp *types.B
|
|
|
return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
|
}
|
|
|
|
|
|
+ // 查询任务的阶段数量
|
|
|
+ count, err := l.svcCtx.DB.SopStage.Query().Where(sopstage.TaskIDEQ(data.TaskID)).Count(l.ctx)
|
|
|
+
|
|
|
// 创建新阶段
|
|
|
newStage, err := tx.SopStage.Create().
|
|
|
SetTaskID(data.TaskID).
|
|
@@ -53,7 +56,7 @@ func (l *SopStageCopyLogic) SopStageCopy(req *types.StageCopyReq) (resp *types.B
|
|
|
SetNotNilActionLabelAdd(data.ActionLabelAdd).
|
|
|
SetNotNilActionLabelDel(data.ActionLabelDel).
|
|
|
SetNotNilActionForward(&data.ActionForward).
|
|
|
- SetIndexSort(data.IndexSort).
|
|
|
+ SetIndexSort(count + 1).
|
|
|
Save(l.ctx)
|
|
|
if err != nil {
|
|
|
_ = tx.Rollback()
|