123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- package dto
- import (
- "Medical_OAuth/app/admin/model"
- "Medical_OAuth/common/dto"
- common "Medical_OAuth/common/model"
- )
- // SysServicePageReq 列表或者搜索使用结构体
- type SysServicePageReq struct {
- dto.Pagination `search:"-"`
- Name string `form:"name" search:"type:orcontains;column:name;table:sys_service"` // 服务名称
- No string `form:"no" search:"type:orcontains;column:no;table:sys_service"` // 服务编号
- Status int `form:"status" search:"type:exact;column:status;table:sys_service"` // 状态
- SysServiceOrder
- }
- type SysServiceOrder struct {
- IdOrder string `form:"id" search:"type:order;column:id;table:sys_service" default:"desc"` //排序 ASC 升序 DESC 降序
- }
- func (m *SysServicePageReq) GetNeedSearch() interface{} {
- return *m
- }
- // SysServiceInsertReq 增使用的结构体
- type SysServiceInsertReq struct {
- Id int `json:"id" comment:"id" swaggerignore:"true"`
- No string `json:"serviceNo" swaggerignore:"true"` // 服务编号
- Name string `json:"name" example:"用户系统" vd:"@:len($)>0; msg:'服务名称不能为空'"` // 服务名称
- Host string `json:"host" example:"http://127.0.0.1:8080/user" vd:"@:len($)>0; msg:'服务地址不能为空'"` // 服务地址
- AuthCode string `json:"authCode" example:"3EDJRaagFTVVo2Ilo80nHJfLVN1OgN8d" vd:"@:len($)>0; msg:'授权码不能为空'"` // 授权码
- Status int `json:"status" vd:"$>0" example:"1" default:"1"` // 状态 1-停用 2-正常
- RoleApiUrl string `json:"roleApiUrl" example:"/role/api"` // 角色api回调地址
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysServiceInsertReq) Generate(model *model.SysService) {
- model.No = s.No
- model.Name = s.Name
- model.Host = s.Host
- model.Status = s.Status
- model.AuthCode = s.AuthCode
- model.RoleApiUrl = s.RoleApiUrl
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- // GetId 获取数据对应的ID
- func (s *SysServiceInsertReq) GetId() interface{} {
- return s.Id
- }
- // SysServiceUpdateReq 改使用的结构体
- type SysServiceUpdateReq struct {
- Id int `uri:"id" swaggerignore:"true"`
- Name string `json:"name" example:"用户系统" vd:"@:len($)>0; msg:'服务名称不能为空'"` // 服务名称
- Host string `json:"host" example:"http://127.0.0.1:8080/user" vd:"@:len($)>0; msg:'服务地址不能为空'"` // 服务地址
- AuthCode string `json:"authCode" example:"3EDJRaagFTVVo2Ilo80nHJfLVN1OgN8d" vd:"@:len($)>0; msg:'授权码不能为空'"` // 授权码
- Status int `json:"status" vd:"$>0" example:"1" default:"1"`
- RoleApiUrl string `json:"roleApiUrl" example:"/role/api"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysServiceUpdateReq) Generate(model *model.SysService) {
- model.Id = s.Id
- model.Name = s.Name
- model.Host = s.Host
- model.AuthCode = s.AuthCode
- model.Status = s.Status
- model.RoleApiUrl = s.RoleApiUrl
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *SysServiceUpdateReq) GetId() interface{} {
- return s.Id
- }
- // SysServiceGetReq 获取单个的结构体
- type SysServiceGetReq struct {
- Id int `uri:"id"`
- }
- func (s *SysServiceGetReq) GetId() interface{} {
- return s.Id
- }
- // SysServiceDeleteReq 删除的结构体
- type SysServiceDeleteReq struct {
- Ids []int `json:"ids"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *SysServiceDeleteReq) Generate(model *model.SysService) {
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *SysServiceDeleteReq) GetId() interface{} {
- return s.Ids
- }
- // SysServiceDiscoveryReq 增使用的结构体
- type SysServiceDiscoveryReq struct {
- Id int `swaggerignore:"true"`
- No string `swaggerignore:"true"` // 服务编号
- Name string `json:"name" example:"用户系统" vd:"@:len($)>0; msg:'服务名称不能为空'"` // 服务名称
- Host string `json:"host" example:"http://127.0.0.1:8080/user" vd:"@:len($)>0; msg:'服务地址不能为空'"` // 服务地址
- AuthCode string `json:"authCode" example:"3EDJRaagFTVVo2Ilo80nHJfLVN1OgN8d" vd:"@:len($)>0; msg:'授权码不能为空'"` // 授权码
- RoleApiUrl string `json:"roleApiUrl" example:"/api/role-api-test"` // 授权码
- Status int `swaggerignore:"true"` // 状态 1-停用 2-正常
- }
- func (s *SysServiceDiscoveryReq) Generate(model *model.SysService) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- if len(s.No) > 0 {
- model.No = s.No
- }
- model.Name = s.Name
- model.Host = s.Host
- model.AuthCode = s.AuthCode
- model.RoleApiUrl = s.RoleApiUrl
- }
- // GetId 获取数据对应的ID
- func (s *SysServiceDiscoveryReq) GetId() interface{} {
- return s.Id
- }
|