package dto import ( models "ERP_salary/models/Performance" "strconv" "strings" ) // PerformancePointsPageReq 列表或者搜索使用结构体 type PerformancePointsPageReq struct { Pagination `search:"-"` T_name string `form:"T_name" search:"type:contains;column:t_name;table:performance_points" example:""` // 名称 } func (m *PerformancePointsPageReq) GetNeedSearch() interface{} { return *m } // PerformancePointsInsertReq 增使用的结构体 type PerformancePointsInsertReq struct { T_name string `form:"T_name" example:"试用期" vd:"len($)>0;msg:'名称不能为空'"` // 名称 T_points string `form:"T_points" example:"100" vd:"len($)>0;msg:'绩效点数量不能为空'"` // 绩效点数量 T_remark string `form:"T_remark" example:"备注"` // 备注 } func (s *PerformancePointsInsertReq) Generate(model *models.PerformancePoints) { model.T_name = s.T_name T_points_numerator, T_points_denominator := 1, 1 T_points := s.T_points if len(T_points) > 0 { if strings.Contains(T_points, "/") { T_points_numerator, _ = strconv.Atoi(T_points[:strings.Index(T_points, "/")]) T_points_denominator, _ = strconv.Atoi(T_points[strings.Index(T_points, "/")+1:]) } else { T_points_numerator, _ = strconv.Atoi(T_points) } } model.T_points_numerator = T_points_numerator model.T_points_denominator = T_points_denominator model.T_remark = s.T_remark model.T_State = 1 } // PerformancePointsUpdateReq 改使用的结构体 type PerformancePointsUpdateReq struct { T_id int `form:"T_id" example:"1"` T_name string `form:"T_name" example:"服务类型" vd:"len($)>0;msg:'名称不能为空'"` // 名称 T_points string `form:"T_points" example:"100" vd:"len($)>0;msg:'绩效点数量不能为空'"` // 绩效点数量 T_remark string `form:"T_remark" example:"备注"` // 备注 } func (s *PerformancePointsUpdateReq) Generate(model *models.PerformancePoints) { model.Id = s.T_id model.T_name = s.T_name T_points_numerator, T_points_denominator := 1, 1 T_points := s.T_points if len(T_points) > 0 { if strings.Contains(T_points, "/") { T_points_numerator, _ = strconv.Atoi(T_points[:strings.Index(T_points, "/")]) T_points_denominator, _ = strconv.Atoi(T_points[strings.Index(T_points, "/")+1:]) } else { T_points_numerator, _ = strconv.Atoi(T_points) } } model.T_points_numerator = T_points_numerator model.T_points_denominator = T_points_denominator model.T_remark = s.T_remark model.T_State = 1 } func (s *PerformancePointsUpdateReq) GetId() interface{} { return s.T_id } // PerformancePointsGetReq 获取单个的结构体 type PerformancePointsGetReq struct { T_id int `form:"T_id"` } func (s *PerformancePointsGetReq) GetId() interface{} { return s.T_id } // PerformancePointsDeleteReq 删除的结构体 type PerformancePointsDeleteReq struct { T_id int `form:"T_id"` } func (s *PerformancePointsDeleteReq) GetId() interface{} { return s.T_id }