123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- package dto
- import (
- "Medical_OAuth/app/admin/model"
- "Medical_OAuth/common/dto"
- common "Medical_OAuth/common/model"
- )
- // ServApiGetPageReq 列表或者搜索使用结构体
- type ServApiGetPageReq struct {
- dto.Pagination `search:"-"`
- ServiceId int `form:"serviceId" search:"type:exact;column:service_id;table:serv_api"` // 服务id
- Name string `form:"name" search:"type:orcontains;column:name;table:serv_api"` // 名称
- Path string `form:"name" search:"type:orcontains;column:path;table:serv_api" swaggerignore:"true"` // 路径
- }
- func (m *ServApiGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
- // ServApiInsertReq 功能创建请求参数
- type ServApiInsertReq struct {
- Id int `json:"id" swaggerignore:"true"` // 编码
- ServiceId int `json:"ServiceId"` // 服务id
- Name string `json:"name" example:"标题"` // 标题
- Path string `json:"path" example:"/api/list"` // 地址
- Action string `json:"type" example:"GET"` // 请求类型 GET PUT POST DELETE
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ServApiInsertReq) Generate(model *model.ServApi) {
- model.ServiceId = s.ServiceId
- model.Name = s.Name
- model.Path = s.Path
- model.Action = s.Action
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *ServApiInsertReq) GetId() interface{} {
- return s.Id
- }
- // ServApiUpdateReq 功能更新请求参数
- type ServApiUpdateReq struct {
- Id int `uri:"id" swaggerignore:"true"` // 接口ID
- Name string `json:"name" example:"标题"` // 标题
- Path string `json:"path" example:"/api/list"` // 地址
- Action string `json:"type" example:"GET"` // 请求类型
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ServApiUpdateReq) Generate(model *model.ServApi) {
- model.Name = s.Name
- model.Path = s.Path
- model.Action = s.Action
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *ServApiUpdateReq) GetId() interface{} {
- return s.Id
- }
- // ServApiGetReq 功能获取请求参数
- type ServApiGetReq struct {
- Id int `uri:"id"`
- }
- func (s *ServApiGetReq) GetId() interface{} {
- return s.Id
- }
- // ServApiDeleteReq 功能删除请求参数
- type ServApiDeleteReq struct {
- Ids []int `json:"ids"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *ServApiDeleteReq) GetId() interface{} {
- return s.Ids
- }
- // ServApiListByMenuId 获取菜单关联api列表
- type ServApiListByMenuId struct {
- MenuId int `search:"type:exact;column:menu_id;table:app_api"`
- }
- func (m *ServApiListByMenuId) GetNeedSearch() interface{} {
- return *m
- }
- // ServApiListByIds 功能获取请求参数
- type ServApiListByIds struct {
- ServiceId int `search:"type:exact;column:service_id;table:serv_api"` // 服务id
- Ids []int `search:"type:in;column:id;table:serv_api"`
- }
- func (m *ServApiListByIds) GetNeedSearch() interface{} {
- return *m
- }
|