...
|
...
|
@@ -333,18 +333,9 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { |
|
|
func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int, assessType string) string {
|
|
|
sqlstr := `
|
|
|
set time zone 'PRC';
|
|
|
with t_user_department as (
|
|
|
select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user"
|
|
|
where "user".company_id= %d and "user".deleted_at isnull
|
|
|
),
|
|
|
t_department as (
|
|
|
select department.id::text as depart_id from department where charge_user_ids @>'[%d]'
|
|
|
and "department".deleted_at isnull
|
|
|
),
|
|
|
-- 部门主管
|
|
|
t_user_1 as (
|
|
|
select t_user_department.user_id::text from t_user_department
|
|
|
join t_department on t_user_department.depart_id = t_department.depart_id
|
|
|
with t_user_1 as (
|
|
|
select "user".id::text as user_id from "user" where "user".parent_id =%d
|
|
|
),
|
|
|
-- 如果是hrbp
|
|
|
t_project_1 as(
|
...
|
...
|
@@ -413,7 +404,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, |
|
|
"assessType": ` and staff_assess."types" ='%s' `,
|
|
|
}
|
|
|
params := []interface{}{
|
|
|
companyId, userId, cycleId, hrbp, cycleId, userId, cycleId,
|
|
|
userId, cycleId, hrbp, cycleId, userId, cycleId,
|
|
|
}
|
|
|
extWhere := ""
|
|
|
if len(beginDay) > 0 {
|
...
|
...
|
|