作者 tangxvhui

Merge branch 'dev-tangxvhui' into test

@@ -41,4 +41,5 @@ type StaffAssessTaskRepository interface { @@ -41,4 +41,5 @@ type StaffAssessTaskRepository interface {
41 Remove(id int) error 41 Remove(id int) error
42 FindOne(queryOptions map[string]interface{}) (*StaffAssessTask, error) 42 FindOne(queryOptions map[string]interface{}) (*StaffAssessTask, error)
43 Find(queryOptions map[string]interface{}) (int, []*StaffAssessTask, error) 43 Find(queryOptions map[string]interface{}) (int, []*StaffAssessTask, error)
  44 + RemoveByProjectId(id int) error
44 } 45 }
@@ -69,6 +69,7 @@ func (d *StaffAssessDao) SearchAssessTaskMe(executorId int, companyId int, limit @@ -69,6 +69,7 @@ func (d *StaffAssessDao) SearchAssessTaskMe(executorId int, companyId int, limit
69 sqlStr := `SELECT DISTINCT staff_assess_task.* FROM staff_assess_task 69 sqlStr := `SELECT DISTINCT staff_assess_task.* FROM staff_assess_task
70 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" 70 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
71 WHERE staff_assess.company_id=? 71 WHERE staff_assess.company_id=?
  72 + and staff_assess_task.deleted_at isnull
72 and staff_assess.executor->>'userId'='?' 73 and staff_assess.executor->>'userId'='?'
73 order by staff_assess_task.id desc 74 order by staff_assess_task.id desc
74 limit ? offset ? 75 limit ? offset ?
@@ -88,6 +89,7 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int, @@ -88,6 +89,7 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int,
88 sqlStr := `SELECT count( DISTINCT staff_assess_task."id") FROM staff_assess_task 89 sqlStr := `SELECT count( DISTINCT staff_assess_task."id") FROM staff_assess_task
89 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" 90 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
90 WHERE staff_assess.company_id=? 91 WHERE staff_assess.company_id=?
  92 + and staff_assess_task.deleted_at isnull
91 and staff_assess.executor->>'userId'='?' 93 and staff_assess.executor->>'userId'='?'
92 ` 94 `
93 tx := d.transactionContext.PgTx 95 tx := d.transactionContext.PgTx
@@ -137,3 +137,13 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{}) @@ -137,3 +137,13 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{})
137 } 137 }
138 return count, arrays, nil 138 return count, arrays, nil
139 } 139 }
  140 +
  141 +func (repo *StaffAssessTaskRepository) RemoveByProjectId(id int) error {
  142 + tx := repo.transactionContext.PgTx
  143 + nowTime := time.Now()
  144 + _, err := tx.Model(&models.StaffAssessTask{}).
  145 + Where("evaluation_project_id=?", id).
  146 + Set("deleted_at=?", nowTime).
  147 + Update()
  148 + return err
  149 +}