正在显示
3 个修改的文件
包含
8 行增加
和
6 行删除
@@ -157,7 +157,9 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom | @@ -157,7 +157,9 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom | ||
157 | if len(leaderList) == 0 { | 157 | if len(leaderList) == 0 { |
158 | return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有查询到人员") | 158 | return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有查询到人员") |
159 | } | 159 | } |
160 | - relatedUserIds := []int{} | 160 | + leaderData := leaderList[0] |
161 | + //默认填入人员的上级 | ||
162 | + relatedUserIds := []int{int(leaderData.ParentId)} | ||
161 | for _, val := range param.RelatedUserId { | 163 | for _, val := range param.RelatedUserId { |
162 | id, _ := strconv.Atoi(val) | 164 | id, _ := strconv.Atoi(val) |
163 | relatedUserIds = append(relatedUserIds, id) | 165 | relatedUserIds = append(relatedUserIds, id) |
@@ -172,7 +174,7 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom | @@ -172,7 +174,7 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom | ||
172 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error()) | 174 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error()) |
173 | } | 175 | } |
174 | } | 176 | } |
175 | - leaderData := leaderList[0] | 177 | + |
176 | nowTime := time.Now() | 178 | nowTime := time.Now() |
177 | newTask := domain.Task{ | 179 | newTask := domain.Task{ |
178 | Id: 0, | 180 | Id: 0, |
@@ -118,7 +118,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ | @@ -118,7 +118,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ | ||
118 | 118 | ||
119 | } | 119 | } |
120 | condition = append(condition, limit, offset) | 120 | condition = append(condition, limit, offset) |
121 | - sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? ` | 121 | + sqlStr1 += ` order by task_anomaly.id desc,task.sort_by limit ? offset ? ` |
122 | result := []ListTaskAnomaly{} | 122 | result := []ListTaskAnomaly{} |
123 | tx := d.transactionContext.PgTx | 123 | tx := d.transactionContext.PgTx |
124 | _, err := tx.Query(&result, sqlStr1, condition...) | 124 | _, err := tx.Query(&result, sqlStr1, condition...) |
@@ -268,7 +268,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ | @@ -268,7 +268,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ | ||
268 | sqlStr1 += ` and t_task.leader_id in (?) ` | 268 | sqlStr1 += ` and t_task.leader_id in (?) ` |
269 | } | 269 | } |
270 | condition = append(condition, limit, offset) | 270 | condition = append(condition, limit, offset) |
271 | - sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? ` | 271 | + sqlStr1 += ` order by task_anomaly.id desc,t_task.task_sort_by limit ? offset ? ` |
272 | 272 | ||
273 | result := []ListTaskAnomaly{} | 273 | result := []ListTaskAnomaly{} |
274 | tx := d.transactionContext.PgTx | 274 | tx := d.transactionContext.PgTx |
@@ -356,7 +356,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ | @@ -356,7 +356,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ | ||
356 | sqlStr2 += ` and task.leader->>'id' in (?) ` | 356 | sqlStr2 += ` and task.leader->>'id' in (?) ` |
357 | } | 357 | } |
358 | condition = append(condition, limit, offset) | 358 | condition = append(condition, limit, offset) |
359 | - sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? ` | 359 | + sqlStr1 += ` order by task_anomaly.id desc,task.sort_by limit ? offset ? ` |
360 | result := []ListTaskAnomaly{} | 360 | result := []ListTaskAnomaly{} |
361 | tx := d.transactionContext.PgTx | 361 | tx := d.transactionContext.PgTx |
362 | _, err := tx.Query(&result, sqlStr1, condition...) | 362 | _, err := tx.Query(&result, sqlStr1, condition...) |
-
请 注册 或 登录 后发表评论