作者 tangxvhui

暂存

package query
type ListAssessContentCycleDay struct {
CompanyId int `json:"companyId"`
OperaterId int `json:"operaterId"`
CycleId int `json:"cycleId,string"`
BeginDay string `json:"beginDay"`
TargetUserName string `json:"targetUserName"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
... ...
... ... @@ -68,3 +68,22 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl
//根据周期id和日期获取 员工填写评估内容
// 有过滤查看权限
func (srv StaffAssessServeice) ListAllAssessContentCycleDay(param *query.ListAssessContentCycleDay) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
"transactionContext": transactionContext,
})
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
return nil, nil
}
... ...
... ... @@ -210,6 +210,39 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
return result, err
}
//根据周期的id和日期获取员工填写的评估内容,数量统计
//companyId int 公司id
//cycleId int, 评估周期id
//userId int, 用户id,谁要查看数据
//beginDay string, 周期中执行项目的时间
//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
//limit int, 分页条数
//offset int 分页偏移
func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) ([]UserAssessContent, error) {
sqlStr := ` select
t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day,
staff_assess_content.value ,staff_assess_content.sort_by ,
staff_assess_content.category ,staff_assess_content."name" as content_name ,
staff_assess_content.weight
from t_staff_assess_1
left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
`
condition := []interface{}{}
if len(param.TargetUserName) > 0 {
sqlStr += ` where t_staff_assess_1.target_user_name like ? `
condition = append(condition, param.TargetUserName)
}
//加入排序
sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
//获取前置sql语句
sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset)
sqlStr = sqlStr0 + sqlStr
tx := d.transactionContext.PgTx
var result []UserAssessContent
_, err := tx.QueryOne(&result, sqlStr, condition...)
return result, err
}
//生成的sql 根据用户的查看权限 ,获取可查看的评估任务,
//companyId int 公司id
//cycleId int, 评估周期id
... ...