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