...
|
...
|
@@ -117,9 +117,10 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in |
|
|
tx := repo.transactionContext.PgTx
|
|
|
var m []*models.StaffAssess
|
|
|
query := tx.Model(&m).
|
|
|
Where("deleted_at isnull")
|
|
|
Where("staff_assess.deleted_at isnull").
|
|
|
Join(`JOIN staff_assess_task ON staff_assess_task."id" = staff_assess."staff_assess_task_id" and staff_assess_task."deleted_at" isnull`)
|
|
|
if companyId, ok := queryOptions["companyId"]; ok {
|
|
|
query.Where("company_id = ?", companyId)
|
|
|
query.Where("staff_assess.company_id = ?", companyId)
|
|
|
}
|
|
|
if v, ok := queryOptions["limit"].(int); ok {
|
|
|
query.Limit(v)
|
...
|
...
|
@@ -128,34 +129,34 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in |
|
|
query.Offset(v)
|
|
|
}
|
|
|
if v, ok := queryOptions["targetUserId"]; ok {
|
|
|
query.Where(`target_user->>'userId'='?'`, v)
|
|
|
query.Where(`staff_assess.target_user->>'userId'='?'`, v)
|
|
|
}
|
|
|
|
|
|
if v, ok := queryOptions["targetUserName"].(string); ok {
|
|
|
query.Where(`target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v))
|
|
|
query.Where(`staff_assess.target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v))
|
|
|
}
|
|
|
if v, ok := queryOptions["executorId"]; ok {
|
|
|
query.Where(`executor->>'userId'='?'`, v)
|
|
|
query.Where(`staff_assess.executor->>'userId'='?'`, v)
|
|
|
}
|
|
|
|
|
|
if v, ok := queryOptions["cycleId"]; ok {
|
|
|
query.Where(`cycle_id=?`, v)
|
|
|
query.Where(`staff_assess.cycle_id=?`, v)
|
|
|
}
|
|
|
if v, ok := queryOptions["staffAssessTaskId"]; ok {
|
|
|
query.Where(`staff_assess_task_id=?`, v)
|
|
|
query.Where(`staff_assess.staff_assess_task_id=?`, v)
|
|
|
}
|
|
|
|
|
|
if v, ok := queryOptions["id"]; ok {
|
|
|
query.Where("id=?", v)
|
|
|
query.Where("staff_assess.id=?", v)
|
|
|
}
|
|
|
if v, ok := queryOptions["typesList"].([]string); ok {
|
|
|
query.Where("types in(?)", pg.In(v))
|
|
|
query.Where("staff_assess.types in(?)", pg.In(v))
|
|
|
}
|
|
|
if v, ok := queryOptions["status"]; ok {
|
|
|
query.Where("status=?", v)
|
|
|
query.Where("staff_assess.status=?", v)
|
|
|
}
|
|
|
if v, ok := queryOptions["endTime"]; ok {
|
|
|
query.Where("end_time<=?", v)
|
|
|
query.Where("staff_assess.end_time<=?", v)
|
|
|
}
|
|
|
if v, ok := queryOptions["beginDay"]; ok {
|
|
|
query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v)
|
...
|
...
|
|