作者 tangxvhui

调整异常中心了列表查询

... ... @@ -26,7 +26,7 @@ type TaskAnomaly struct {
CurrentStage TaskStage `json:"currentStage"` // 计划进度的里程碑
LastStage TaskStage `json:"lastStage"` // 实际进度完成的里程碑
TaskStageCheck TaskStage `json:"taskStageCheck"` // 当天任务反馈操作里程碑记录
AssessFlag int `json:"anomaly"` // 异常反馈的次数
AssessFlag int `json:"assessFlag"` // 异常反馈的次数
WarnFlag int `json:"warnFlag"` // 里程碑异常次数
AssistFlag int `json:"assistFlag"` // 辅导异常次数
IsLast int `json:"isLast"` // 是否是最新的一条记录 1 是最新的记录 2 不是最新的记录
... ...
... ... @@ -108,6 +108,17 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ
condition = append(condition, dayTime)
sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
sqlStr1 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
switch category {
case domain.AnomalyCategoryType1:
sqlStr2 += " and task_anomaly.warn_flag=1 "
sqlStr1 += " and task_anomaly.warn_flag=1 "
case domain.AnomalyCategoryType2:
sqlStr2 += " and task_anomaly.assess_flag=1 "
sqlStr1 += " and task_anomaly.assess_flag=1 "
// case domain.AnomalyCategoryType3:
// sqlStr2 += " and task_anomaly.assist_flag=1 "
// sqlStr1 += " and task_anomaly.assist_flag=1 "
}
}
if len(taskName) > 0 {
condition = append(condition, "%"+taskName+"%")
... ... @@ -253,11 +264,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
join task_anomaly on t_task.task_id= task_anomaly.task_id
where 1=1 and task_anomaly.is_last=1`
condition := []interface{}{userId, userId, companyId, subLevel}
if len(dayTime) > 0 {
condition = append(condition, dayTime)
sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
sqlStr1 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
}
if len(taskName) > 0 {
condition = append(condition, "%"+taskName+"%")
sqlStr2 += ` and t_task.task_alias like ? `
... ... @@ -268,6 +275,22 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
sqlStr1 += ` and task_anomaly.category=? `
sqlStr2 += ` and task_anomaly.category=? `
}
if len(dayTime) > 0 {
condition = append(condition, dayTime)
sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
sqlStr1 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
switch category {
case domain.AnomalyCategoryType1:
sqlStr2 += " and task_anomaly.warn_flag=1 "
sqlStr1 += " and task_anomaly.warn_flag=1 "
case domain.AnomalyCategoryType2:
sqlStr2 += " and task_anomaly.assess_flag=1 "
sqlStr1 += " and task_anomaly.assess_flag=1 "
// case domain.AnomalyCategoryType3:
// sqlStr2 += " and task_anomaly.assist_flag=1 "
// sqlStr1 += " and task_anomaly.assist_flag=1 "
}
}
if len(leaderId) > 0 {
condition = append(condition, pg.In(leaderId))
sqlStr2 += ` and t_task.leader_id in (?) `
... ... @@ -350,6 +373,17 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
condition = append(condition, dayTime)
sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
sqlStr1 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
switch category {
case domain.AnomalyCategoryType1:
sqlStr2 += " and task_anomaly.warn_flag=1 "
sqlStr1 += " and task_anomaly.warn_flag=1 "
case domain.AnomalyCategoryType2:
sqlStr2 += " and task_anomaly.assess_flag=1 "
sqlStr1 += " and task_anomaly.assess_flag=1 "
// case domain.AnomalyCategoryType3:
// sqlStr2 += " and task_anomaly.assist_flag=1 "
// sqlStr1 += " and task_anomaly.assist_flag=1 "
}
}
if len(taskName) > 0 {
condition = append(condition, "%"+taskName+"%")
... ... @@ -443,7 +477,7 @@ func (d TaskAnomalyDao) SearchForUser(userId int, companyId int, taskName string
task_anomaly.created_at
from t_task
join task_anomaly on t_task.task_id= task_anomaly.task_id
where t_task.task_alias like ?`
where t_task.task_alias like ? and task_anomaly.is_last=1 `
condition := []interface{}{userId, userId, companyId, fmt.Sprintf("[%d]", userId)}
condition = append(condition, "%"+taskName+"%")
result := []ListTaskAnomaly{}
... ...