salary5
This commit is contained in:
parent
0b457499ae
commit
cd27b06448
|
@ -1,7 +1,6 @@
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"enterprise/common/dao"
|
|
||||||
"enterprise/server/api"
|
"enterprise/server/api"
|
||||||
"enterprise/server/service"
|
"enterprise/server/service"
|
||||||
"enterprise/server/session"
|
"enterprise/server/session"
|
||||||
|
@ -50,6 +49,6 @@ func (s *Salary) Pay(ctx *gin.Context) {
|
||||||
|
|
||||||
func (s *Salary) Delete(ctx *gin.Context) {
|
func (s *Salary) Delete(ctx *gin.Context) {
|
||||||
id := cast.ToInt64(ctx.Query("id"))
|
id := cast.ToInt64(ctx.Query("id"))
|
||||||
dao.NewStaffSalaryDao().Delete(id)
|
service.NewStaffSalary().Delete(ctx.Keys[session.ContextSession].(*session.AdminSession), id)
|
||||||
ctx.JSON(http.StatusOK, session.NewRspOk())
|
ctx.JSON(http.StatusOK, session.NewRspOk())
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,15 @@ func (s *StaffSalary) Create(sess *session.AdminSession, req *api.CreateSalaryRe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StaffSalary) Delete(sess *session.AdminSession, id int64) {
|
||||||
|
salary, err := dao.NewStaffSalaryDao().Get(id)
|
||||||
|
session.CheckDBError(err)
|
||||||
|
session.CheckNilError(salary, "工资段不存在")
|
||||||
|
if salary.Status == model.StaffSalaryStatusPayed {
|
||||||
|
panic("已支付的不能删除")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StaffSalary) Update(sess *session.AdminSession, req *api.UpdateSalaryReq) {
|
func (s *StaffSalary) Update(sess *session.AdminSession, req *api.UpdateSalaryReq) {
|
||||||
salary, err := dao.NewStaffSalaryDao().Get(cast.ToInt64(req.Id))
|
salary, err := dao.NewStaffSalaryDao().Get(cast.ToInt64(req.Id))
|
||||||
session.CheckDBError(err)
|
session.CheckDBError(err)
|
||||||
|
|
Loading…
Reference in New Issue