yxh пре 4 година
родитељ
комит
abc5c41952
35 измењених фајлова са 803 додато и 29 уклоњено
  1. 35 0
      api/v1/system/sys_auth_rule.go
  2. 27 0
      api/v1/system/sys_dict_data.go
  3. 0 0
      api/v1/system/sys_user.go
  4. 8 0
      internal/app/common/consts/cache.go
  5. 24 0
      internal/app/common/model/entity/sys_config.go
  6. 28 0
      internal/app/common/model/entity/sys_dict_data.go
  7. 23 0
      internal/app/common/model/entity/sys_dict_type.go
  8. 8 0
      internal/app/common/model/sys_config.go
  9. 21 0
      internal/app/common/model/sys_dict_data.go
  10. 8 0
      internal/app/common/model/sys_dict_type.go
  11. 92 0
      internal/app/common/service/internal/dao/internal/sys_config.go
  12. 100 0
      internal/app/common/service/internal/dao/internal/sys_dict_data.go
  13. 90 0
      internal/app/common/service/internal/dao/internal/sys_dict_type.go
  14. 24 0
      internal/app/common/service/internal/dao/sys_config.go
  15. 24 0
      internal/app/common/service/internal/dao/sys_dict_data.go
  16. 24 0
      internal/app/common/service/internal/dao/sys_dict_type.go
  17. 26 0
      internal/app/common/service/internal/do/sys_config.go
  18. 30 0
      internal/app/common/service/internal/do/sys_dict_data.go
  19. 25 0
      internal/app/common/service/internal/do/sys_dict_type.go
  20. 8 0
      internal/app/common/service/sys_config.go
  21. 76 0
      internal/app/common/service/sys_dict_data.go
  22. 8 0
      internal/app/common/service/sys_dict_type.go
  23. 1 6
      internal/app/system/consts/cache.go
  24. 2 2
      internal/app/system/controller/base.go
  25. 0 8
      internal/app/system/controller/menu.go
  26. 24 0
      internal/app/system/controller/sys_auth_rule.go
  27. 25 0
      internal/app/system/controller/sys_dict_data.go
  28. 8 0
      internal/app/system/controller/sys_dict_type.go
  29. 5 5
      internal/app/system/controller/sys_user.go
  30. 4 2
      internal/app/system/model/entity/sys_auth_rule.go
  31. 2 0
      internal/app/system/router/router.go
  32. 7 3
      internal/app/system/service/internal/dao/internal/sys_auth_rule.go
  33. 4 2
      internal/app/system/service/internal/do/sys_auth_rule.go
  34. 11 0
      internal/app/system/service/sys_auth_rule.go
  35. 1 1
      manifest/config/config.yaml

+ 35 - 0
api/v1/system/sys_auth_rule.go

@@ -0,0 +1,35 @@
+/*
+* @desc:菜单api
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 10:27
+ */
+
+package system
+
+import "github.com/gogf/gf/v2/frame/g"
+
+type RuleAddReq struct {
+	g.Meta        `path:"/menu/add" tags:"menu add" method:"post" summary:"添加菜单"`
+	Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
+	MenuType      uint   `p:"menuType"  v:"min:0|max:2#菜单类型最小值为:min|菜单类型最大值为:max"`
+	Pid           uint   `p:"parentId"  v:"min:0"`
+	Name          string `p:"name" v:"required#请填写规则名称"`
+	Title         string `p:"menuName" v:"required|length:1,100#请填写标题|标题长度在:min到:max位"`
+	Icon          string `p:"icon"`
+	Weigh         int    `p:"orderNum" `
+	Condition     string `p:"condition" `
+	Remark        string `p:"remark" `
+	Status        uint   `p:"status" `
+	AlwaysShow    uint   `p:"visible"`
+	Path          string `p:"path"`
+	Component     string `p:"component" v:"required-if:menuType,1#组件路径不能为空"`
+	IsLink        uint   `p:"isLink"`
+	IsIframe      uint   `p:"isIframe"`
+	IsCached      uint   `p:"isCached"`
+	ModuleType    string `p:"moduleType"`
+	ModelId       uint   `p:"modelId"`
+}
+
+type RuleAddRes struct {
+}

+ 27 - 0
api/v1/system/sys_dict_data.go

