1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package dto
- import (
- "Medical_ERP/common/dto"
- common "Medical_ERP/common/model"
- "Medical_ERP/models"
- )
- // ProductPageReq 列表或者搜索使用结构体
- type ProductPageReq struct {
- dto.Pagination `search:"-"`
- Name string `json:"name" search:"type:contains;column:name;table:product" example:""` // 名称
- }
- func (m *ProductPageReq) GetNeedSearch() interface{} {
- return *m
- }
- // ProductInsertReq 增使用的结构体
- type ProductInsertReq struct {
- Id int `json:"id" comment:"id" swaggerignore:"true"`
- Name string `json:"name" example:"品名" valid:"MinSize(1)"` //品名
- Sort int `json:"sort" example:"0" swaggerignore:"true"` //排序
- Remark string `json:"remark" example:"备注" swaggerignore:"true"` //备注
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ProductInsertReq) Generate(model *models.Product) {
- model.Name = s.Name
- model.Sort = s.Sort
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- model.DeptId = s.DeptId
- }
- // GetId 获取数据对应的ID
- func (s *ProductInsertReq) GetId() interface{} {
- return s.Id
- }
- // ProductUpdateReq 改使用的结构体
- type ProductUpdateReq struct {
- Id int `json:"id" example:"1"`
- Name string `json:"name" example:"品名"` // 品名
- Sort int `json:"sort" example:"0" swaggerignore:"true"` //排序
- Remark string `json:"remark" example:"备注" swaggerignore:"true"` // 备注
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ProductUpdateReq) Generate(model *models.Product) {
- model.Id = s.Id
- model.Name = s.Name
- model.Sort = s.Sort
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *ProductUpdateReq) GetId() interface{} {
- return s.Id
- }
- // ProductGetReq 获取单个的结构体
- type ProductGetReq struct {
- Id int `json:"id"`
- }
- func (s *ProductGetReq) GetId() interface{} {
- return s.Id
- }
- // ProductDeleteReq 删除的结构体
- type ProductDeleteReq struct {
- Id int `json:"id"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ProductDeleteReq) Generate(model *models.Product) {
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *ProductDeleteReq) GetId() interface{} {
- return s.Id
- }
|