作者 tangxvhui

暂存

... ... @@ -183,19 +183,69 @@ right join assess_list on assess_list.staff_assess_id = staff_assess_content.sta
**/
//获取员工填写评估内容
type UserAssessContent struct {
TargetUserId string //被评估人的id
TargetUserName string //被评估人的名称
BeginDay string //评估的日期
EvaluationProjectId string //项目id
Value string //评估填写的值
SortBy int // p评估项顺序
SortBy int //评估项顺序
Category string //分类
Name string //名称
Weight int //权重
}
type SearchConditin1 struct {
CycleId int //周期id
BeginDay string //评估的日期
UserName string //被评估人的名称
Limit int //分页
Offset int //分页
DepartmentId []int //
OperaterId int //用户的id是谁在搜索数据
IsHrBp bool //
}
//根据周期的id和日期获取员工填写的评估内容
func (d *StaffAssessDao) SearchUserAssessContent(cycleId int, beginDay string, limit int, offset int) error {
return nil
//cycleId 周期id
//beginDay 评估任务的生成日期
//userName 被评估的员工名称,
// limit offset 分页搜索
func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserAssessContent, error) {
sqlStr := `with assess_list as(
select
staff_assess.id as staff_assess_id,
staff_assess.target_user ->>'userId' as target_user_id,
staff_assess.target_user ->>'userName' as target_user_name,
staff_assess.evaluation_project_id,
to_char( staff_assess.begin_time,'YYYY-MM-DD') as begin_day
from staff_assess
where staff_assess.cycle_id = ?
and to_char( staff_assess.begin_time,'YYYY-MM-DD') ='?'
and staff_assess."types" ='self'
and staff_assess.target_user ->>'userName' like '?'
limit ? offset ?
)
select
assess_list.target_user_id,
assess_list.target_user_name,
assess_list.begin_day,
assess_list.evaluation_project_id,
staff_assess_content.value ,
staff_assess_content.sort_by ,
staff_assess_content.category ,
staff_assess_content."name" ,
staff_assess_content.weight
from staff_assess_content
right join assess_list on assess_list.staff_assess_id = staff_assess_content.staff_assess_id
order by convert_to(assess_list.target_user_name,'GBK') `
tx := d.transactionContext.PgTx
condition := []interface{}{
param.CycleId, param.BeginDay, "%" + param.UserName + "%", param.Limit, param.Offset,
}
var result []UserAssessContent
_, err := tx.QueryOne(&result, sqlStr, condition...)
return result, err
}
... ...