This commit is contained in:
jiangyong27 2025-03-29 17:36:20 +08:00
parent 3664ae4c3e
commit a47d274b00
2 changed files with 5 additions and 4 deletions

View File

@ -19,12 +19,9 @@ func NewSalary() *Salary {
func (s *Salary) List(ctx *gin.Context) { func (s *Salary) List(ctx *gin.Context) {
sess := ctx.Keys[session.ContextSession].(*session.AdminSession) sess := ctx.Keys[session.ContextSession].(*session.AdminSession)
if !sess.GetAdmin().GetConfig().IsFinance() {
panic(config.ErrPriv.New())
}
var req api.ListSalaryReq var req api.ListSalaryReq
session.CheckParamError(ctx.ShouldBind(&req)) session.CheckParamError(ctx.ShouldBind(&req))
total, summary, items := service.NewStaffSalary().List(ctx.Keys[session.ContextSession].(*session.AdminSession), &req) total, summary, items := service.NewStaffSalary().List(sess, &req)
ctx.JSON(http.StatusOK, session.NewSummaryRsp(total, summary, items)) ctx.JSON(http.StatusOK, session.NewSummaryRsp(total, summary, items))
} }

View File

@ -34,6 +34,10 @@ func NewStaffSalary() *StaffSalary {
} }
func (s *StaffSalary) List(sess *session.AdminSession, req *api.ListSalaryReq) (int64, interface{}, interface{}) { func (s *StaffSalary) List(sess *session.AdminSession, req *api.ListSalaryReq) (int64, interface{}, interface{}) {
if !sess.GetAdmin().GetConfig().IsFinance() {
return 0, nil, nil
}
salarys, total, err := dao.NewStaffSalaryDao().QueryAdmin(1, -1, sess.GetCorpId(), req.StaffId, req.StartMonth, req.EndMonth, req.Status) salarys, total, err := dao.NewStaffSalaryDao().QueryAdmin(1, -1, sess.GetCorpId(), req.StaffId, req.StartMonth, req.EndMonth, req.Status)
session.CheckDBError(err) session.CheckDBError(err)
start := (req.Page - 1) * req.Size start := (req.Page - 1) * req.Size