123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package dto
- import (
- "Medical_OAuth/app/admin/model"
- common "Medical_OAuth/common/model"
- )
- // SysDeptGetPageReq 列表或者搜索使用结构体
- type SysDeptGetPageReq struct {
- DeptName string `form:"deptName" search:"type:contains;column:dept_name;table:sys_dept" example:"部门名称"` //部门名称
- DeptId int `form:"deptId" search:"-" swaggerignore:"true"` //部门名称
- SysDeptOrder
- }
- type SysDeptOrder struct {
- SortOrder string `search:"type:order;column:sort;table:sys_dept" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序
- }
- func (m *SysDeptGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
- type SysDeptInsertReq struct {
- Id int `json:"id" swaggerignore:"true"`
- ParentId int `json:"parentId" example:"0" vd:"?"` //上级部门
- DeptName string `json:"deptName" example:"部门名称" vd:"len($)>0"` //部门名称
- Sort int `json:"sort" swaggerignore:"true"` //排序
- Status int `json:"status" swaggerignore:"true"` //状态 1-停用 2-正常
- DeptPath string `swaggerignore:"true"` //路径
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysDeptInsertReq) Generate(model *model.SysDept) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.DeptName = s.DeptName
- model.ParentId = s.ParentId
- model.Sort = 0
- model.Status = 2
- }
- // GetId 获取数据对应的ID
- func (s *SysDeptInsertReq) GetId() interface{} {
- return s.Id
- }
- type SysDeptUpdateReq struct {
- Id int `json:"id" comment:"编码"` // 编码
- DeptName string `json:"deptName" example:"部门名称" vd:"len($)>0"` //部门名称
- Status int `json:"status" swaggerignore:"true"` //状态 1-停用 2-正常
- Sort int `json:"sort" swaggerignore:"true"` //排序
- DeptPath string `swaggerignore:"true"` //路径
- common.ControlBy `swaggerignore:"true"`
- }
- // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
- func (s *SysDeptUpdateReq) Generate(model *model.SysDept) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.DeptName = s.DeptName
- model.Sort = 0
- model.Status = 2
- }
- // GetId 获取数据对应的ID
- func (s *SysDeptUpdateReq) GetId() interface{} {
- return s.Id
- }
- type SysDeptGetReq struct {
- Id int `uri:"id"`
- }
- func (s *SysDeptGetReq) GetId() interface{} {
- return s.Id
- }
- type SysDeptGetRootIDReq struct {
- Id int `form:"id"`
- }
- func (s *SysDeptGetRootIDReq) GetId() interface{} {
- return s.Id
- }
- type SysDeptDeleteReq struct {
- Id int `json:"id"`
- }
- func (s *SysDeptDeleteReq) GetId() interface{} {
- return s.Id
- }
- type DeptLabel struct {
- Id int `gorm:"-" json:"id"`
- Label string `gorm:"-" json:"label"`
- Children []DeptLabel `gorm:"-" json:"children"`
- }
- type SysDeptEnterReq struct {
- Id int `json:"id"`
- }
- func (s *SysDeptEnterReq) GetId() interface{} {
- return s.Id
- }
|