作者 tangxvhui

Merge branch 'dev-tangxvhui' into test

... ... @@ -41,4 +41,5 @@ type StaffAssessTaskRepository interface {
Remove(id int) error
FindOne(queryOptions map[string]interface{}) (*StaffAssessTask, error)
Find(queryOptions map[string]interface{}) (int, []*StaffAssessTask, error)
RemoveByProjectId(id int) error
}
... ...
... ... @@ -69,6 +69,7 @@ func (d *StaffAssessDao) SearchAssessTaskMe(executorId int, companyId int, limit
sqlStr := `SELECT DISTINCT staff_assess_task.* FROM staff_assess_task
JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
WHERE staff_assess.company_id=?
and staff_assess_task.deleted_at isnull
and staff_assess.executor->>'userId'='?'
order by staff_assess_task.id desc
limit ? offset ?
... ... @@ -88,6 +89,7 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int,
sqlStr := `SELECT count( DISTINCT staff_assess_task."id") FROM staff_assess_task
JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
WHERE staff_assess.company_id=?
and staff_assess_task.deleted_at isnull
and staff_assess.executor->>'userId'='?'
`
tx := d.transactionContext.PgTx
... ...
... ... @@ -137,3 +137,13 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{})
}
return count, arrays, nil
}
func (repo *StaffAssessTaskRepository) RemoveByProjectId(id int) error {
tx := repo.transactionContext.PgTx
nowTime := time.Now()
_, err := tx.Model(&models.StaffAssessTask{}).
Where("evaluation_project_id=?", id).
Set("deleted_at=?", nowTime).
Update()
return err
}
... ...