Prechádzať zdrojové kódy

修复复制后的排序问题

boweniac 2 mesiacov pred
rodič
commit
798c5d8107

+ 4 - 1
internal/logic/sop_stage/sop_stage_copy_logic.go

@@ -42,6 +42,9 @@ func (l *SopStageCopyLogic) SopStageCopy(req *types.StageCopyReq) (resp *types.B
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 		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().
 	newStage, err := tx.SopStage.Create().
 		SetTaskID(data.TaskID).
 		SetTaskID(data.TaskID).
@@ -53,7 +56,7 @@ func (l *SopStageCopyLogic) SopStageCopy(req *types.StageCopyReq) (resp *types.B
 		SetNotNilActionLabelAdd(data.ActionLabelAdd).
 		SetNotNilActionLabelAdd(data.ActionLabelAdd).
 		SetNotNilActionLabelDel(data.ActionLabelDel).
 		SetNotNilActionLabelDel(data.ActionLabelDel).
 		SetNotNilActionForward(&data.ActionForward).
 		SetNotNilActionForward(&data.ActionForward).
-		SetIndexSort(data.IndexSort).
+		SetIndexSort(count + 1).
 		Save(l.ctx)
 		Save(l.ctx)
 	if err != nil {
 	if err != nil {
 		_ = tx.Rollback()
 		_ = tx.Rollback()