1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package dto
- import (
- "Medical_ERP/common/dto"
- common "Medical_ERP/common/model"
- "Medical_ERP/models"
- )
- // EnterprisePageReq 列表或者搜索使用结构体
- type EnterprisePageReq struct {
- dto.Pagination `search:"-"`
- Name string `json:"name" search:"type:contains;column:name;table:enterprise" example:""` // 名称
- }
- func (m *EnterprisePageReq) GetNeedSearch() interface{} {
- return *m
- }
- // EnterpriseInsertReq 增使用的结构体
- type EnterpriseInsertReq 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 *EnterpriseInsertReq) Generate(model *models.Enterprise) {
- 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 *EnterpriseInsertReq) GetId() interface{} {
- return s.Id
- }
- // EnterpriseUpdateReq 改使用的结构体
- type EnterpriseUpdateReq 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 *EnterpriseUpdateReq) Generate(model *models.Enterprise) {
- 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 *EnterpriseUpdateReq) GetId() interface{} {
- return s.Id
- }
- // EnterpriseGetReq 获取单个的结构体
- type EnterpriseGetReq struct {
- Id int `json:"id"`
- }
- func (s *EnterpriseGetReq) GetId() interface{} {
- return s.Id
- }
- // EnterpriseDeleteReq 删除的结构体
- type EnterpriseDeleteReq struct {
- Id int `json:"id"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *EnterpriseDeleteReq) Generate(model *models.Enterprise) {
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *EnterpriseDeleteReq) GetId() interface{} {
- return s.Id
- }
|