| | |
| | | // SalaryReportForms |
| | | // |
| | | // @Tags 报表管理 |
| | | // @Summary 薪资报表 |
| | | // @Summary 获取薪资报表 |
| | | // @Produce application/json |
| | | // @Param object body request.SalaryReportForms true "参数" |
| | | // @Param Authorization header string true "token" |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | reportForms, total, err := models.NewSalaryReportFormSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetPreload(true).Find() |
| | | reportForms, total, err := models.NewSalaryReportFormSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword). |
| | | SetMonth(params.Month).SetPreload(true).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err) |
| | | return |
| | |
| | | } |
| | | util.ResponseFormatList(c, code.Success, data, total) |
| | | } |
| | | |
| | | // UpdateSalaryReportForms |
| | | // |
| | | // @Tags 报表管理 |
| | | // @Summary 修改薪资报表 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateSalaryReportForms true "参数" |
| | | // @Param Authorization header string true "token" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-jl/v1/forms/updateSalaryReportForms [post] |
| | | func (slf ReportFormsController) UpdateSalaryReportForms(c *gin.Context) { |
| | | var params request.UpdateSalaryReportForms |
| | | err := c.BindJSON(¶ms) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | first, err := models.NewSalaryReportFormSearch().SetMonth(params.Month).SetWorkerId(params.WorkerId).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err) |
| | | return |
| | | } |
| | | err = models.NewSalaryDetailsSearch().SetSalaryTypeId(params.SalaryTypeId).SetSalaryReportFormId(first.ID). |
| | | UpdateByMap(map[string]interface{}{"amount": params.Amount}) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "更新失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.RequestParamError, "更新成功") |
| | | } |