作者 tangxvhui

暂存

  1 +package query
  2 +
  3 +type ListAssessContentCycleDay struct {
  4 + CompanyId int `json:"companyId"`
  5 + OperaterId int `json:"operaterId"`
  6 + CycleId int `json:"cycleId,string"`
  7 + BeginDay string `json:"beginDay"`
  8 + TargetUserName string `json:"targetUserName"`
  9 + PageNumber int `json:"pageNumber"`
  10 + PageSize int `json:"pageSize"`
  11 +}
@@ -68,3 +68,22 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl @@ -68,3 +68,22 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl
68 68
69 //根据周期id和日期获取 员工填写评估内容 69 //根据周期id和日期获取 员工填写评估内容
70 // 有过滤查看权限 70 // 有过滤查看权限
  71 +func (srv StaffAssessServeice) ListAllAssessContentCycleDay(param *query.ListAssessContentCycleDay) (map[string]interface{}, error) {
  72 + transactionContext, err := factory.CreateTransactionContext(nil)
  73 + if err != nil {
  74 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  75 + }
  76 + if err := transactionContext.StartTransaction(); err != nil {
  77 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  78 + }
  79 + defer func() {
  80 + _ = transactionContext.RollbackTransaction()
  81 + }()
  82 + assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  83 + "transactionContext": transactionContext,
  84 + })
  85 + if err := transactionContext.CommitTransaction(); err != nil {
  86 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  87 + }
  88 + return nil, nil
  89 +}
@@ -210,6 +210,39 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -210,6 +210,39 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
210 return result, err 210 return result, err
211 } 211 }
212 212
  213 +//根据周期的id和日期获取员工填写的评估内容,数量统计
  214 +//companyId int 公司id
  215 +//cycleId int, 评估周期id
  216 +//userId int, 用户id,谁要查看数据
  217 +//beginDay string, 周期中执行项目的时间
  218 +//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  219 +//limit int, 分页条数
  220 +//offset int 分页偏移
  221 +func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) ([]UserAssessContent, error) {
  222 + sqlStr := ` select
  223 + t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day,
  224 + staff_assess_content.value ,staff_assess_content.sort_by ,
  225 + staff_assess_content.category ,staff_assess_content."name" as content_name ,
  226 + staff_assess_content.weight
  227 + from t_staff_assess_1
  228 + left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
  229 + `
  230 + condition := []interface{}{}
  231 + if len(param.TargetUserName) > 0 {
  232 + sqlStr += ` where t_staff_assess_1.target_user_name like ? `
  233 + condition = append(condition, param.TargetUserName)
  234 + }
  235 + //加入排序
  236 + sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
  237 + //获取前置sql语句
  238 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset)
  239 + sqlStr = sqlStr0 + sqlStr
  240 + tx := d.transactionContext.PgTx
  241 + var result []UserAssessContent
  242 + _, err := tx.QueryOne(&result, sqlStr, condition...)
  243 + return result, err
  244 +}
  245 +
213 //生成的sql 根据用户的查看权限 ,获取可查看的评估任务, 246 //生成的sql 根据用户的查看权限 ,获取可查看的评估任务,
214 //companyId int 公司id 247 //companyId int 公司id
215 //cycleId int, 评估周期id 248 //cycleId int, 评估周期id