yinbentan
2024-07-25 1bd58eb901da8ca32d15c121effa7e22cc89e1bd
controllers/salary_plan_controller.go
@@ -233,3 +233,105 @@
   }
   util.ResponseFormat(c, code.Success, dicts)
}
// GetPayrollProductionCarList
//
//   @Tags      员工薪资/薪酬方案
//   @Summary   获取车台每天的产量列表
//   @Produce   application/json
//   @Param        Authorization   header string true "token"
//   @Param        object  query    request.PayrollProductionCar true  "查询参数"
//   @Success   200      {object}   util.ResponseList{data=[]models.PayrollProductionCar}   "成功"
//   @Router      /api-jl/v1/salary/getPayrollProductionCarList [get]
func (slf SalaryPlanController) GetPayrollProductionCarList(c *gin.Context) {
   var params request.PayrollProductionCar
   if err := c.ShouldBindQuery(&params); err != nil {
      util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误")
      return
   }
   carSearch := models.NewPayrollProductionCarSearch()
   if len(params.Cycle) == 0 && len(params.Monthly) == 0 {
      util.ResponseFormat(c, code.RequestParamError, "请检查查询周期,必须输入按天查询或按月查询。格式:Cycle(yyyy-MM-dd) 或 Monthly(yyyy-MM)")
      return
   }
   carSearch.SetPage(params.Page, params.PageSize)
   carSearch.SetWorkshopNumber(params.WorkshopNumber).SetGroupNumber(params.GroupNumber).SetCarNumber(params.CarNumber).SetMarketNumber(params.MarketNumber).SetSpec(params.Spec)
   list, total, err := carSearch.Find()
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "查找失败")
      return
   }
   util.ResponseFormatList(c, code.Success, list, total)
}
// GetPayrollProductionGroupList
//
//   @Tags      员工薪资/薪酬方案
//   @Summary   获取小组每天的产量列表
//   @Produce   application/json
//   @Param        Authorization   header string true "token"
//   @Param        object  query    request.PayrollProductionGroup true  "查询参数"
//   @Success   200      {object}   util.ResponseList{data=[]models.PayrollProductionGroup}   "成功"
//   @Router      /api-jl/v1/salary/getPayrollProductionGroupList [get]
func (slf SalaryPlanController) GetPayrollProductionGroupList(c *gin.Context) {
   var params request.PayrollProductionGroup
   if err := c.ShouldBindQuery(&params); err != nil {
      util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误")
      return
   }
   //params = request.PayrollProductionGroup{
   //   Cycle:          c.Query("cycle"),
   //   Monthly:        c.Query("monthly"),
   //   WorkshopNumber: c.Query("workshopNumber"),
   //}
   //params.GroupNumber, _ = strconv.Atoi(c.Query("groupNumber"))
   //params.Page, _ = strconv.Atoi(c.Query("page"))
   //params.PageSize, _ = strconv.Atoi(c.Query("pageSize"))
   if len(params.Cycle) == 0 && len(params.Monthly) == 0 {
      util.ResponseFormat(c, code.RequestParamError, "请检查查询周期,必须输入按天查询或按月查询。格式:Cycle(yyyy-MM-dd) 或 Monthly(yyyy-MM)")
      return
   }
   list, total, err := models.NewPayrollProductionGroupSearch().SetPage(params.Page, params.PageSize).
      SetCycle(params.Cycle).SetMonthly(params.Monthly).SetWorkshopNumber(params.WorkshopNumber).SetGroupNumber(params.GroupNumber).
      Find()
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "查找失败")
      return
   }
   util.ResponseFormatList(c, code.Success, list, total)
}
// GetPayrollSalaryPlanList
//
//   @Tags      员工薪资/薪酬方案
//   @Summary   获取人员每月的薪资列表
//   @Produce   application/json
//   @Param        Authorization   header string true "token"
//   @Param        object  query    request.PayrollSalaryPlan true  "查询参数"
//   @Success   200      {object}   util.ResponseList{data=[]models.PayrollSalaryPlan}   "成功"
//   @Router      /api-jl/v1/salary/getPayrollSalaryPlanList [get]
func (slf SalaryPlanController) GetPayrollSalaryPlanList(c *gin.Context) {
   var params request.PayrollSalaryPlan
   if err := c.ShouldBindQuery(&params); err != nil {
      util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误")
      return
   }
   if len(params.Cycle) == 0 {
      util.ResponseFormat(c, code.RequestParamError, "请检查查询周期。格式:Cycle(yyyy-MM-dd)")
      return
   }
   list, total, err := models.NewPayrollSalaryPlanSearch().SetPage(params.Page, params.PageSize).
      SetCycle(params.Cycle).SetWorkerID(params.WorkerID).SetKeyword(params.Keyword).SetWorkTypeID(uint(params.WorkTypeID)).SetWorkTypeCode(constvar.JobType(params.WorkTypeCode)).
      Find()
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "查找失败")
      return
   }
   util.ResponseFormatList(c, code.Success, list, total)
}