mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 18:20:50 +00:00
refactor🎨: update request mode name
This commit is contained in:
@@ -6,8 +6,8 @@ import (
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
// SysConfigSearch 列表或者搜索使用结构体
|
||||
type SysConfigSearch struct {
|
||||
// SysConfigGetPageReq 列表或者搜索使用结构体
|
||||
type SysConfigGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
ConfigName string `form:"configName" search:"type:contains;column:config_name;table:sys_config"`
|
||||
ConfigKey string `form:"configKey" search:"type:contains;column:config_key;table:sys_config"`
|
||||
@@ -24,7 +24,15 @@ type SysConfigOrder struct {
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_config" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
func (m *SysConfigSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysConfigGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type SysConfigGetToSysAppReq struct {
|
||||
IsFrontend int `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
|
||||
}
|
||||
|
||||
func (m *SysConfigGetToSysAppReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
@@ -86,22 +94,19 @@ type GetSysConfigByKEYForServiceResp struct {
|
||||
ConfigValue string `json:"configValue" comment:""`
|
||||
}
|
||||
|
||||
// SysConfigById 获取单个或者删除的结构体
|
||||
type SysConfigById struct {
|
||||
Id int `uri:"id"`
|
||||
type SysConfigGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *SysConfigGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysConfigDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysConfigById) Generate() *SysConfigById {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysConfigById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
}
|
||||
return s.Id
|
||||
func (s *SysConfigDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
@@ -3,13 +3,10 @@ package dto
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
common "go-admin/common/models"
|
||||
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
// SysDeptSearch 列表或者搜索使用结构体
|
||||
type SysDeptSearch struct {
|
||||
dto.Pagination `search:"-"`
|
||||
// SysDeptGetPageReq 列表或者搜索使用结构体
|
||||
type SysDeptGetPageReq struct {
|
||||
DeptId int `form:"deptId" search:"type:exact;column:dept_id;table:sys_dept" comment:"id"` //id
|
||||
ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_dept" comment:"上级部门"` //上级部门
|
||||
DeptPath string `form:"deptPath" search:"type:exact;column:dept_path;table:sys_dept" comment:""` //路径
|
||||
@@ -21,26 +18,24 @@ type SysDeptSearch struct {
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_dept" comment:"状态"` //状态
|
||||
}
|
||||
|
||||
func (m *SysDeptSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysDeptGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
// SysDeptControl 增、改使用的结构体
|
||||
type SysDeptControl struct {
|
||||
DeptId int `uri:"id" comment:"编码"` // 编码
|
||||
ParentId int `json:"parentId" comment:"上级部门" vd:"?"` //上级部门
|
||||
DeptPath string `json:"deptPath" comment:""` //路径
|
||||
DeptName string `json:"deptName" comment:"部门名称" vd:"len($)>0"` //部门名称
|
||||
Sort int `json:"sort" comment:"排序" vd:"?"` //排序
|
||||
Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
|
||||
Phone string `json:"phone" comment:"手机" vd:"?"` //手机
|
||||
Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
|
||||
Status int `json:"status" comment:"状态" vd:"$>0"` //状态
|
||||
type SysDeptInsertReq struct {
|
||||
DeptId int `uri:"id" comment:"编码"` // 编码
|
||||
ParentId int `json:"parentId" comment:"上级部门" vd:"?"` //上级部门
|
||||
DeptPath string `json:"deptPath" comment:""` //路径
|
||||
DeptName string `json:"deptName" comment:"部门名称" vd:"len($)>0"` //部门名称
|
||||
Sort int `json:"sort" comment:"排序" vd:"?"` //排序
|
||||
Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
|
||||
Phone string `json:"phone" comment:"手机" vd:"?"` //手机
|
||||
Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
|
||||
Status int `json:"status" comment:"状态" vd:"$>0"` //状态
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
|
||||
func (s *SysDeptControl) Generate(model *models.SysDept) {
|
||||
func (s *SysDeptInsertReq) Generate(model *models.SysDept) {
|
||||
if s.DeptId != 0 {
|
||||
model.DeptId = s.DeptId
|
||||
}
|
||||
@@ -55,31 +50,57 @@ func (s *SysDeptControl) Generate(model *models.SysDept) {
|
||||
}
|
||||
|
||||
// GetId 获取数据对应的ID
|
||||
func (s *SysDeptControl) GetId() interface{} {
|
||||
func (s *SysDeptInsertReq) GetId() interface{} {
|
||||
return s.DeptId
|
||||
}
|
||||
|
||||
// SysDeptById 获取单个或者删除的结构体
|
||||
type SysDeptById struct {
|
||||
Id int `uri:"id"`
|
||||
Ids []int `json:"ids"`
|
||||
type SysDeptUpdateReq struct {
|
||||
DeptId int `uri:"id" comment:"编码"` // 编码
|
||||
ParentId int `json:"parentId" comment:"上级部门" vd:"?"` //上级部门
|
||||
DeptPath string `json:"deptPath" comment:""` //路径
|
||||
DeptName string `json:"deptName" comment:"部门名称" vd:"len($)>0"` //部门名称
|
||||
Sort int `json:"sort" comment:"排序" vd:"?"` //排序
|
||||
Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
|
||||
Phone string `json:"phone" comment:"手机" vd:"?"` //手机
|
||||
Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
|
||||
Status int `json:"status" comment:"状态" vd:"$>0"` //状态
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDeptById) Generate() *SysDeptById {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysDeptById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
// Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
|
||||
func (s *SysDeptUpdateReq) Generate(model *models.SysDept) {
|
||||
if s.DeptId != 0 {
|
||||
model.DeptId = s.DeptId
|
||||
}
|
||||
model.DeptName = s.DeptName
|
||||
model.ParentId = s.ParentId
|
||||
model.DeptPath = s.DeptPath
|
||||
model.Sort = s.Sort
|
||||
model.Leader = s.Leader
|
||||
model.Phone = s.Phone
|
||||
model.Email = s.Email
|
||||
model.Status = s.Status
|
||||
}
|
||||
|
||||
// GetId 获取数据对应的ID
|
||||
func (s *SysDeptUpdateReq) GetId() interface{} {
|
||||
return s.DeptId
|
||||
}
|
||||
|
||||
type SysDeptGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *SysDeptGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
|
||||
return &models.SysDept{}, nil
|
||||
type SysDeptDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
}
|
||||
|
||||
func (s *SysDeptDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
type DeptLabel struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysDictDataSearch struct {
|
||||
type SysDictDataGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
Id int `form:"id" search:"type:exact;column:dict_code;table:sys_dict_data" comment:""`
|
||||
DictLabel string `form:"dictLabel" search:"type:contains;column:dict_label;table:sys_dict_data" comment:""`
|
||||
@@ -15,12 +15,17 @@ type SysDictDataSearch struct {
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_dict_data" comment:""`
|
||||
}
|
||||
|
||||
func (m *SysDictDataSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysDictDataGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type SysDictDataControl struct {
|
||||
Id int `uri:"dictCode" comment:""`
|
||||
type SysDictDataGetAllResp struct {
|
||||
DictLabel string `json:"label"`
|
||||
DictValue string `json:"value"`
|
||||
}
|
||||
|
||||
type SysDictDataInsertReq struct {
|
||||
Id int `json:"-" comment:""`
|
||||
DictSort int `json:"dictSort" comment:""`
|
||||
DictLabel string `json:"dictLabel" comment:""`
|
||||
DictValue string `json:"dictValue" comment:""`
|
||||
@@ -28,14 +33,13 @@ type SysDictDataControl struct {
|
||||
CssClass string `json:"cssClass" comment:""`
|
||||
ListClass string `json:"listClass" comment:""`
|
||||
IsDefault string `json:"isDefault" comment:""`
|
||||
Status int `json:"status" comment:""`
|
||||
Status int `json:"status" comment:""`
|
||||
Default string `json:"default" comment:""`
|
||||
Remark string `json:"remark" comment:""`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDictDataControl) Generate(model *models.SysDictData) {
|
||||
|
||||
func (s *SysDictDataInsertReq) Generate(model *models.SysDictData) {
|
||||
model.DictCode = s.Id
|
||||
model.DictSort = s.DictSort
|
||||
model.DictLabel = s.DictLabel
|
||||
@@ -49,24 +53,56 @@ func (s *SysDictDataControl) Generate(model *models.SysDictData) {
|
||||
model.Remark = s.Remark
|
||||
}
|
||||
|
||||
func (s *SysDictDataControl) GetId() interface{} {
|
||||
func (s *SysDictDataInsertReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysDictDataById struct {
|
||||
Id int `uri:"dictCode"`
|
||||
Ids []int `json:"ids"`
|
||||
type SysDictDataUpdateReq struct {
|
||||
Id int `uri:"dictCode" comment:""`
|
||||
DictSort int `json:"dictSort" comment:""`
|
||||
DictLabel string `json:"dictLabel" comment:""`
|
||||
DictValue string `json:"dictValue" comment:""`
|
||||
DictType string `json:"dictType" comment:""`
|
||||
CssClass string `json:"cssClass" comment:""`
|
||||
ListClass string `json:"listClass" comment:""`
|
||||
IsDefault string `json:"isDefault" comment:""`
|
||||
Status int `json:"status" comment:""`
|
||||
Default string `json:"default" comment:""`
|
||||
Remark string `json:"remark" comment:""`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDictDataUpdateReq) Generate(model *models.SysDictData) {
|
||||
model.DictCode = s.Id
|
||||
model.DictSort = s.DictSort
|
||||
model.DictLabel = s.DictLabel
|
||||
model.DictValue = s.DictValue
|
||||
model.DictType = s.DictType
|
||||
model.CssClass = s.CssClass
|
||||
model.ListClass = s.ListClass
|
||||
model.IsDefault = s.IsDefault
|
||||
model.Status = s.Status
|
||||
model.Default = s.Default
|
||||
model.Remark = s.Remark
|
||||
}
|
||||
|
||||
func (s *SysDictDataUpdateReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysDictDataGetReq struct {
|
||||
Id int `uri:"dictCode"`
|
||||
}
|
||||
|
||||
func (s *SysDictDataGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysDictDataDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
common.ControlBy `json:"-"`
|
||||
}
|
||||
|
||||
func (s *SysDictDataById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
}
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysDictData{}, nil
|
||||
func (s *SysDictDataDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysDictTypeSearch struct {
|
||||
type SysDictTypeGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
DictId []int `form:"dictId" search:"type:in;column:dict_id;table:sys_dict_type"`
|
||||
DictName string `form:"dictName" search:"type:icontains;column:dict_name;table:sys_dict_type"`
|
||||
@@ -19,11 +19,11 @@ type SysDictTypeOrder struct {
|
||||
DictIdOrder string `search:"type:order;column:dict_id;table:sys_dict_type" form:"dictIdOrder"`
|
||||
}
|
||||
|
||||
func (m *SysDictTypeSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysDictTypeGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type SysDictTypeControl struct {
|
||||
type SysDictTypeInsertReq struct {
|
||||
Id int `uri:"id"`
|
||||
DictName string `json:"dictName"`
|
||||
DictType string `json:"dictType"`
|
||||
@@ -32,7 +32,7 @@ type SysDictTypeControl struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDictTypeControl) Generate(model *models.SysDictType) {
|
||||
func (s *SysDictTypeInsertReq) Generate(model *models.SysDictType) {
|
||||
if s.Id != 0 {
|
||||
model.ID = s.Id
|
||||
}
|
||||
@@ -43,28 +43,47 @@ func (s *SysDictTypeControl) Generate(model *models.SysDictType) {
|
||||
|
||||
}
|
||||
|
||||
func (s *SysDictTypeControl) GetId() interface{} {
|
||||
func (s *SysDictTypeInsertReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysDictTypeById struct {
|
||||
dto.ObjectById
|
||||
type SysDictTypeUpdateReq struct {
|
||||
Id int `uri:"id"`
|
||||
DictName string `json:"dictName"`
|
||||
DictType string `json:"dictType"`
|
||||
Status int `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDictTypeById) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
func (s *SysDictTypeUpdateReq) Generate(model *models.SysDictType) {
|
||||
if s.Id != 0 {
|
||||
model.ID = s.Id
|
||||
}
|
||||
model.DictName = s.DictName
|
||||
model.DictType = s.DictType
|
||||
model.Status = s.Status
|
||||
model.Remark = s.Remark
|
||||
|
||||
}
|
||||
|
||||
func (s *SysDictTypeById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
}
|
||||
func (s *SysDictTypeUpdateReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysDictType{}, nil
|
||||
type SysDictTypeGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *SysDictTypeGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysDictTypeDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysDictTypeDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"time"
|
||||
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysLoginLogSearch struct {
|
||||
type SysLoginLogGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"`
|
||||
@@ -23,7 +21,7 @@ type SysLoginLogOrder struct {
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_login_log" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
func (m *SysLoginLogSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysLoginLogGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
@@ -41,26 +39,6 @@ type SysLoginLogControl struct {
|
||||
Msg string `json:"msg" comment:"信息"`
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) Generate() (*models.SysLoginLog, error) {
|
||||
return &models.SysLoginLog{
|
||||
Model: common.Model{Id: s.ID},
|
||||
Username: s.Username,
|
||||
Status: s.Status,
|
||||
Ipaddr: s.Ipaddr,
|
||||
LoginLocation: s.LoginLocation,
|
||||
Browser: s.Browser,
|
||||
Os: s.Os,
|
||||
Platform: s.Platform,
|
||||
LoginTime: s.LoginTime,
|
||||
Remark: s.Remark,
|
||||
Msg: s.Msg,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) GetId() interface{} {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
type SysLoginLogGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ import (
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
// SysMenuSearch 列表或者搜索使用结构体
|
||||
type SysMenuSearch struct {
|
||||
// SysMenuGetPageReq 列表或者搜索使用结构体
|
||||
type SysMenuGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
Title string `form:"title" search:"type:contains;column:title;table:sys_menu" comment:"菜单名称"` // 菜单名称
|
||||
Visible int `form:"visible" search:"type:exact;column:visible;table:sys_menu" comment:"显示状态"` // 显示状态
|
||||
}
|
||||
|
||||
func (m *SysMenuSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysMenuGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
// SysMenuControl 增、改使用的结构体
|
||||
type SysMenuControl struct {
|
||||
type SysMenuInsertReq struct {
|
||||
MenuId int `uri:"id" comment:"编码"` // 编码
|
||||
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
|
||||
Title string `form:"title" comment:"显示名称"` //显示名称
|
||||
@@ -41,16 +40,7 @@ type SysMenuControl struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysMenuControl) SetCreateBy(id int) {
|
||||
s.CreateBy = id
|
||||
}
|
||||
|
||||
func (s *SysMenuControl) SetUpdateBy(id int) {
|
||||
s.UpdateBy = id
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 Control 至 model 对应的模型
|
||||
func (s *SysMenuControl) Generate(model *models.SysMenu) {
|
||||
func (s *SysMenuInsertReq) Generate(model *models.SysMenu) {
|
||||
if s.MenuId != 0 {
|
||||
model.MenuId = s.MenuId
|
||||
}
|
||||
@@ -78,33 +68,79 @@ func (s *SysMenuControl) Generate(model *models.SysMenu) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetId 获取数据对应的ID
|
||||
func (s *SysMenuControl) GetId() interface{} {
|
||||
func (s *SysMenuInsertReq) GetId() interface{} {
|
||||
return s.MenuId
|
||||
}
|
||||
|
||||
// SysMenuById 获取单个或者删除的结构体
|
||||
type SysMenuById struct {
|
||||
Id int `uri:"id"`
|
||||
type SysMenuUpdateReq struct {
|
||||
MenuId int `uri:"id" comment:"编码"` // 编码
|
||||
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
|
||||
Title string `form:"title" comment:"显示名称"` //显示名称
|
||||
Icon string `form:"icon" comment:"图标"` //图标
|
||||
Path string `form:"path" comment:"路径"` //路径
|
||||
Paths string `form:"paths" comment:"id路径"` //id路径
|
||||
MenuType string `form:"menuType" comment:"菜单类型"` //菜单类型
|
||||
SysApi []models.SysApi `form:"sysApi"`
|
||||
Apis []int `form:"apis"`
|
||||
Action string `form:"action" comment:"请求方式"` //请求方式
|
||||
Permission string `form:"permission" comment:"权限编码"` //权限编码
|
||||
ParentId int `form:"parentId" comment:"上级菜单"` //上级菜单
|
||||
NoCache bool `form:"noCache" comment:"是否缓存"` //是否缓存
|
||||
Breadcrumb string `form:"breadcrumb" comment:"是否面包屑"` //是否面包屑
|
||||
Component string `form:"component" comment:"组件"` //组件
|
||||
Sort int `form:"sort" comment:"排序"` //排序
|
||||
Visible string `form:"visible" comment:"是否显示"` //是否显示
|
||||
IsFrame string `form:"isFrame" comment:"是否frame"` //是否frame
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysMenuUpdateReq) Generate(model *models.SysMenu) {
|
||||
if s.MenuId != 0 {
|
||||
model.MenuId = s.MenuId
|
||||
}
|
||||
model.MenuName = s.MenuName
|
||||
model.Title = s.Title
|
||||
model.Icon = s.Icon
|
||||
model.Path = s.Path
|
||||
model.Paths = s.Paths
|
||||
model.MenuType = s.MenuType
|
||||
model.Action = s.Action
|
||||
model.SysApi = s.SysApi
|
||||
model.Permission = s.Permission
|
||||
model.ParentId = s.ParentId
|
||||
model.NoCache = s.NoCache
|
||||
model.Breadcrumb = s.Breadcrumb
|
||||
model.Component = s.Component
|
||||
model.Sort = s.Sort
|
||||
model.Visible = s.Visible
|
||||
model.IsFrame = s.IsFrame
|
||||
if s.CreateBy != 0 {
|
||||
model.CreateBy = s.CreateBy
|
||||
}
|
||||
if s.UpdateBy != 0 {
|
||||
model.UpdateBy = s.UpdateBy
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SysMenuUpdateReq) GetId() interface{} {
|
||||
return s.MenuId
|
||||
}
|
||||
|
||||
type SysMenuGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *SysMenuGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
type SysMenuDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysMenuById) Generate() *SysMenuById {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysMenuById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
}
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysMenuById) GenerateM() (*models.SysMenu, error) {
|
||||
return &models.SysMenu{}, nil
|
||||
func (s *SysMenuDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
type MenuLabel struct {
|
||||
@@ -120,4 +156,4 @@ type MenuRole struct {
|
||||
|
||||
type SelectRole struct {
|
||||
RoleId int `uri:"roleId"`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import (
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
// SysRoleSearch 列表或者搜索使用结构体
|
||||
type SysRoleSearch struct {
|
||||
type SysRoleGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
|
||||
RoleId int `form:"roleId" search:"type:exact;column:role_id;table:sys_role" comment:"角色编码"` // 角色编码
|
||||
@@ -30,11 +29,11 @@ type SysRoleOrder struct {
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_role" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
func (m *SysRoleSearch) GetNeedSearch() interface{} {
|
||||
func (m *SysRoleGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type SysRoleControl struct {
|
||||
type SysRoleInsertReq struct {
|
||||
RoleId int `uri:"id" comment:"角色编码"` // 角色编码
|
||||
RoleName string `form:"roleName" comment:"角色名称"` // 角色名称
|
||||
Status string `form:"status" comment:"状态"` // 状态
|
||||
@@ -51,16 +50,7 @@ type SysRoleControl struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysRoleControl) SetCreateBy(id int) {
|
||||
s.CreateBy = id
|
||||
}
|
||||
|
||||
func (s *SysRoleControl) SetUpdateBy(id int) {
|
||||
s.UpdateBy = id
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化
|
||||
func (s *SysRoleControl) Generate(model *models.SysRole) {
|
||||
func (s *SysRoleInsertReq) Generate(model *models.SysRole) {
|
||||
if s.RoleId != 0 {
|
||||
model.RoleId = s.RoleId
|
||||
}
|
||||
@@ -74,11 +64,46 @@ func (s *SysRoleControl) Generate(model *models.SysRole) {
|
||||
model.DataScope = s.DataScope
|
||||
model.SysMenu = &s.SysMenu
|
||||
model.SysDept = s.SysDept
|
||||
|
||||
}
|
||||
|
||||
// GetId 获取数据对应的ID
|
||||
func (s *SysRoleControl) GetId() interface{} {
|
||||
func (s *SysRoleInsertReq) GetId() interface{} {
|
||||
return s.RoleId
|
||||
}
|
||||
|
||||
type SysRoleUpdateReq struct {
|
||||
RoleId int `uri:"id" comment:"角色编码"` // 角色编码
|
||||
RoleName string `form:"roleName" comment:"角色名称"` // 角色名称
|
||||
Status string `form:"status" comment:"状态"` // 状态
|
||||
RoleKey string `form:"roleKey" comment:"角色代码"` // 角色代码
|
||||
RoleSort int `form:"roleSort" comment:"角色排序"` // 角色排序
|
||||
Flag string `form:"flag" comment:"标记"` // 标记
|
||||
Remark string `form:"remark" comment:"备注"` // 备注
|
||||
Admin bool `form:"admin" comment:"是否管理员"`
|
||||
DataScope string `form:"dataScope"`
|
||||
SysMenu []models.SysMenu `form:"sysMenu"`
|
||||
MenuIds []int `form:"menuIds"`
|
||||
SysDept []models.SysDept `form:"sysDept"`
|
||||
DeptIds []int `form:"deptIds"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *SysRoleUpdateReq) Generate(model *models.SysRole) {
|
||||
if s.RoleId != 0 {
|
||||
model.RoleId = s.RoleId
|
||||
}
|
||||
model.RoleName = s.RoleName
|
||||
model.Status = s.Status
|
||||
model.RoleKey = s.RoleKey
|
||||
model.RoleSort = s.RoleSort
|
||||
model.Flag = s.Flag
|
||||
model.Remark = s.Remark
|
||||
model.Admin = s.Admin
|
||||
model.DataScope = s.DataScope
|
||||
model.SysMenu = &s.SysMenu
|
||||
model.SysDept = s.SysDept
|
||||
}
|
||||
|
||||
func (s *SysRoleUpdateReq) GetId() interface{} {
|
||||
return s.RoleId
|
||||
}
|
||||
|
||||
@@ -103,26 +128,20 @@ type SysRoleByName struct {
|
||||
RoleName string `form:"role"` // 角色编码
|
||||
}
|
||||
|
||||
// SysRoleById 获取单个或者删除的结构体
|
||||
type SysRoleById struct {
|
||||
dto.ObjectById
|
||||
type SysRoleGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *SysRoleById) Generate() *SysRoleById {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysRoleById) GetId() interface{} {
|
||||
if len(s.Ids) > 0 {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
return s.Ids
|
||||
}
|
||||
func (s *SysRoleGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysRoleById) GenerateM() (*models.SysRole, error) {
|
||||
return &models.SysRole{}, nil
|
||||
type SysRoleDeleteReq struct {
|
||||
Ids []int `json:"ids"`
|
||||
}
|
||||
|
||||
func (s *SysRoleDeleteReq) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
|
||||
// RoleDataScopeReq 角色数据权限修改
|
||||
@@ -142,4 +161,4 @@ func (s *RoleDataScopeReq) Generate(model *models.SysRole) {
|
||||
|
||||
type DeptIdList struct {
|
||||
DeptId int `json:"DeptId"`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user