mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
feat✨ apis路径简化
This commit is contained in:
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -68,8 +68,8 @@ func (s *SysConfigControl) Bind(ctx *gin.Context) error {
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
|
||||
func (s *SysConfigControl) Generate() (*system.SysConfig, error) {
|
||||
return &system.SysConfig{
|
||||
func (s *SysConfigControl) Generate() (*models.SysConfig, error) {
|
||||
return &models.SysConfig{
|
||||
Model: common.Model{Id: s.ID},
|
||||
ConfigName: s.ConfigName,
|
||||
ConfigKey: s.ConfigKey,
|
||||
@@ -114,6 +114,6 @@ func (s *SysConfigById) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysConfigById) GenerateM() (*system.SysConfig, error) {
|
||||
return &system.SysConfig{}, nil
|
||||
}
|
||||
func (s *SysConfigById) GenerateM() (*models.SysConfig, error) {
|
||||
return &models.SysConfig{}, nil
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
@@ -74,8 +74,8 @@ func (s *SysDeptControl) Bind(ctx *gin.Context) error {
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
|
||||
func (s *SysDeptControl) Generate() (*system.SysDept, error) {
|
||||
return &system.SysDept{
|
||||
func (s *SysDeptControl) Generate() (*models.SysDept, error) {
|
||||
return &models.SysDept{
|
||||
DeptId: s.DeptId,
|
||||
DeptName: s.DeptName,
|
||||
ParentId: s.ParentId,
|
||||
@@ -122,12 +122,12 @@ func (s *SysDeptById) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysDeptById) GenerateM() (*system.SysDept, error) {
|
||||
return &system.SysDept{}, nil
|
||||
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
|
||||
return &models.SysDept{}, nil
|
||||
}
|
||||
|
||||
type DeptLabel struct {
|
||||
Id int `gorm:"-" json:"id"`
|
||||
Label string `gorm:"-" json:"label"`
|
||||
Children []DeptLabel `gorm:"-" json:"children"`
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -72,7 +72,7 @@ func (s *SysDictDataControl) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysDictDataControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysDictData{
|
||||
return &models.SysDictData{
|
||||
DictCode: s.Id,
|
||||
DictSort: s.DictSort,
|
||||
DictLabel: s.DictLabel,
|
||||
@@ -122,5 +122,5 @@ func (s *SysDictDataById) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysDictData{}, nil
|
||||
}
|
||||
return &models.SysDictData{}, nil
|
||||
}
|
||||
@@ -2,9 +2,9 @@ package dto
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -67,7 +67,7 @@ func (s *SysDictTypeControl) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysDictTypeControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysDictType{
|
||||
return &models.SysDictType{
|
||||
|
||||
ID: s.Id,
|
||||
DictName: s.DictName,
|
||||
@@ -91,5 +91,5 @@ func (s *SysDictTypeById) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysDictType{}, nil
|
||||
}
|
||||
return &models.SysDictType{}, nil
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -60,8 +60,8 @@ func (s *SysLoginLogControl) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) Generate() (*system.SysLoginLog, error) {
|
||||
return &system.SysLoginLog{
|
||||
func (s *SysLoginLogControl) Generate() (*models.SysLoginLog, error) {
|
||||
return &models.SysLoginLog{
|
||||
Model: common.Model{Id: s.ID},
|
||||
Username: s.Username,
|
||||
Status: s.Status,
|
||||
@@ -108,6 +108,6 @@ func (s *SysLoginLogById) Generate() *SysLoginLogById {
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysLoginLogById) GenerateM() (*system.SysLoginLog, error) {
|
||||
return &system.SysLoginLog{}, nil
|
||||
}
|
||||
func (s *SysLoginLogById) GenerateM() (*models.SysLoginLog, error) {
|
||||
return &models.SysLoginLog{}, nil
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
@@ -38,24 +38,26 @@ func (m *SysMenuSearch) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// SysConfigControl 增、改使用的结构体
|
||||
// SysMenuControl 增、改使用的结构体
|
||||
type SysMenuControl 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:"菜单类型"` //菜单类型
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
// Bind 映射上下文中的结构体数据
|
||||
@@ -79,9 +81,9 @@ func (s *SysMenuControl) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
|
||||
func (s *SysMenuControl) Generate() (*system.SysMenu, error) {
|
||||
return &system.SysMenu{
|
||||
// Generate 结构体数据转化 从 Control 至 model 对应的模型
|
||||
func (s *SysMenuControl) Generate() (*models.SysMenu, error) {
|
||||
return &models.SysMenu{
|
||||
MenuId: s.MenuId,
|
||||
MenuName: s.MenuName,
|
||||
Title: s.Title,
|
||||
@@ -90,6 +92,7 @@ func (s *SysMenuControl) Generate() (*system.SysMenu, error) {
|
||||
Paths: s.Paths,
|
||||
MenuType: s.MenuType,
|
||||
Action: s.Action,
|
||||
SysApi: s.SysApi,
|
||||
Permission: s.Permission,
|
||||
ParentId: s.ParentId,
|
||||
NoCache: s.NoCache,
|
||||
@@ -135,8 +138,8 @@ func (s *SysMenuById) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysMenuById) GenerateM() (*system.SysMenu, error) {
|
||||
return &system.SysMenu{}, nil
|
||||
func (s *SysMenuById) GenerateM() (*models.SysMenu, error) {
|
||||
return &models.SysMenu{}, nil
|
||||
}
|
||||
|
||||
type MenuLabel struct {
|
||||
@@ -146,10 +149,10 @@ type MenuLabel struct {
|
||||
}
|
||||
|
||||
type MenuRole struct {
|
||||
system.SysMenus
|
||||
models.SysMenu
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
}
|
||||
|
||||
type SelectRole struct {
|
||||
RoleId int `uri:"roleId"`
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -70,8 +70,8 @@ func (s *SysOperaLogControl) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysOperaLogControl) Generate() (*system.SysOperaLog, error) {
|
||||
return &system.SysOperaLog{
|
||||
func (s *SysOperaLogControl) Generate() (*models.SysOperaLog, error) {
|
||||
return &models.SysOperaLog{
|
||||
Model: common.Model{Id: s.ID},
|
||||
Title: s.Title,
|
||||
BusinessType: s.BusinessType,
|
||||
@@ -127,4 +127,4 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysOperaLogById) SetUpdateBy(id int) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
@@ -68,8 +68,8 @@ func (s *SysPostControl) Bind(ctx *gin.Context) error {
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
|
||||
func (s *SysPostControl) Generate() (*system.SysPost, error) {
|
||||
return &system.SysPost{
|
||||
func (s *SysPostControl) Generate() (*models.SysPost, error) {
|
||||
return &models.SysPost{
|
||||
PostId: s.PostId,
|
||||
PostName: s.PostName,
|
||||
PostCode: s.PostCode,
|
||||
@@ -113,6 +113,6 @@ func (s *SysPostById) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysPostById) GenerateM() (*system.SysPost, error) {
|
||||
return &system.SysPost{}, nil
|
||||
}
|
||||
func (s *SysPostById) GenerateM() (*models.SysPost, error) {
|
||||
return &models.SysPost{}, nil
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
)
|
||||
|
||||
@@ -76,8 +76,8 @@ func (s *SysRoleControl) Bind(ctx *gin.Context) error {
|
||||
}
|
||||
|
||||
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
|
||||
func (s *SysRoleControl) Generate() (*system.SysRole, error) {
|
||||
return &system.SysRole{
|
||||
func (s *SysRoleControl) Generate() (*models.SysRole, error) {
|
||||
return &models.SysRole{
|
||||
RoleId: s.RoleId,
|
||||
RoleName: s.RoleName,
|
||||
Status: s.Status,
|
||||
@@ -110,8 +110,8 @@ func (s *SysRoleById) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
func (s *SysRoleById) GenerateM() (*system.SysRole, error) {
|
||||
return &system.SysRole{}, nil
|
||||
func (s *SysRoleById) GenerateM() (*models.SysRole, error) {
|
||||
return &models.SysRole{}, nil
|
||||
}
|
||||
|
||||
// RoleDataScopeReq 角色数据权限修改
|
||||
|
||||
@@ -3,8 +3,8 @@ package dto
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -77,7 +77,7 @@ func (s *SysUserControl) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysUserControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysUser{
|
||||
return &models.SysUser{
|
||||
UserId: s.UserId,
|
||||
Username: s.Username,
|
||||
Password: s.Password,
|
||||
@@ -108,11 +108,11 @@ func (s *SysUserById) Generate() dto.Control {
|
||||
}
|
||||
|
||||
func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysUser{}, nil
|
||||
return &models.SysUser{}, nil
|
||||
}
|
||||
|
||||
// PassWord 密码
|
||||
type PassWord struct {
|
||||
NewPassword string `json:"newPassword" binding:"required"`
|
||||
OldPassword string `json:"oldPassword" binding:"required"`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user