123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- package dto
- import (
- "Medical_OAuth/app/admin/model"
- "Medical_OAuth/common/dto"
- common "Medical_OAuth/common/model"
- )
- // SysPostPageReq 列表或者搜索使用结构体
- type SysPostPageReq struct {
- dto.Pagination `search:"-"`
- PostName string `form:"postName" search:"type:contains;column:post_name;table:sys_post"` // 名称
- Status int `form:"status" search:"type:exact;column:status;table:sys_post"` // 状态
- SysPostOrder
- }
- type SysPostOrder struct {
- SortOrder string `search:"type:order;column:sort;table:sys_post" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序
- }
- func (m *SysPostPageReq) GetNeedSearch() interface{} {
- return *m
- }
- // SysPostInsertReq 增使用的结构体
- type SysPostInsertReq struct {
- Id int `json:"id" comment:"id" swaggerignore:"true"`
- PostName string `json:"postName" example:"岗位名称" vd:"@:len($)>0; msg:'岗位名称不能为空'"` //岗位名称
- Sort int `json:"sort" example:"0"` //排序
- Status int `json:"status" vd:"$>0" example:"2"` //状态 1-停用 2-正常
- Remark string `json:"remark" example:"备注"` //备注
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysPostInsertReq) Generate(model *model.SysPost) {
- model.PostName = s.PostName
- model.Sort = s.Sort
- model.Status = s.Status
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- // GetId 获取数据对应的ID
- func (s *SysPostInsertReq) GetId() interface{} {
- return s.Id
- }
- // SysPostUpdateReq 改使用的结构体
- type SysPostUpdateReq struct {
- Id int `uri:"id" swaggerignore:"true"`
- PostName string `json:"postName" example:"岗位名称"` // 岗位名称
- Sort int `json:"sort" example:"0"` //排序
- Status int `json:"status" example:"2"` //状态
- Remark string `json:"remark" example:"备注"` // 备注
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysPostUpdateReq) Generate(model *model.SysPost) {
- model.Id = s.Id
- model.PostName = s.PostName
- model.Sort = s.Sort
- model.Status = s.Status
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *SysPostUpdateReq) GetId() interface{} {
- return s.Id
- }
- // SysPostGetReq 获取单个的结构体
- type SysPostGetReq struct {
- Id int `uri:"id"`
- }
- func (s *SysPostGetReq) GetId() interface{} {
- return s.Id
- }
- // SysPostDeleteReq 删除的结构体
- type SysPostDeleteReq struct {
- Ids []int `json:"ids"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysPostDeleteReq) Generate(model *model.SysPost) {
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *SysPostDeleteReq) GetId() interface{} {
- return s.Ids
- }
|