@@ -0,0 +1,27 @@
+/*
+* @desc:字典数据api
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:59
+ */
+
+package system
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+	commonModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
+)
+
+// GetDictReq 获取字典信息请求参数
+type GetDictReq struct {
+	g.Meta       `path:"/dict/data/getDictData" tags:"get dict data" method:"get" summary:"获取字典数据公共方法"`
+	DictType     string `p:"dictType" v:"required#字典类型不能为空"`
+	DefaultValue string `p:"defaultValue"`
+}
+
+// GetDictRes 完整的一个字典信息
+type GetDictRes struct {
+	g.Meta `mime:"application/json" example:""`
+	Info   *commonModel.DictTypeRes   `json:"info"`
+	Values []*commonModel.DictDataRes `json:"values"`
+}

+ 0 - 0
api/v1/system/user.go → api/v1/system/sys_user.go


+ 8 - 0
internal/app/common/consts/cache.go

@@ -10,4 +10,12 @@ package consts
 const (
 	CacheModelMem   = "memory"
 	CacheModelRedis = "redis"
+
+	// CacheSysDict 字典缓存菜单KEY
+	CacheSysDict = "sysDict"
+
+	// CacheSysDictTag 字典缓存标签
+	CacheSysDictTag = "sysDictTag"
+	// CacheSysConfigTag 系统参数配置
+	CacheSysConfigTag = "sysConfigTag"
 )

+ 24 - 0
internal/app/common/model/entity/sys_config.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package entity
+
+import (
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysConfig is the golang structure for table sys_config.
+type SysConfig struct {
+	ConfigId    uint        `json:"configId"    description:"参数主键"`
+	ConfigName  string      `json:"configName"  description:"参数名称"`
+	ConfigKey   string      `json:"configKey"   description:"参数键名"`
+	ConfigValue string      `json:"configValue" description:"参数键值"`
+	ConfigType  int         `json:"configType"  description:"系统内置(Y是 N否)"`
+	CreateBy    uint        `json:"createBy"    description:"创建者"`
+	UpdateBy    uint        `json:"updateBy"    description:"更新者"`
+	Remark      string      `json:"remark"      description:"备注"`
+	CreatedAt   *gtime.Time `json:"createdAt"   description:"创建时间"`
+	UpdatedAt   *gtime.Time `json:"updatedAt"   description:"修改时间"`
+	DeletedAt   *gtime.Time `json:"deletedAt"   description:"删除时间"`
+}

+ 28 - 0
internal/app/common/model/entity/sys_dict_data.go

@@ -0,0 +1,28 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package entity
+
+import (
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysDictData is the golang structure for table sys_dict_data.
+type SysDictData struct {
+	DictCode  int64       `json:"dictCode"  description:"字典编码"`
+	DictSort  int         `json:"dictSort"  description:"字典排序"`
+	DictLabel string      `json:"dictLabel" description:"字典标签"`
+	DictValue string      `json:"dictValue" description:"字典键值"`
+	DictType  string      `json:"dictType"  description:"字典类型"`
+	CssClass  string      `json:"cssClass"  description:"样式属性(其他样式扩展)"`
+	ListClass string      `json:"listClass" description:"表格回显样式"`
+	IsDefault int         `json:"isDefault" description:"是否默认(1是 0否)"`
+	Status    int         `json:"status"    description:"状态(0正常 1停用)"`
+	CreateBy  uint64      `json:"createBy"  description:"创建者"`
+	UpdateBy  uint64      `json:"updateBy"  description:"更新者"`
+	Remark    string      `json:"remark"    description:"备注"`
+	CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
+	UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
+	DeletedAt *gtime.Time `json:"deletedAt" description:"删除时间"`
+}

+ 23 - 0
internal/app/common/model/entity/sys_dict_type.go

@@ -0,0 +1,23 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package entity
+
+import (
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysDictType is the golang structure for table sys_dict_type.
+type SysDictType struct {
+	DictId    uint64      `json:"dictId"    description:"字典主键"`
+	DictName  string      `json:"dictName"  description:"字典名称"`
+	DictType  string      `json:"dictType"  description:"字典类型"`
+	Status    uint        `json:"status"    description:"状态(0正常 1停用)"`
+	CreateBy  uint        `json:"createBy"  description:"创建者"`
+	UpdateBy  uint        `json:"updateBy"  description:"更新者"`
+	Remark    string      `json:"remark"    description:"备注"`
+	CreatedAt *gtime.Time `json:"createdAt" description:"创建日期"`
+	UpdatedAt *gtime.Time `json:"updatedAt" description:"修改日期"`
+	DeletedAt *gtime.Time `json:"deletedAt" description:"删除日期"`
+}

+ 8 - 0
internal/app/common/model/sys_config.go

@@ -0,0 +1,8 @@
+/*
+* @desc:xxxx功能描述
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:56
+ */
+
+package model

+ 21 - 0
internal/app/common/model/sys_dict_data.go

@@ -0,0 +1,21 @@
+/*
+* @desc:字典数据
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:56
+ */
+
+package model
+
+type DictTypeRes struct {
+	DictName string `json:"name"`
+	Remark   string `json:"remark"`
+}
+
+// DictDataRes 字典数据
+type DictDataRes struct {
+	DictValue string `json:"key"`
+	DictLabel string `json:"value"`
+	IsDefault int    `json:"isDefault"`
+	Remark    string `json:"remark"`
+}

+ 8 - 0
internal/app/common/model/sys_dict_type.go

@@ -0,0 +1,8 @@
+/*
+* @desc:xxxx功能描述
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:56
+ */
+
+package model

+ 92 - 0
internal/app/common/service/internal/dao/internal/sys_config.go

@@ -0,0 +1,92 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/v2/database/gdb"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+// SysConfigDao is the data access object for table sys_config.
+type SysConfigDao struct {
+	table   string           // table is the underlying table name of the DAO.
+	group   string           // group is the database configuration group name of current DAO.
+	columns SysConfigColumns // columns contains all the column names of Table for convenient usage.
+}
+
+// SysConfigColumns defines and stores column names for table sys_config.
+type SysConfigColumns struct {
+	ConfigId    string // 参数主键
+	ConfigName  string // 参数名称
+	ConfigKey   string // 参数键名
+	ConfigValue string // 参数键值
+	ConfigType  string // 系统内置(Y是 N否)
+	CreateBy    string // 创建者
+	UpdateBy    string // 更新者
+	Remark      string // 备注
+	CreatedAt   string // 创建时间
+	UpdatedAt   string // 修改时间
+	DeletedAt   string // 删除时间
+}
+
+//  sysConfigColumns holds the columns for table sys_config.
+var sysConfigColumns = SysConfigColumns{
+	ConfigId:    "config_id",
+	ConfigName:  "config_name",
+	ConfigKey:   "config_key",
+	ConfigValue: "config_value",
+	ConfigType:  "config_type",
+	CreateBy:    "create_by",
+	UpdateBy:    "update_by",
+	Remark:      "remark",
+	CreatedAt:   "created_at",
+	UpdatedAt:   "updated_at",
+	DeletedAt:   "deleted_at",
+}
+
+// NewSysConfigDao creates and returns a new DAO object for table data access.
+func NewSysConfigDao() *SysConfigDao {
+	return &SysConfigDao{
+		group:   "default",
+		table:   "sys_config",
+		columns: sysConfigColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *SysConfigDao) DB() gdb.DB {
+	return g.DB(dao.group)
+}
+
+// Table returns the table name of current dao.
+func (dao *SysConfigDao) Table() string {
+	return dao.table
+}
+
+// Columns returns all column names of current dao.
+func (dao *SysConfigDao) Columns() SysConfigColumns {
+	return dao.columns
+}
+
+// Group returns the configuration group name of database of current dao.
+func (dao *SysConfigDao) Group() string {
+	return dao.group
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 100 - 0
internal/app/common/service/internal/dao/internal/sys_dict_data.go

@@ -0,0 +1,100 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/v2/database/gdb"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+// SysDictDataDao is the data access object for table sys_dict_data.
+type SysDictDataDao struct {
+	table   string             // table is the underlying table name of the DAO.
+	group   string             // group is the database configuration group name of current DAO.
+	columns SysDictDataColumns // columns contains all the column names of Table for convenient usage.
+}
+
+// SysDictDataColumns defines and stores column names for table sys_dict_data.
+type SysDictDataColumns struct {
+	DictCode  string // 字典编码
+	DictSort  string // 字典排序
+	DictLabel string // 字典标签
+	DictValue string // 字典键值
+	DictType  string // 字典类型
+	CssClass  string // 样式属性(其他样式扩展)
+	ListClass string // 表格回显样式
+	IsDefault string // 是否默认(1是 0否)
+	Status    string // 状态(0正常 1停用)
+	CreateBy  string // 创建者
+	UpdateBy  string // 更新者
+	Remark    string // 备注
+	CreatedAt string // 创建时间
+	UpdatedAt string // 修改时间
+	DeletedAt string // 删除时间
+}
+
+//  sysDictDataColumns holds the columns for table sys_dict_data.
+var sysDictDataColumns = SysDictDataColumns{
+	DictCode:  "dict_code",
+	DictSort:  "dict_sort",
+	DictLabel: "dict_label",
+	DictValue: "dict_value",
+	DictType:  "dict_type",
+	CssClass:  "css_class",
+	ListClass: "list_class",
+	IsDefault: "is_default",
+	Status:    "status",
+	CreateBy:  "create_by",
+	UpdateBy:  "update_by",
+	Remark:    "remark",
+	CreatedAt: "created_at",
+	UpdatedAt: "updated_at",
+	DeletedAt: "deleted_at",
+}
+
+// NewSysDictDataDao creates and returns a new DAO object for table data access.
+func NewSysDictDataDao() *SysDictDataDao {
+	return &SysDictDataDao{
+		group:   "default",
+		table:   "sys_dict_data",
+		columns: sysDictDataColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *SysDictDataDao) DB() gdb.DB {
+	return g.DB(dao.group)
+}
+
+// Table returns the table name of current dao.
+func (dao *SysDictDataDao) Table() string {
+	return dao.table
+}
+
+// Columns returns all column names of current dao.
+func (dao *SysDictDataDao) Columns() SysDictDataColumns {
+	return dao.columns
+}
+
+// Group returns the configuration group name of database of current dao.
+func (dao *SysDictDataDao) Group() string {
+	return dao.group
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *SysDictDataDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *SysDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 90 - 0
internal/app/common/service/internal/dao/internal/sys_dict_type.go

@@ -0,0 +1,90 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"github.com/gogf/gf/v2/database/gdb"
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+// SysDictTypeDao is the data access object for table sys_dict_type.
+type SysDictTypeDao struct {
+	table   string             // table is the underlying table name of the DAO.
+	group   string             // group is the database configuration group name of current DAO.
+	columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage.
+}
+
+// SysDictTypeColumns defines and stores column names for table sys_dict_type.
+type SysDictTypeColumns struct {
+	DictId    string // 字典主键
+	DictName  string // 字典名称
+	DictType  string // 字典类型
+	Status    string // 状态(0正常 1停用)
+	CreateBy  string // 创建者
+	UpdateBy  string // 更新者
+	Remark    string // 备注
+	CreatedAt string // 创建日期
+	UpdatedAt string // 修改日期
+	DeletedAt string // 删除日期
+}
+
+//  sysDictTypeColumns holds the columns for table sys_dict_type.
+var sysDictTypeColumns = SysDictTypeColumns{
+	DictId:    "dict_id",
+	DictName:  "dict_name",
+	DictType:  "dict_type",
+	Status:    "status",
+	CreateBy:  "create_by",
+	UpdateBy:  "update_by",
+	Remark:    "remark",
+	CreatedAt: "created_at",
+	UpdatedAt: "updated_at",
+	DeletedAt: "deleted_at",
+}
+
+// NewSysDictTypeDao creates and returns a new DAO object for table data access.
+func NewSysDictTypeDao() *SysDictTypeDao {
+	return &SysDictTypeDao{
+		group:   "default",
+		table:   "sys_dict_type",
+		columns: sysDictTypeColumns,
+	}
+}
+
+// DB retrieves and returns the underlying raw database management object of current DAO.
+func (dao *SysDictTypeDao) DB() gdb.DB {
+	return g.DB(dao.group)
+}
+
+// Table returns the table name of current dao.
+func (dao *SysDictTypeDao) Table() string {
+	return dao.table
+}
+
+// Columns returns all column names of current dao.
+func (dao *SysDictTypeDao) Columns() SysDictTypeColumns {
+	return dao.columns
+}
+
+// Group returns the configuration group name of database of current dao.
+func (dao *SysDictTypeDao) Group() string {
+	return dao.group
+}
+
+// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
+func (dao *SysDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
+	return dao.DB().Model(dao.table).Safe().Ctx(ctx)
+}
+
+// Transaction wraps the transaction logic using function f.
+// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
+// It commits the transaction and returns nil if function f returns nil.
+//
+// Note that, you should not Commit or Rollback the transaction in function f
+// as it is automatically handled by this function.
+func (dao *SysDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
+	return dao.Ctx(ctx).Transaction(ctx, f)
+}

+ 24 - 0
internal/app/common/service/internal/dao/sys_config.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"github.com/tiger1103/gfast/v3/internal/app/common/service/internal/dao/internal"
+)
+
+// sysConfigDao is the data access object for table sys_config.
+// You can define custom methods on it to extend its functionality as you wish.
+type sysConfigDao struct {
+	*internal.SysConfigDao
+}
+
+var (
+	// SysConfig is globally public accessible object for table sys_config operations.
+	SysConfig = sysConfigDao{
+		internal.NewSysConfigDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
internal/app/common/service/internal/dao/sys_dict_data.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"github.com/tiger1103/gfast/v3/internal/app/common/service/internal/dao/internal"
+)
+
+// sysDictDataDao is the data access object for table sys_dict_data.
+// You can define custom methods on it to extend its functionality as you wish.
+type sysDictDataDao struct {
+	*internal.SysDictDataDao
+}
+
+var (
+	// SysDictData is globally public accessible object for table sys_dict_data operations.
+	SysDictData = sysDictDataDao{
+		internal.NewSysDictDataDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 24 - 0
internal/app/common/service/internal/dao/sys_dict_type.go

@@ -0,0 +1,24 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"github.com/tiger1103/gfast/v3/internal/app/common/service/internal/dao/internal"
+)
+
+// sysDictTypeDao is the data access object for table sys_dict_type.
+// You can define custom methods on it to extend its functionality as you wish.
+type sysDictTypeDao struct {
+	*internal.SysDictTypeDao
+}
+
+var (
+	// SysDictType is globally public accessible object for table sys_dict_type operations.
+	SysDictType = sysDictTypeDao{
+		internal.NewSysDictTypeDao(),
+	}
+)
+
+// Fill with you ideas below.

+ 26 - 0
internal/app/common/service/internal/do/sys_config.go

@@ -0,0 +1,26 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package do
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysConfig is the golang structure of table sys_config for DAO operations like Where/Data.
+type SysConfig struct {
+	g.Meta      `orm:"table:sys_config, do:true"`
+	ConfigId    interface{} // 参数主键
+	ConfigName  interface{} // 参数名称
+	ConfigKey   interface{} // 参数键名
+	ConfigValue interface{} // 参数键值
+	ConfigType  interface{} // 系统内置(Y是 N否)
+	CreateBy    interface{} // 创建者
+	UpdateBy    interface{} // 更新者
+	Remark      interface{} // 备注
+	CreatedAt   *gtime.Time // 创建时间
+	UpdatedAt   *gtime.Time // 修改时间
+	DeletedAt   *gtime.Time // 删除时间
+}

+ 30 - 0
internal/app/common/service/internal/do/sys_dict_data.go

@@ -0,0 +1,30 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package do
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysDictData is the golang structure of table sys_dict_data for DAO operations like Where/Data.
+type SysDictData struct {
+	g.Meta    `orm:"table:sys_dict_data, do:true"`
+	DictCode  interface{} // 字典编码
+	DictSort  interface{} // 字典排序
+	DictLabel interface{} // 字典标签
+	DictValue interface{} // 字典键值
+	DictType  interface{} // 字典类型
+	CssClass  interface{} // 样式属性(其他样式扩展)
+	ListClass interface{} // 表格回显样式
+	IsDefault interface{} // 是否默认(1是 0否)
+	Status    interface{} // 状态(0正常 1停用)
+	CreateBy  interface{} // 创建者
+	UpdateBy  interface{} // 更新者
+	Remark    interface{} // 备注
+	CreatedAt *gtime.Time // 创建时间
+	UpdatedAt *gtime.Time // 修改时间
+	DeletedAt *gtime.Time // 删除时间
+}

+ 25 - 0
internal/app/common/service/internal/do/sys_dict_type.go

@@ -0,0 +1,25 @@
+// =================================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// =================================================================================
+
+package do
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gtime"
+)
+
+// SysDictType is the golang structure of table sys_dict_type for DAO operations like Where/Data.
+type SysDictType struct {
+	g.Meta    `orm:"table:sys_dict_type, do:true"`
+	DictId    interface{} // 字典主键
+	DictName  interface{} // 字典名称
+	DictType  interface{} // 字典类型
+	Status    interface{} // 状态(0正常 1停用)
+	CreateBy  interface{} // 创建者
+	UpdateBy  interface{} // 更新者
+	Remark    interface{} // 备注
+	CreatedAt *gtime.Time // 创建日期
+	UpdatedAt *gtime.Time // 修改日期
+	DeletedAt *gtime.Time // 删除日期
+}

+ 8 - 0
internal/app/common/service/sys_config.go

@@ -0,0 +1,8 @@
+/*
+* @desc:xxxx功能描述
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:55
+ */
+
+package service

+ 76 - 0
internal/app/common/service/sys_dict_data.go

@@ -0,0 +1,76 @@
+/*
+* @desc:字典数据
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:55
+ */
+
+package service
+
+import (
+	"context"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/text/gstr"
+	"github.com/gogf/gf/v2/util/gconv"
+	"github.com/tiger1103/gfast/v3/api/v1/system"
+	commonConsts "github.com/tiger1103/gfast/v3/internal/app/common/consts"
+	commonModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
+	commonDao "github.com/tiger1103/gfast/v3/internal/app/common/service/internal/dao"
+	"github.com/tiger1103/gfast/v3/library/liberr"
+)
+
+type IDictData interface {
+	GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes, err error)
+}
+
+type dictDataImpl struct {
+}
+
+var dictData = dictDataImpl{}
+
+func DictData() IDictData {
+	return IDictData(&dictData)
+}
+
+// GetDictWithDataByType 通过字典键类型获取选项
+func (s dictDataImpl) GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes,
+	err error) {
+	cache := Cache(ctx)
+	cacheKey := commonConsts.CacheSysDict + "_" + req.DictType
+	//从缓存获取
+	iDict := cache.GetOrSetFuncLock(ctx, cacheKey, func(ctx context.Context) (value interface{}, err error) {
+		err = g.Try(func() {
+			//从数据库获取
+			dict = &system.GetDictRes{}
+			//获取类型数据
+			err = commonDao.SysDictType.Ctx(ctx).Where(commonDao.SysDictType.Columns().DictType, req.DictType).
+				Where(commonDao.SysDictType.Columns().Status, 1).Fields(commonModel.DictTypeRes{}).Scan(&dict.Info)
+			liberr.ErrIsNil(ctx, err, "获取字典类型失败")
+			err = commonDao.SysDictData.Ctx(ctx).Fields(commonModel.DictDataRes{}).
+				Where(commonDao.SysDictData.Columns().DictType, req.DictType).
+				Order(commonDao.SysDictData.Columns().DictSort + " asc," +
+					commonDao.SysDictData.Columns().DictCode + " asc").
+				Scan(&dict.Values)
+			liberr.ErrIsNil(ctx, err, "获取字典数据失败")
+		})
+		value = dict
+		return
+	}, 0, commonConsts.CacheSysDictTag)
+	if iDict != nil {
+		err = gconv.Struct(iDict, &dict)
+		if err != nil {
+			return
+		}
+	}
+	//设置给定的默认值
+	for _, v := range dict.Values {
+		if req.DefaultValue != "" {
+			if gstr.Equal(req.DefaultValue, v.DictValue) {
+				v.IsDefault = 1
+			} else {
+				v.IsDefault = 0
+			}
+		}
+	}
+	return
+}

+ 8 - 0
internal/app/common/service/sys_dict_type.go

@@ -0,0 +1,8 @@
+/*
+* @desc:xxxx功能描述
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:55
+ */
+
+package service

+ 1 - 6
internal/app/system/consts/cache.go

@@ -10,8 +10,7 @@ package consts
 const (
 	// CacheSysAuthMenu 缓存菜单KEY
 	CacheSysAuthMenu = "sysAuthMenu"
-	// CacheSysDict 字典缓存菜单KEY
-	CacheSysDict = "sysDict"
+
 	// CacheSysRole 角色缓存key
 	CacheSysRole = "sysRole"
 	// CacheSysWebSet 站点配置缓存key
@@ -21,10 +20,6 @@ const (
 
 	// CacheSysAuthTag 权限缓存TAG标签
 	CacheSysAuthTag = "sysAuthTag"
-	// CacheSysDictTag 字典缓存标签
-	CacheSysDictTag = "sysDictTag"
-	// CacheSysConfigTag 系统参数配置
-	CacheSysConfigTag = "sysConfigTag"
 	// CacheSysModelTag 模型缓存标签
 	CacheSysModelTag = "sysModelTag"
 	// CacheSysCmsTag cms缓存标签

+ 2 - 2
internal/app/system/controller/base.go

@@ -12,11 +12,11 @@ import (
 	commonController "github.com/tiger1103/gfast/v3/internal/app/common/controller"
 )
 
-type baseController struct {
+type BaseController struct {
 	commonController.BaseController
 }
 
 // Init 自动执行的初始化方法
-func (c *baseController) Init(r *ghttp.Request) {
+func (c *BaseController) Init(r *ghttp.Request) {
 	c.BaseController.Init(r)
 }

+ 0 - 8
internal/app/system/controller/menu.go

@@ -1,8 +0,0 @@
-/*
-* @desc:菜单
-* @company:云南奇讯科技有限公司
-* @Author: yixiaohu
-* @Date:   2022/3/16 10:36
- */
-
-package controller

+ 24 - 0
internal/app/system/controller/sys_auth_rule.go

@@ -0,0 +1,24 @@
+/*
+* @desc:菜单
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu
+* @Date:   2022/3/16 10:36
+ */
+
+package controller
+
+import (
+	"context"
+	"github.com/tiger1103/gfast/v3/api/v1/system"
+	"github.com/tiger1103/gfast/v3/internal/app/system/service"
+)
+
+var Menu = menuController{}
+
+type menuController struct {
+}
+
+func (c *menuController) Add(ctx context.Context, req *system.RuleAddReq) (res *system.RuleAddRes, err error) {
+	err = service.Rule().Add(ctx, req)
+	return
+}

+ 25 - 0
internal/app/system/controller/sys_dict_data.go

@@ -0,0 +1,25 @@
+/*
+* @desc:字典数据管理
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:57
+ */
+
+package controller
+
+import (
+	"context"
+	"github.com/tiger1103/gfast/v3/api/v1/system"
+	commonService "github.com/tiger1103/gfast/v3/internal/app/common/service"
+)
+
+var DictData = dictDataController{}
+
+type dictDataController struct {
+}
+
+// GetDictData 获取字典数据
+func (c *dictDataController) GetDictData(ctx context.Context, req *system.GetDictReq) (res *system.GetDictRes, err error) {
+	res, err = commonService.DictData().GetDictWithDataByType(ctx, req)
+	return
+}

+ 8 - 0
internal/app/system/controller/sys_dict_type.go

@@ -0,0 +1,8 @@
+/*
+* @desc:xxxx功能描述
+* @company:云南奇讯科技有限公司
+* @Author: yixiaohu<yxh669@qq.com>
+* @Date:   2022/3/18 11:57
+ */
+
+package controller

+ 5 - 5
internal/app/system/controller/user.go → internal/app/system/controller/sys_user.go

@@ -15,14 +15,14 @@ import (
 )
 
 var (
-	User = UserController{}
+	User = userController{}
 )
 
-type UserController struct {
-	baseController
+type userController struct {
+	BaseController
 }
 
-func (c *UserController) Login(ctx context.Context, req *system.UserLoginReq) (res *system.UserLoginRes, err error) {
+func (c *userController) Login(ctx context.Context, req *system.UserLoginReq) (res *system.UserLoginRes, err error) {
 	var (
 		user        *model.LoginUserRes
 		token       string
@@ -89,7 +89,7 @@ func (c *UserController) Login(ctx context.Context, req *system.UserLoginReq) (r
 }
 
 // GetUserMenus 获取用户菜单及按钮权限
-func (c *UserController) GetUserMenus(ctx context.Context, req *system.UserMenusReq) (res *system.UserMenusRes, err error) {
+func (c *userController) GetUserMenus(ctx context.Context, req *system.UserMenusReq) (res *system.UserMenusRes, err error) {
 	var (
 		permissions []string
 		menuList    []*model.UserMenus

+ 4 - 2
internal/app/system/model/entity/sys_auth_rule.go

@@ -1,5 +1,5 @@
 // =================================================================================
-// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-09 10:18:38
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
 // =================================================================================
 
 package entity
@@ -24,9 +24,11 @@ type SysAuthRule struct {
 	Path       string      `json:"path"       description:"路由地址"`
 	JumpPath   string      `json:"jumpPath"   description:"跳转路由"`
 	Component  string      `json:"component"  description:"组件路径"`
-	IsFrame    uint        `json:"isFrame"    description:"是否外链 1是 0否"`
+	IsLink     uint        `json:"isLink"     description:"是否外链 1是 0否"`
 	ModuleType string      `json:"moduleType" description:"所属模块"`
 	ModelId    uint        `json:"modelId"    description:"模型ID"`
+	IsIframe   uint        `json:"isIframe"   description:"是否内嵌iframe"`
+	IsCached   uint        `json:"isCached"   description:"是否缓存"`
 	CreatedAt  *gtime.Time `json:"createdAt"  description:"创建日期"`
 	UpdatedAt  *gtime.Time `json:"updatedAt"  description:"修改日期"`
 }

+ 2 - 0
internal/app/system/router/router.go

@@ -24,6 +24,8 @@ func BindController(group *ghttp.RouterGroup) {
 		group.Middleware(service.Middleware().Ctx, service.Middleware().Auth)
 		group.Bind(
 			controller.User,
+			controller.Menu,
+			controller.DictData,
 		)
 	})
 }

+ 7 - 3
internal/app/system/service/internal/dao/internal/sys_auth_rule.go

@@ -1,5 +1,5 @@
 // ==========================================================================
-// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-09 10:18:38
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
 // ==========================================================================
 
 package internal
@@ -33,9 +33,11 @@ type SysAuthRuleColumns struct {
 	Path       string // 路由地址
 	JumpPath   string // 跳转路由
 	Component  string // 组件路径
-	IsFrame    string // 是否外链 1是 0否
+	IsLink     string // 是否外链 1是 0否
 	ModuleType string // 所属模块
 	ModelId    string // 模型ID
+	IsIframe   string // 是否内嵌iframe
+	IsCached   string // 是否缓存
 	CreatedAt  string // 创建日期
 	UpdatedAt  string // 修改日期
 }
@@ -56,9 +58,11 @@ var sysAuthRuleColumns = SysAuthRuleColumns{
 	Path:       "path",
 	JumpPath:   "jump_path",
 	Component:  "component",
-	IsFrame:    "is_frame",
+	IsLink:     "is_link",
 	ModuleType: "module_type",
 	ModelId:    "model_id",
+	IsIframe:   "is_iframe",
+	IsCached:   "is_cached",
 	CreatedAt:  "created_at",
 	UpdatedAt:  "updated_at",
 }

+ 4 - 2
internal/app/system/service/internal/do/sys_auth_rule.go

@@ -1,5 +1,5 @@
 // =================================================================================
-// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-09 10:18:38
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
 // =================================================================================
 
 package do
@@ -26,9 +26,11 @@ type SysAuthRule struct {
 	Path       interface{} // 路由地址
 	JumpPath   interface{} // 跳转路由
 	Component  interface{} // 组件路径
-	IsFrame    interface{} // 是否外链 1是 0否
+	IsLink     interface{} // 是否外链 1是 0否
 	ModuleType interface{} // 所属模块
 	ModelId    interface{} // 模型ID
+	IsIframe   interface{} // 是否内嵌iframe
+	IsCached   interface{} // 是否缓存
 	CreatedAt  *gtime.Time // 创建日期
 	UpdatedAt  *gtime.Time // 修改日期
 }

+ 11 - 0
internal/app/system/service/sys_auth_rule.go

@@ -11,6 +11,7 @@ import (
 	"context"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/util/gconv"
+	"github.com/tiger1103/gfast/v3/api/v1/system"
 	"github.com/tiger1103/gfast/v3/internal/app/common/service"
 	"github.com/tiger1103/gfast/v3/internal/app/system/consts"
 	"github.com/tiger1103/gfast/v3/internal/app/system/model"
@@ -22,6 +23,7 @@ type IRule interface {
 	GetIsMenuStatusList(ctx context.Context) ([]*model.SysAuthRuleInfoRes, error)
 	GetMenuList(ctx context.Context) (list []*model.SysAuthRuleInfoRes, err error)
 	GetIsButtonStatusList(ctx context.Context) ([]*model.SysAuthRuleInfoRes, error)
+	Add(ctx context.Context, req *system.RuleAddReq) (err error)
 }
 
 type ruleImpl struct {
@@ -86,3 +88,12 @@ func (s *ruleImpl) GetIsButtonStatusList(ctx context.Context) ([]*model.SysAuthR
 	}
 	return gList, nil
 }
+
+// Add 添加菜单
+func (s *ruleImpl) Add(ctx context.Context, req *system.RuleAddReq) (err error) {
+	err = g.Try(func() {
+		_, err = dao.SysAuthRule.Ctx(ctx).Insert(req)
+		liberr.ErrIsNil(ctx, err, "添加菜单失败")
+	})
+	return
+}

+ 1 - 1
manifest/config/config.yaml

@@ -76,7 +76,7 @@ gfcli:
   gen:
     dao:
       - link:            "mysql:root:123456@tcp(127.0.0.1:3306)/gfast-v3"
-        tables:          "casbin_rule"
+        tables:          "sys_dict_type,sys_dict_data,sys_config"
         removePrefix:    "gf_"
         descriptionTag:  true
         noModelComment:  true