This commit is contained in:
2026-03-18 10:19:42 +08:00
parent 2526ad4414
commit e58dd3529d
267 changed files with 25279 additions and 2 deletions

13
internal/app/boot/boot.go Normal file
View File

@@ -0,0 +1,13 @@
/*
* @desc:启动
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/23 15:55
*/
package boot
import (
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic"
_ "github.com/tiger1103/gfast/v3/internal/app/system/logic"
)

View File

@@ -0,0 +1,25 @@
/*
* @desc:缓存相关
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/9 11:25
*/
package consts
const (
// CachePrefix 应用缓存数据前缀
CachePrefix = "APP:"
CacheModelMem = "memory"
CacheModelRedis = "redis"
CacheModelDist = "dist"
// CacheSysDict 字典缓存菜单KEY
CacheSysDict = CachePrefix + "sysDict"
// CacheSysDictTag 字典缓存标签
CacheSysDictTag = CachePrefix + "sysDictTag"
// CacheSysConfigTag 系统参数配置
CacheSysConfigTag = CachePrefix + "sysConfigTag"
)

View File

@@ -0,0 +1,8 @@
/*
* @desc:常量
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/3/30 11:54
*/
package consts

View File

@@ -0,0 +1,11 @@
package consts
const (
UploadPath = "upload_file"
ImgTypeKey = "sys.uploadFile.imageType"
ImgSizeKey = "sys.uploadFile.imageSize"
FileTypeKey = "sys.uploadFile.fileType"
FileSizeKey = "sys.uploadFile.fileSize"
CheckFileTypeImg = "img" // 文件类型(图片)
CheckFileTypeFile = "file" // 文件类型(任意)
)

View File

@@ -0,0 +1,19 @@
/*
* @desc:
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/4 18:19
*/
package controller
import (
"github.com/gogf/gf/v2/net/ghttp"
)
type BaseController struct {
}
// Init 自动执行的初始化方法
func (c *BaseController) Init(r *ghttp.Request) {
}

View File

@@ -0,0 +1,32 @@
/*
* @desc:验证码获取
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/2 17:45
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/common"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
var Captcha = captchaController{}
type captchaController struct {
}
// Get 获取验证码
func (c *captchaController) Get(ctx context.Context, req *common.CaptchaReq) (res *common.CaptchaRes, err error) {
var (
idKeyC, base64stringC string
)
idKeyC, base64stringC, err = service.Captcha().GetVerifyImgString(ctx)
res = &common.CaptchaRes{
Key: idKeyC,
Img: base64stringC,
}
return
}

View File

@@ -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/dao/internal"
)
// casbinRuleDao is the data access object for table casbin_rule.
// You can define custom methods on it to extend its functionality as you wish.
type casbinRuleDao struct {
*internal.CasbinRuleDao
}
var (
// CasbinRule is globally public accessible object for table casbin_rule operations.
CasbinRule = casbinRuleDao{
internal.NewCasbinRuleDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,84 @@
// ==========================================================================
// 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"
)
// CasbinRuleDao is the data access object for table casbin_rule.
type CasbinRuleDao 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 CasbinRuleColumns // columns contains all the column names of Table for convenient usage.
}
// CasbinRuleColumns defines and stores column names for table casbin_rule.
type CasbinRuleColumns struct {
Ptype string //
V0 string //
V1 string //
V2 string //
V3 string //
V4 string //
V5 string //
}
// casbinRuleColumns holds the columns for table casbin_rule.
var casbinRuleColumns = CasbinRuleColumns{
Ptype: "ptype",
V0: "v0",
V1: "v1",
V2: "v2",
V3: "v3",
V4: "v4",
V5: "v5",
}
// NewCasbinRuleDao creates and returns a new DAO object for table data access.
func NewCasbinRuleDao() *CasbinRuleDao {
return &CasbinRuleDao{
group: "default",
table: "casbin_rule",
columns: casbinRuleColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *CasbinRuleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *CasbinRuleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *CasbinRuleDao) Columns() CasbinRuleColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *CasbinRuleDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *CasbinRuleDao) 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 *CasbinRuleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,90 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
// ==========================================================================
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 // 修改时间
}
// 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",
}
// 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)
}

View File

@@ -0,0 +1,98 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// ==========================================================================
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 // 修改时间
}
// 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",
}
// 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)
}

View File

@@ -0,0 +1,88 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// ==========================================================================
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 // 修改日期
}
// 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",
}
// 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)
}

View File

@@ -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/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.

View File

@@ -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/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.

View File

@@ -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/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.

View File

@@ -0,0 +1,45 @@
/*
* @desc:缓存处理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/27 16:33
*/
package cache
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/tiger1103/gfast-cache/cache"
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
func init() {
service.RegisterCache(New())
}
func New() *sCache {
var (
ctx = gctx.New()
cacheContainer *cache.GfCache
)
prefix := g.Cfg().MustGet(ctx, "system.cache.prefix").String()
model := g.Cfg().MustGet(ctx, "system.cache.model").String()
if model == consts.CacheModelRedis {
// redis
cacheContainer = cache.NewRedis(prefix)
} else {
// memory
cacheContainer = cache.New(prefix)
}
return &sCache{
GfCache: cacheContainer,
prefix: prefix,
}
}
type sCache struct {
*cache.GfCache
prefix string
}

View File

@@ -0,0 +1,69 @@
/*
* @desc:验证码处理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/28 9:01
*/
package captcha
import (
"context"
"github.com/gogf/gf/v2/text/gstr"
"github.com/mojocn/base64Captcha"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
func init() {
service.RegisterCaptcha(New())
}
func New() *sCaptcha {
return &sCaptcha{
driver: &base64Captcha.DriverString{
Height: 80,
Width: 240,
NoiseCount: 50,
ShowLineOptions: 20,
Length: 4,
Source: "abcdefghjkmnpqrstuvwxyz23456789",
Fonts: []string{"chromohv.ttf"},
},
store: base64Captcha.DefaultMemStore,
}
}
type sCaptcha struct {
driver *base64Captcha.DriverString
store base64Captcha.Store
}
var (
captcha = sCaptcha{
driver: &base64Captcha.DriverString{
Height: 80,
Width: 240,
NoiseCount: 50,
ShowLineOptions: 20,
Length: 4,
Source: "abcdefghjkmnpqrstuvwxyz23456789",
Fonts: []string{"chromohv.ttf"},
},
store: base64Captcha.DefaultMemStore,
}
)
// GetVerifyImgString 获取字母数字混合验证码
func (s *sCaptcha) GetVerifyImgString(ctx context.Context) (idKeyC string, base64stringC string, err error) {
driver := s.driver.ConvertFonts()
c := base64Captcha.NewCaptcha(driver, s.store)
idKeyC, base64stringC, _, err = c.Generate()
return
}
// VerifyString 验证输入的验证码是否正确
func (s *sCaptcha) VerifyString(id, answer string) bool {
c := base64Captcha.NewCaptcha(s.driver, s.store)
answer = gstr.ToLower(answer)
return c.Verify(id, answer, true)
}

View File

@@ -0,0 +1,17 @@
/**
* @Company: 云南奇讯科技有限公司
* @Author: yxf
* @Description:
* @Date: 2024/1/25 16:22
*/
package eventBus
import (
"github.com/asaskevich/EventBus"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
func init() {
service.RegisterEventBus(EventBus.New())
}

View File

@@ -0,0 +1,15 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package logic
import (
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/cache"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/captcha"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/eventBus"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/middleware"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysConfig"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysDictData"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysDictType"
)

View File

@@ -0,0 +1,31 @@
/*
* @desc:中间件处理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/28 9:08
*/
package middleware
import (
"github.com/gogf/gf/v2/net/ghttp"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
func init() {
service.RegisterMiddleware(New())
}
func New() *sMiddleware {
return &sMiddleware{}
}
type sMiddleware struct{}
func (s *sMiddleware) MiddlewareCORS(r *ghttp.Request) {
corsOptions := r.Response.DefaultCORSOptions()
// you can set options
//corsOptions.AllowDomain = []string{"goframe.org", "baidu.com"}
r.Response.CORS(corsOptions)
r.Middleware.Next()
}

View File

@@ -0,0 +1,178 @@
/*
* @desc:配置参数管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/28 9:13
*/
package sysConfig
import (
"context"
"errors"
"github.com/gogf/gf/v2/errors/gerror"
"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/consts"
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterSysConfig(New())
}
func New() *sSysConfig {
return &sSysConfig{}
}
type sSysConfig struct {
}
// List 系统参数列表
func (s *sSysConfig) List(ctx context.Context, req *system.ConfigSearchReq) (res *system.ConfigSearchRes, err error) {
res = new(system.ConfigSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.SysConfig.Ctx(ctx)
if req != nil {
if req.ConfigName != "" {
m = m.Where("config_name like ?", "%"+req.ConfigName+"%")
}
if req.ConfigType != "" {
m = m.Where("config_type = ", gconv.Int(req.ConfigType))
}
if req.ConfigKey != "" {
m = m.Where("config_key like ?", "%"+req.ConfigKey+"%")
}
if len(req.DateRange) > 0 {
m = m.Where("created_at >= ? AND created_at<=?", req.DateRange[0], req.DateRange[1])
}
}
res.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取数据失败")
if req.PageNum == 0 {
req.PageNum = 1
}
res.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = systemConsts.PageSize
}
err = m.Page(req.PageNum, req.PageSize).Order("config_id asc").Scan(&res.List)
liberr.ErrIsNil(ctx, err, "获取数据失败")
})
return
}
func (s *sSysConfig) Add(ctx context.Context, req *system.ConfigAddReq, userId uint64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = s.CheckConfigKeyUnique(ctx, req.ConfigKey)
liberr.ErrIsNil(ctx, err)
_, err = dao.SysConfig.Ctx(ctx).Insert(do.SysConfig{
ConfigName: req.ConfigName,
ConfigKey: req.ConfigKey,
ConfigValue: req.ConfigValue,
ConfigType: req.ConfigType,
CreateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, err, "添加系统参数失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
})
return
}
// CheckConfigKeyUnique 验证参数键名是否存在
func (s *sSysConfig) CheckConfigKeyUnique(ctx context.Context, configKey string, configId ...int64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
data := (*entity.SysConfig)(nil)
m := dao.SysConfig.Ctx(ctx).Fields(dao.SysConfig.Columns().ConfigId).Where(dao.SysConfig.Columns().ConfigKey, configKey)
if len(configId) > 0 {
m = m.Where(dao.SysConfig.Columns().ConfigId+" != ?", configId[0])
}
err = m.Scan(&data)
liberr.ErrIsNil(ctx, err, "校验失败")
if data != nil {
liberr.ErrIsNil(ctx, errors.New("参数键名重复"))
}
})
return
}
// Get 获取系统参数
func (s *sSysConfig) Get(ctx context.Context, id int) (res *system.ConfigGetRes, err error) {
res = new(system.ConfigGetRes)
err = g.Try(ctx, func(ctx context.Context) {
err = dao.SysConfig.Ctx(ctx).WherePri(id).Scan(&res.Data)
liberr.ErrIsNil(ctx, err, "获取系统参数失败")
})
return
}
// Edit 修改系统参数
func (s *sSysConfig) Edit(ctx context.Context, req *system.ConfigEditReq, userId uint64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = s.CheckConfigKeyUnique(ctx, req.ConfigKey, req.ConfigId)
liberr.ErrIsNil(ctx, err)
_, err = dao.SysConfig.Ctx(ctx).WherePri(req.ConfigId).Update(do.SysConfig{
ConfigName: req.ConfigName,
ConfigKey: req.ConfigKey,
ConfigValue: req.ConfigValue,
ConfigType: req.ConfigType,
UpdateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, err, "修改系统参数失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
})
return
}
// Delete 删除系统参数
func (s *sSysConfig) Delete(ctx context.Context, ids []int) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.SysConfig.Ctx(ctx).Delete(dao.SysConfig.Columns().ConfigId+" in (?)", ids)
liberr.ErrIsNil(ctx, err, "删除失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysConfigTag)
})
return
}
// GetConfigByKey 通过key获取参数从缓存获取
func (s *sSysConfig) GetConfigByKey(ctx context.Context, key string) (config *entity.SysConfig, err error) {
if key == "" {
err = gerror.New("参数key不能为空")
return
}
cache := service.Cache()
cf := cache.Get(ctx, consts.CacheSysConfigTag+key)
if cf != nil && !cf.IsEmpty() {
err = gconv.Struct(cf, &config)
return
}
config, err = s.GetByKey(ctx, key)
if err != nil {
return
}
if config != nil {
cache.Set(ctx, consts.CacheSysConfigTag+key, config, 0, consts.CacheSysConfigTag)
}
return
}
// GetByKey 通过key获取参数从数据库获取
func (s *sSysConfig) GetByKey(ctx context.Context, key string) (config *entity.SysConfig, err error) {
err = dao.SysConfig.Ctx(ctx).Where("config_key", key).Scan(&config)
if err != nil {
g.Log().Error(ctx, err)
err = gerror.New("获取配置失败")
}
return
}

View File

@@ -0,0 +1,279 @@
/*
* @desc:字典数据管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/28 9:22
*/
package sysDictData
import (
"context"
"errors"
"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"
"github.com/tiger1103/gfast/v3/internal/app/common/consts"
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
"github.com/tiger1103/gfast/v3/internal/app/common/model"
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterSysDictData(New())
}
func New() *sSysDictData {
return &sSysDictData{}
}
type sSysDictData struct {
}
// GetDictDataTree 根据备注查询返回树形结构
func (s *sSysDictData) GetDictDataTree(ctx context.Context, remark string) (res *system.GetDictTreeRes, err error) {
cache := service.Cache()
cacheKey := consts.CacheSysDict + "_" + remark
//从缓存获取
iDict := cache.GetOrSetFuncLock(ctx, cacheKey, func(ctx context.Context) (value interface{}, err error) {
err = g.Try(ctx, func(ctx context.Context) {
//从数据库获取
var list []*entity.SysDictType
//获取类型数据
err = dao.SysDictType.Ctx(ctx).Where(dao.SysDictType.Columns().Remark, remark).
Where(dao.SysDictType.Columns().Status, 1).Fields(model.DictTypeRes{}).Scan(&list)
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
if len(list) == 0 {
return
}
dict := &system.GetDictRes{}
err = dao.SysDictData.Ctx(ctx).Fields(model.DictDataRes{}).
Where(dao.SysDictData.Columns().Remark, remark).
Where(dao.SysDictData.Columns().Status, 1).
Order(dao.SysDictData.Columns().DictSort + " asc," +
dao.SysDictData.Columns().DictCode + " asc").
Scan(&dict.Values)
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
// 构建树形结构
res = new(system.GetDictTreeRes)
for _, category := range list {
tree := new(system.GetDictRes)
dictType := &model.DictTypeRes{
DictName: category.DictName,
DictType: category.DictType,
Remark: category.Remark,
}
for _, v := range dict.Values {
if category.DictType == v.DictType {
dictData := &model.DictDataRes{
DictValue: v.DictValue,
DictLabel: v.DictLabel,
DictType: v.DictType,
Remark: v.Remark,
IsDefault: v.IsDefault,
}
tree.Values = append(tree.Values, dictData)
}
}
tree.Info = dictType
res.List = append(res.List, tree)
}
})
return
}, 0, consts.CacheSysDictTag)
if !iDict.IsEmpty() {
err = gconv.Struct(iDict, &res)
if err != nil {
return
}
}
return
}
// GetDictWithDataByType 通过字典键类型获取选项
func (s *sSysDictData) GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes,
err error) {
dictType := req.DictType
defaultValue := req.DefaultValue
cache := service.Cache()
cacheKey := consts.CacheSysDict + "_" + dictType
//从缓存获取
iDict := cache.GetOrSetFuncLock(ctx, cacheKey, func(ctx context.Context) (value interface{}, err error) {
err = g.Try(ctx, func(ctx context.Context) {
//从数据库获取
dict = &system.GetDictRes{}
//获取类型数据
err = dao.SysDictType.Ctx(ctx).Where(dao.SysDictType.Columns().DictType, dictType).
Where(dao.SysDictType.Columns().Status, 1).Fields(model.DictTypeRes{}).Scan(&dict.Info)
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
if dict.Info == nil {
return
}
err = dao.SysDictData.Ctx(ctx).Fields(model.DictDataRes{}).
Where(dao.SysDictData.Columns().DictType, dictType).
Where(dao.SysDictData.Columns().Status, 1).
Order(dao.SysDictData.Columns().DictSort + " asc," +
dao.SysDictData.Columns().DictCode + " asc").
Scan(&dict.Values)
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
})
value = dict
return
}, 0, consts.CacheSysDictTag)
if !iDict.IsEmpty() {
err = gconv.Struct(iDict, &dict)
if err != nil {
return
}
}
//设置给定的默认值
for _, v := range dict.Values {
if defaultValue != "" {
if gstr.Equal(defaultValue, v.DictValue) {
v.IsDefault = 1
} else {
v.IsDefault = 0
}
}
}
return
}
// List 获取字典数据
func (s *sSysDictData) List(ctx context.Context, req *system.DictDataSearchReq) (res *system.DictDataSearchRes, err error) {
res = new(system.DictDataSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.SysDictData.Ctx(ctx)
if req != nil {
if req.DictLabel != "" {
m = m.Where(dao.SysDictData.Columns().DictLabel+" like ?", "%"+req.DictLabel+"%")
}
if req.Status != "" {
m = m.Where(dao.SysDictData.Columns().Status+" = ", gconv.Int(req.Status))
}
if req.DictType != "" {
m = m.Where(dao.SysDictData.Columns().DictType+" = ?", req.DictType)
}
res.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
if req.PageNum == 0 {
req.PageNum = 1
}
res.CurrentPage = req.PageNum
}
if req.PageSize == 0 {
req.PageSize = systemConsts.PageSize
}
err = m.Page(req.PageNum, req.PageSize).Order(dao.SysDictData.Columns().DictSort + " asc," +
dao.SysDictData.Columns().DictCode + " asc").Scan(&res.List)
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
})
return
}
// IsExists 判断同一类型下字典名次和字典键值是否存在
func (s *sSysDictData) IsExists(ctx context.Context, dictType, dictLabel, dictValue string, dictCode ...int64) error {
return g.Try(ctx, func(ctx context.Context) {
var dictData []*entity.SysDictData
err := dao.SysDictData.Ctx(ctx).Where(dao.SysDictData.Columns().DictType, dictType).
Fields(dao.SysDictData.Columns().DictCode, dao.SysDictData.Columns().DictLabel, dao.SysDictData.Columns().DictValue).
Scan(&dictData)
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
if dictData == nil {
return
}
if len(dictCode) > 0 {
for _, v := range dictData {
if v.DictLabel == gstr.Trim(dictLabel) && v.DictCode != dictCode[0] {
liberr.ErrIsNil(ctx, errors.New("字典名称已存在"))
}
if v.DictValue == dictValue && v.DictCode != dictCode[0] {
liberr.ErrIsNil(ctx, errors.New("字典键值已存在"))
}
}
} else {
for _, v := range dictData {
if v.DictLabel == gstr.Trim(dictLabel) {
liberr.ErrIsNil(ctx, errors.New("字典名称已存在"))
}
if v.DictValue == dictValue {
liberr.ErrIsNil(ctx, errors.New("字典键值已存在"))
}
}
}
})
}
func (s *sSysDictData) Add(ctx context.Context, req *system.DictDataAddReq, userId uint64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = s.IsExists(ctx, req.DictType, req.DictLabel, req.DictValue)
liberr.ErrIsNil(ctx, err)
_, err = dao.SysDictData.Ctx(ctx).Insert(do.SysDictData{
DictSort: req.DictSort,
DictLabel: gstr.Trim(req.DictLabel),
DictValue: gstr.Trim(req.DictValue),
DictType: req.DictType,
CssClass: req.CssClass,
ListClass: req.ListClass,
IsDefault: req.IsDefault,
Status: req.Status,
CreateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, err, "添加字典数据失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return
}
// Get 获取字典数据
func (s *sSysDictData) Get(ctx context.Context, dictCode uint) (res *system.DictDataGetRes, err error) {
res = new(system.DictDataGetRes)
err = g.Try(ctx, func(ctx context.Context) {
err = dao.SysDictData.Ctx(ctx).WherePri(dictCode).Scan(&res.Dict)
liberr.ErrIsNil(ctx, err, "获取字典数据失败")
})
return
}
// Edit 修改字典数据
func (s *sSysDictData) Edit(ctx context.Context, req *system.DictDataEditReq, userId uint64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = s.IsExists(ctx, req.DictType, req.DictLabel, req.DictValue, req.DictCode)
liberr.ErrIsNil(ctx, err)
_, err = dao.SysDictData.Ctx(ctx).WherePri(req.DictCode).Update(do.SysDictData{
DictSort: req.DictSort,
DictLabel: gstr.Trim(req.DictLabel),
DictValue: gstr.Trim(req.DictValue),
DictType: req.DictType,
CssClass: req.CssClass,
ListClass: req.ListClass,
IsDefault: req.IsDefault,
Status: req.Status,
UpdateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, err, "修改字典数据失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return
}
// Delete 删除字典数据
func (s *sSysDictData) Delete(ctx context.Context, ids []int) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.SysDictData.Ctx(ctx).Where(dao.SysDictData.Columns().DictCode+" in(?)", ids).Delete()
liberr.ErrIsNil(ctx, err, "删除字典数据失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return
}

View File

@@ -0,0 +1,186 @@
/*
* @desc:字典类型管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/28 9:26
*/
package sysDictType
import (
"context"
"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror"
"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/consts"
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
"github.com/tiger1103/gfast/v3/internal/app/common/model"
"github.com/tiger1103/gfast/v3/internal/app/common/model/do"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
systemConsts "github.com/tiger1103/gfast/v3/internal/app/system/consts"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterSysDictType(New())
}
func New() *sSysDictType {
return &sSysDictType{}
}
type sSysDictType struct {
}
// List 字典类型列表
func (s *sSysDictType) List(ctx context.Context, req *system.DictTypeSearchReq) (res *system.DictTypeSearchRes, err error) {
res = new(system.DictTypeSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.SysDictType.Ctx(ctx)
if req.DictName != "" {
m = m.Where(dao.SysDictType.Columns().DictName+" like ?", "%"+req.DictName+"%")
}
if req.DictType != "" {
m = m.Where(dao.SysDictType.Columns().DictType+" like ?", "%"+req.DictType+"%")
}
if req.Status != "" {
m = m.Where(dao.SysDictType.Columns().Status+" = ", gconv.Int(req.Status))
}
res.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
if req.PageNum == 0 {
req.PageNum = 1
}
res.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = systemConsts.PageSize
}
err = m.Fields(model.SysDictTypeInfoRes{}).Page(req.PageNum, req.PageSize).
Order(dao.SysDictType.Columns().DictId + " asc").Scan(&res.DictTypeList)
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
})
return
}
// Add 添加字典类型
func (s *sSysDictType) Add(ctx context.Context, req *system.DictTypeAddReq, userId uint64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = s.ExistsDictType(ctx, req.DictType)
liberr.ErrIsNil(ctx, err)
_, err = dao.SysDictType.Ctx(ctx).Insert(do.SysDictType{
DictName: req.DictName,
DictType: req.DictType,
Status: req.Status,
CreateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, err, "添加字典类型失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return
}
// Edit 修改字典类型
func (s *sSysDictType) Edit(ctx context.Context, req *system.DictTypeEditReq, userId uint64) (err error) {
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
err = g.Try(ctx, func(ctx context.Context) {
err = s.ExistsDictType(ctx, req.DictType, req.DictId)
liberr.ErrIsNil(ctx, err)
dictType := (*entity.SysDictType)(nil)
e := dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictType).WherePri(req.DictId).Scan(&dictType)
liberr.ErrIsNil(ctx, e, "获取字典类型失败")
liberr.ValueIsNil(dictType, "字典类型不存在")
//修改字典类型
_, e = dao.SysDictType.Ctx(ctx).TX(tx).WherePri(req.DictId).Update(do.SysDictType{
DictName: req.DictName,
DictType: req.DictType,
Status: req.Status,
UpdateBy: userId,
Remark: req.Remark,
})
liberr.ErrIsNil(ctx, e, "修改字典类型失败")
//修改字典数据
_, e = dao.SysDictData.Ctx(ctx).TX(tx).Data(do.SysDictData{DictType: req.DictType}).
Where(dao.SysDictData.Columns().DictType, dictType.DictType).Update()
liberr.ErrIsNil(ctx, e, "修改字典数据失败")
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return err
})
return
}
func (s *sSysDictType) Get(ctx context.Context, req *system.DictTypeGetReq) (dictType *entity.SysDictType, err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = dao.SysDictType.Ctx(ctx).Where(dao.SysDictType.Columns().DictId, req.DictId).Scan(&dictType)
liberr.ErrIsNil(ctx, err, "获取字典类型失败")
})
return
}
// ExistsDictType 检查类型是否已经存在
func (s *sSysDictType) ExistsDictType(ctx context.Context, dictType string, dictId ...int64) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
m := dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictId).
Where(dao.SysDictType.Columns().DictType, dictType)
if len(dictId) > 0 {
m = m.Where(dao.SysDictType.Columns().DictId+" !=? ", dictId[0])
}
res, e := m.One()
liberr.ErrIsNil(ctx, e, "sql err")
if !res.IsEmpty() {
liberr.ErrIsNil(ctx, gerror.New("字典类型已存在"))
}
})
return
}
// Delete 删除字典类型
func (s *sSysDictType) Delete(ctx context.Context, dictIds []int) (err error) {
err = g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
err = g.Try(ctx, func(ctx context.Context) {
discs := ([]*entity.SysDictType)(nil)
err = dao.SysDictType.Ctx(ctx).Fields(dao.SysDictType.Columns().DictType).
Where(dao.SysDictType.Columns().DictId+" in (?) ", dictIds).Scan(&discs)
liberr.ErrIsNil(ctx, err, "删除失败")
types := garray.NewStrArray()
for _, dt := range discs {
types.Append(dt.DictType)
}
if types.Len() > 0 {
_, err = dao.SysDictType.Ctx(ctx).TX(tx).Delete(dao.SysDictType.Columns().DictId+" in (?) ", dictIds)
liberr.ErrIsNil(ctx, err, "删除类型失败")
_, err = dao.SysDictData.Ctx(ctx).TX(tx).Delete(dao.SysDictData.Columns().DictType+" in (?) ", types.Slice())
liberr.ErrIsNil(ctx, err, "删除字典数据失败")
}
//清除缓存
service.Cache().RemoveByTag(ctx, consts.CacheSysDictTag)
})
return err
})
return
}
// GetAllDictType 获取所有正常状态下的字典类型
func (s *sSysDictType) GetAllDictType(ctx context.Context) (list []*entity.SysDictType, err error) {
cache := service.Cache()
//从缓存获取
data := cache.Get(ctx, consts.CacheSysDict+"_dict_type_all")
if !data.IsNil() {
err = data.Structs(&list)
return
}
err = g.Try(ctx, func(ctx context.Context) {
err = dao.SysDictType.Ctx(ctx).Where("status", 1).Order("dict_id ASC").Scan(&list)
liberr.ErrIsNil(ctx, err, "获取字典类型数据出错")
//缓存
cache.Set(ctx, consts.CacheSysDict+"_dict_type_all", list, 0, consts.CacheSysDictTag)
})
return
}

View File

@@ -0,0 +1,22 @@
/*
* @desc:公用model
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2023/5/11 22:43
*/
package model
// PageReq 公共请求参数
type PageReq struct {
DateRange []string `p:"dateRange"` //日期范围
PageNum int `p:"pageNum"` //当前页码
PageSize int `p:"pageSize"` //每页数
OrderBy string `p:"orderBy" v:"regex:^[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?\\s+(asc|desc|ASC|DESC)(?:\\s*,\\s*[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?\\s+(asc|desc|ASC|DESC))*$#排序参数不合法"` // 排序方式
}
// ListRes 列表公共返回
type ListRes struct {
CurrentPage int `json:"currentPage"`
Total interface{} `json:"total"`
}

View File

@@ -0,0 +1,21 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
)
// CasbinRule is the golang structure of table casbin_rule for DAO operations like Where/Data.
type CasbinRule struct {
g.Meta `orm:"table:casbin_rule, do:true"`
Ptype interface{} //
V0 interface{} //
V1 interface{} //
V2 interface{} //
V3 interface{} //
V4 interface{} //
V5 interface{} //
}

View File

@@ -0,0 +1,25 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
// =================================================================================
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 // 修改时间
}

View File

@@ -0,0 +1,29 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// =================================================================================
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 // 修改时间
}

View File

@@ -0,0 +1,24 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// =================================================================================
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 // 修改日期
}

View File

@@ -0,0 +1,16 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// CasbinRule is the golang structure for table casbin_rule.
type CasbinRule struct {
Ptype string `json:"ptype" description:""`
V0 string `json:"v0" description:""`
V1 string `json:"v1" description:""`
V2 string `json:"v2" description:""`
V3 string `json:"v3" description:""`
V4 string `json:"v4" description:""`
V5 string `json:"v5" description:""`
}

View File

@@ -0,0 +1,23 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
// =================================================================================
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:"修改时间"`
}

View File

@@ -0,0 +1,27 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// =================================================================================
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:"修改时间"`
}

View File

@@ -0,0 +1,22 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-16 16:32:52
// =================================================================================
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:"修改日期"`
}

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
/*
* @desc:字典类型
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/3/18 11:56
*/
package model
import "github.com/gogf/gf/v2/os/gtime"
type SysDictTypeInfoRes struct {
DictId uint64 `orm:"dict_id,primary" json:"dictId"` // 字典主键
DictName string `orm:"dict_name" json:"dictName"` // 字典名称
DictType string `orm:"dict_type,unique" json:"dictType"` // 字典类型
Status uint `orm:"status" json:"status"` // 状态0正常 1停用
Remark string `orm:"remark" json:"remark"` // 备注
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` // 创建日期
}

View File

@@ -0,0 +1,32 @@
/*
* @desc:token options
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/8 16:02
*/
package model
import (
"github.com/gogf/gf/v2/frame/g"
)
type TokenOptions struct {
// server name
ServerName string `json:"serverName"`
// 缓存key (每创建一个实例CacheKey必须不相同)
CacheKey string `json:"cacheKey"`
// 超时时间 默认10天
Timeout int64 `json:"timeout"`
// 缓存刷新时间 默认5天
// 处理携带token的请求时当前时间大于超时时间并小于缓存刷新时间时token将自动刷新即重置token存活时间
// MaxRefresh值为0时,token将不会自动刷新
MaxRefresh int64 `json:"maxRefresh"`
// 是否允许多点登录
MultiLogin bool `json:"multiLogin"`
// Token加密key 32位
EncryptKey []byte `json:"encryptKey"`
// 拦截排除地址
ExcludePaths g.SliceStr `json:"excludePaths"`
CacheModel string `json:"cacheModel"`
}

View File

@@ -0,0 +1,28 @@
/*
* @desc:后台路由
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/2/18 17:34
*/
package router
import (
"context"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/tiger1103/gfast/v3/internal/app/common/controller"
)
var R = new(Router)
type Router struct{}
func (router *Router) BindController(ctx context.Context, group *ghttp.RouterGroup) {
group.Group("/pub", func(group *ghttp.RouterGroup) {
group.Group("/captcha", func(group *ghttp.RouterGroup) {
group.Bind(
controller.Captcha,
)
})
})
}

View File

@@ -0,0 +1,29 @@
/*
* @desc:缓存处理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/9 11:15
*/
package service
import (
"github.com/tiger1103/gfast-cache/cache"
)
type ICache interface {
cache.IGCache
}
var c ICache
func Cache() ICache {
if c == nil {
panic("implement not found for interface ICache, forgot register?")
}
return c
}
func RegisterCache(che ICache) {
c = che
}

View File

@@ -0,0 +1,28 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
)
type ICaptcha interface {
GetVerifyImgString(ctx context.Context) (idKeyC string, base64stringC string, err error)
VerifyString(id, answer string) bool
}
var localCaptcha ICaptcha
func Captcha() ICaptcha {
if localCaptcha == nil {
panic("implement not found for interface ICaptcha, forgot register?")
}
return localCaptcha
}
func RegisterCaptcha(i ICaptcha) {
localCaptcha = i
}

View File

@@ -0,0 +1,238 @@
package service
import (
"context"
"github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/model"
"github.com/casbin/casbin/v2/persist"
"github.com/gogf/gf/v2/frame/g"
"github.com/tiger1103/gfast/v3/internal/app/common/dao"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
"sync"
)
type adapterCasbin struct {
Enforcer *casbin.SyncedEnforcer
EnforcerErr error
ctx context.Context
}
var (
once sync.Once
en *casbin.SyncedEnforcer
enErr error
)
// CasbinEnforcer 获取adapter单例对象
func CasbinEnforcer(ctx context.Context) (enforcer *casbin.SyncedEnforcer, err error) {
ac := newAdapter(ctx)
enforcer = ac.Enforcer
err = ac.EnforcerErr
return
}
// 初始化adapter操作
func newAdapter(ctx context.Context) (a *adapterCasbin) {
a = new(adapterCasbin)
a.ctx = ctx
once.Do(func() {
en, enErr = initPolicy(ctx, a)
})
if enErr == nil && en != nil {
en.SetAdapter(a)
}
a.Enforcer, a.EnforcerErr = en, enErr
return
}
func initPolicy(ctx context.Context, a *adapterCasbin) (e *casbin.SyncedEnforcer, err error) {
// Because the DB is empty at first,
// so we need to load the policy from the file adapter (.CSV) first.
e, err = casbin.NewSyncedEnforcer(g.Cfg().MustGet(ctx, "casbin.modelFile").String(), a)
return
}
// SavePolicy saves policy to database.
func (a *adapterCasbin) SavePolicy(model model.Model) (err error) {
err = a.dropTable()
if err != nil {
return
}
err = a.createTable()
if err != nil {
return
}
for ptype, ast := range model["p"] {
for _, rule := range ast.Policy {
line := savePolicyLine(ptype, rule)
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
if err != nil {
return err
}
}
}
for ptype, ast := range model["g"] {
for _, rule := range ast.Policy {
line := savePolicyLine(ptype, rule)
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
if err != nil {
return err
}
}
}
return
}
func (a *adapterCasbin) dropTable() (err error) {
return
}
func (a *adapterCasbin) createTable() (err error) {
return
}
// LoadPolicy loads policy from database.
func (a *adapterCasbin) LoadPolicy(model model.Model) error {
var lines []*entity.CasbinRule
if err := dao.CasbinRule.Ctx(a.ctx).Scan(&lines); err != nil {
return err
}
for _, line := range lines {
loadPolicyLine(line, model)
}
return nil
}
// AddPolicy adds a policy rule to the storage.
func (a *adapterCasbin) AddPolicy(sec string, ptype string, rule []string) error {
line := savePolicyLine(ptype, rule)
_, err := dao.CasbinRule.Ctx(a.ctx).Data(line).Insert()
return err
}
// RemovePolicy removes a policy rule from the storage.
func (a *adapterCasbin) RemovePolicy(sec string, ptype string, rule []string) error {
line := savePolicyLine(ptype, rule)
err := rawDelete(a, line)
return err
}
func (a *adapterCasbin) AddPolicies(sec string, ptype string, rules [][]string) error {
lines := make([]*entity.CasbinRule, len(rules))
for k, rule := range rules {
lines[k] = savePolicyLine(ptype, rule)
}
_, err := dao.CasbinRule.Ctx(a.ctx).Data(lines).Insert()
return err
}
// RemovePolicies removes policy rules from the storage.
// This is part of the Auto-Save feature.
func (a *adapterCasbin) RemovePolicies(sec string, ptype string, rules [][]string) error {
for _, rule := range rules {
err := a.RemovePolicy(sec, ptype, rule)
if err != nil {
return err
}
}
return nil
}
// RemoveFilteredPolicy removes policy rules that match the filter from the storage.
func (a *adapterCasbin) RemoveFilteredPolicy(sec string, ptype string,
fieldIndex int, fieldValues ...string) error {
line := &entity.CasbinRule{}
line.Ptype = ptype
if fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {
line.V0 = fieldValues[0-fieldIndex]
}
if fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {
line.V1 = fieldValues[1-fieldIndex]
}
if fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {
line.V2 = fieldValues[2-fieldIndex]
}
if fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {
line.V3 = fieldValues[3-fieldIndex]
}
if fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {
line.V4 = fieldValues[4-fieldIndex]
}
if fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {
line.V5 = fieldValues[5-fieldIndex]
}
err := rawDelete(a, line)
return err
}
func loadPolicyLine(line *entity.CasbinRule, model model.Model) {
lineText := line.Ptype
if line.V0 != "" {
lineText += ", " + line.V0
}
if line.V1 != "" {
lineText += ", " + line.V1
}
if line.V2 != "" {
lineText += ", " + line.V2
}
if line.V3 != "" {
lineText += ", " + line.V3
}
if line.V4 != "" {
lineText += ", " + line.V4
}
if line.V5 != "" {
lineText += ", " + line.V5
}
persist.LoadPolicyLine(lineText, model)
}
func savePolicyLine(ptype string, rule []string) *entity.CasbinRule {
line := &entity.CasbinRule{}
line.Ptype = ptype
if len(rule) > 0 {
line.V0 = rule[0]
}
if len(rule) > 1 {
line.V1 = rule[1]
}
if len(rule) > 2 {
line.V2 = rule[2]
}
if len(rule) > 3 {
line.V3 = rule[3]
}
if len(rule) > 4 {
line.V4 = rule[4]
}
if len(rule) > 5 {
line.V5 = rule[5]
}
return line
}
func rawDelete(a *adapterCasbin, line *entity.CasbinRule) error {
db := dao.CasbinRule.Ctx(a.ctx).Where("ptype = ?", line.Ptype)
if line.V0 != "" {
db = db.Where("v0 = ?", line.V0)
}
if line.V1 != "" {
db = db.Where("v1 = ?", line.V1)
}
if line.V2 != "" {
db = db.Where("v2 = ?", line.V2)
}
if line.V3 != "" {
db = db.Where("v3 = ?", line.V3)
}
if line.V4 != "" {
db = db.Where("v4 = ?", line.V4)
}
if line.V5 != "" {
db = db.Where("v5 = ?", line.V5)
}
_, err := db.Delete()
return err
}

View File

@@ -0,0 +1,23 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
eventBus "github.com/asaskevich/EventBus"
)
var localEventBus eventBus.Bus
func EventBus() eventBus.Bus {
if localEventBus == nil {
panic("implement not found for interface EventBus, forgot register?")
}
return localEventBus
}
func RegisterEventBus(i eventBus.Bus) {
localEventBus = i
}

View File

@@ -0,0 +1,27 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"github.com/gogf/gf/v2/net/ghttp"
)
type IMiddleware interface {
MiddlewareCORS(r *ghttp.Request)
}
var localMiddleware IMiddleware
func Middleware() IMiddleware {
if localMiddleware == nil {
panic("implement not found for interface IMiddleware, forgot register?")
}
return localMiddleware
}
func RegisterMiddleware(i IMiddleware) {
localMiddleware = i
}

View File

@@ -0,0 +1,37 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
)
type ISysConfig interface {
List(ctx context.Context, req *system.ConfigSearchReq) (res *system.ConfigSearchRes, err error)
Add(ctx context.Context, req *system.ConfigAddReq, userId uint64) (err error)
CheckConfigKeyUnique(ctx context.Context, configKey string, configId ...int64) (err error)
Get(ctx context.Context, id int) (res *system.ConfigGetRes, err error)
Edit(ctx context.Context, req *system.ConfigEditReq, userId uint64) (err error)
Delete(ctx context.Context, ids []int) (err error)
GetConfigByKey(ctx context.Context, key string) (config *entity.SysConfig, err error)
GetByKey(ctx context.Context, key string) (config *entity.SysConfig, err error)
}
var localSysConfig ISysConfig
func SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
}
return localSysConfig
}
func RegisterSysConfig(i ISysConfig) {
localSysConfig = i
}

View File

@@ -0,0 +1,35 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
)
type ISysDictData interface {
GetDictDataTree(ctx context.Context, dictType string) (res *system.GetDictTreeRes, err error)
GetDictWithDataByType(ctx context.Context, req *system.GetDictReq) (dict *system.GetDictRes, err error)
List(ctx context.Context, req *system.DictDataSearchReq) (res *system.DictDataSearchRes, err error)
Add(ctx context.Context, req *system.DictDataAddReq, userId uint64) (err error)
Get(ctx context.Context, dictCode uint) (res *system.DictDataGetRes, err error)
Edit(ctx context.Context, req *system.DictDataEditReq, userId uint64) (err error)
Delete(ctx context.Context, ids []int) (err error)
}
var localSysDictData ISysDictData
func SysDictData() ISysDictData {
if localSysDictData == nil {
panic("implement not found for interface ISysDictData, forgot register?")
}
return localSysDictData
}
func RegisterSysDictData(i ISysDictData) {
localSysDictData = i
}

View File

@@ -0,0 +1,36 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/common/model/entity"
)
type ISysDictType interface {
List(ctx context.Context, req *system.DictTypeSearchReq) (res *system.DictTypeSearchRes, err error)
Add(ctx context.Context, req *system.DictTypeAddReq, userId uint64) (err error)
Edit(ctx context.Context, req *system.DictTypeEditReq, userId uint64) (err error)
Get(ctx context.Context, req *system.DictTypeGetReq) (dictType *entity.SysDictType, err error)
ExistsDictType(ctx context.Context, dictType string, dictId ...int64) (err error)
Delete(ctx context.Context, dictIds []int) (err error)
GetAllDictType(ctx context.Context) (list []*entity.SysDictType, err error)
}
var localSysDictType ISysDictType
func SysDictType() ISysDictType {
if localSysDictType == nil {
panic("implement not found for interface ISysDictType, forgot register?")
}
return localSysDictType
}
func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
}

View File

@@ -0,0 +1,31 @@
/*
* @desc:缓存键
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/9 12:06
*/
package consts
import commonConsts "github.com/tiger1103/gfast/v3/internal/app/common/consts"
const (
// CacheSysAuthMenu 缓存菜单key
CacheSysAuthMenu = commonConsts.CachePrefix + "sysAuthMenu"
// CacheSysDept 缓存部门key
CacheSysDept = commonConsts.CachePrefix + "sysDept"
// CacheSysRole 角色缓存key
CacheSysRole = commonConsts.CachePrefix + "sysRole"
// CacheSysWebSet 站点配置缓存key
CacheSysWebSet = commonConsts.CachePrefix + "sysWebSet"
// CacheSysCmsMenu cms缓存key
CacheSysCmsMenu = commonConsts.CachePrefix + "sysCmsMenu"
// CacheSysAuthTag 权限缓存TAG标签
CacheSysAuthTag = commonConsts.CachePrefix + "sysAuthTag"
// CacheSysModelTag 模型缓存标签
CacheSysModelTag = commonConsts.CachePrefix + "sysModelTag"
// CacheSysCmsTag cms缓存标签
CacheSysCmsTag = commonConsts.CachePrefix + "sysCmsTag"
)

View File

@@ -0,0 +1,5 @@
package consts
const (
PageSize = 10 //分页长度
)

View File

@@ -0,0 +1,13 @@
/*
* @desc:context 相关常量
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/3/16 14:52
*/
package consts
const (
// CtxKey 上下文变量存储键名,前后端系统共享
CtxKey = "GFastContext"
)

View File

@@ -0,0 +1,7 @@
package consts
const (
SuperAdminId = 1 // 超级管理员
SalesAgentId = 9 // 销售代理
SiteAdminId = 10 // 站点管理员
)

View File

@@ -0,0 +1,45 @@
package consts
type TenantType int
const (
TenantTypeSite TenantType = 1 // 站点
TenantTypeAgent TenantType = 2 // 代理
)
type CertificationStatus int
const (
CertificationStatusPending CertificationStatus = 1 // 待审核
CertificationStatusPass CertificationStatus = 2 // 审核通过
CertificationStatusFail CertificationStatus = 3 // 审核失败
CertificationStatusUnverified CertificationStatus = 4 // 未认证
)
type CertificationStatusKeyValue struct {
Key CertificationStatus // 对应原有常量值
Value string // 对应描述信息
}
// 定义枚举实例Key-Value 绑定),相当于改造后的常量
var (
CertificationStatusPendingKeyValue = CertificationStatusKeyValue{Key: CertificationStatusPending, Value: "待审核"}
CertificationStatusPassKeyValue = CertificationStatusKeyValue{Key: CertificationStatusPass, Value: "审核通过"}
CertificationStatusFailKeyValue = CertificationStatusKeyValue{Key: CertificationStatusFail, Value: "审核失败"}
CertificationStatusUnverifiedKeyValue = CertificationStatusKeyValue{Key: CertificationStatusUnverified, Value: "未认证"}
)
var certificationStatusMap = map[CertificationStatus]CertificationStatusKeyValue{
CertificationStatusPending: CertificationStatusPendingKeyValue,
CertificationStatusPass: CertificationStatusPassKeyValue,
CertificationStatusFail: CertificationStatusFailKeyValue,
CertificationStatusUnverified: CertificationStatusUnverifiedKeyValue,
}
// GetCertificationStatusKeyValue 根据 CertificationStatus 指针获取对应的 KeyValue
func GetCertificationStatusKeyValue(status CertificationStatus) CertificationStatusKeyValue {
if kv, ok := certificationStatusMap[status]; ok {
return kv
}
return CertificationStatusUnverifiedKeyValue
}

View File

@@ -0,0 +1,22 @@
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var (
AreaDict = areaDictController{}
)
type areaDictController struct {
BaseController
}
// List 用户列表
func (c *areaDictController) List(ctx context.Context, req *system.AreaDictListReq) (res *system.AreaDictListRes, err error) {
res, err = service.AreaDict().GetAreaDictListSearch(ctx, req)
return
}

View File

@@ -0,0 +1,22 @@
/*
* @desc:system base controller
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/3/4 18:12
*/
package controller
import (
"github.com/gogf/gf/v2/net/ghttp"
commonController "github.com/tiger1103/gfast/v3/internal/app/common/controller"
)
type BaseController struct {
commonController.BaseController
}
// Init 自动执行的初始化方法
func (c *BaseController) Init(r *ghttp.Request) {
c.BaseController.Init(r)
}

View File

@@ -0,0 +1,61 @@
/*
* @desc:缓存处理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2023/2/1 18:14
*/
package controller
import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/frame/g"
"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"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
)
var Cache = new(cacheController)
type cacheController struct {
BaseController
}
func (c *cacheController) Remove(ctx context.Context, req *system.CacheRemoveReq) (res *system.CacheRemoveRes, err error) {
service.Cache().RemoveByTag(ctx, commonConsts.CacheSysDictTag)
service.Cache().RemoveByTag(ctx, commonConsts.CacheSysConfigTag)
service.Cache().RemoveByTag(ctx, consts.CacheSysAuthTag)
cacheRedis := g.Cfg().MustGet(ctx, "system.cache.model").String()
if cacheRedis == commonConsts.CacheModelRedis {
cursor := 0
cachePrefix := g.Cfg().MustGet(ctx, "system.cache.prefix").String()
cachePrefix += commonConsts.CachePrefix
for {
var v *gvar.Var
v, err = g.Redis().Do(ctx, "scan", cursor, "match", cachePrefix+"*", "count", "100")
if err != nil {
return
}
data := gconv.SliceAny(v)
var dataSlice []string
err = gconv.Structs(data[1], &dataSlice)
if err != nil {
return
}
for _, d := range dataSlice {
_, err = g.Redis().Do(ctx, "del", d)
if err != nil {
return
}
}
cursor = gconv.Int(data[0])
if cursor == 0 {
break
}
}
}
return
}

View File

@@ -0,0 +1,27 @@
/*
* @desc:模块租户关系控制器
* @company:云南奇讯科技有限公司
* @Author: system
* @Date: 2026/1/6
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var ModuleTenant = moduleTenantController{}
type moduleTenantController struct {
BaseController
}
// Add 添加模块租户关系
func (c *moduleTenantController) Add(ctx context.Context, req *system.ModuleTenantAddReq) (res *system.ModuleTenantAddRes, err error) {
err = service.ModuleTenant().Add(ctx, req)
return
}

View File

@@ -0,0 +1,50 @@
/*
* @desc:xxxx功能描述
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/11/3 10:32
*/
package controller
import (
"context"
"github.com/gogf/gf/v2/crypto/gmd5"
"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/system/service"
"github.com/tiger1103/gfast/v3/library/libUtils"
)
var Personal = new(personalController)
type personalController struct {
}
func (c *personalController) GetPersonal(ctx context.Context, req *system.PersonalInfoReq) (res *system.PersonalInfoRes, err error) {
res, err = service.Personal().GetPersonalInfo(ctx, req)
return
}
func (c *personalController) EditPersonal(ctx context.Context, req *system.PersonalEditReq) (res *system.PersonalEditRes, err error) {
ip := libUtils.GetClientIp(ctx)
userAgent := libUtils.GetUserAgent(ctx)
res = new(system.PersonalEditRes)
res.UserInfo, err = service.Personal().EditPersonal(ctx, req)
if err != nil {
return
}
key := gconv.String(res.UserInfo.Id) + "-" + gmd5.MustEncryptString(res.UserInfo.UserName) + gmd5.MustEncryptString(res.UserInfo.UserPassword)
if g.Cfg().MustGet(ctx, "gfToken.multiLogin").Bool() {
key = gconv.String(res.UserInfo.Id) + "-" + gmd5.MustEncryptString(res.UserInfo.UserName) + gmd5.MustEncryptString(res.UserInfo.UserPassword+ip+userAgent)
}
res.UserInfo.UserPassword = ""
res.Token, err = service.GfToken().GenerateToken(ctx, key, res.UserInfo)
return
}
func (c *personalController) ResetPwdPersonal(ctx context.Context, req *system.PersonalResetPwdReq) (res *system.PersonalResetPwdRes, err error) {
res, err = service.Personal().ResetPwdPersonal(ctx, req)
return
}

View File

@@ -0,0 +1,79 @@
/*
* @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/model"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var Menu = menuController{}
type menuController struct {
BaseController
}
func (c *menuController) List(ctx context.Context, req *system.RuleSearchReq) (res *system.RuleListRes, err error) {
var list []*model.SysAuthRuleInfoRes
res = &system.RuleListRes{
Rules: make([]*model.SysAuthRuleTreeRes, 0),
}
list, err = service.SysAuthRule().GetMenuListSearch(ctx, req)
if req.Title != "" || req.Component != "" {
for _, menu := range list {
res.Rules = append(res.Rules, &model.SysAuthRuleTreeRes{
SysAuthRuleInfoRes: menu,
})
}
} else {
res.Rules = service.SysAuthRule().GetMenuListTree(0, list)
}
return
}
func (c *menuController) Add(ctx context.Context, req *system.RuleAddReq) (res *system.RuleAddRes, err error) {
err = service.SysAuthRule().Add(ctx, req)
return
}
// GetAddParams 获取菜单添加及编辑相关参数
func (c *menuController) GetAddParams(ctx context.Context, req *system.RuleGetParamsReq) (res *system.RuleGetParamsRes, err error) {
// 获取角色列表
res = new(system.RuleGetParamsRes)
res.Roles, err = service.SysRole().GetRoleList(ctx)
if err != nil {
return
}
res.Menus, err = service.SysAuthRule().GetIsMenuList(ctx)
return
}
// Get 获取菜单信息
func (c *menuController) Get(ctx context.Context, req *system.RuleInfoReq) (res *system.RuleInfoRes, err error) {
res = new(system.RuleInfoRes)
res.Rule, err = service.SysAuthRule().Get(ctx, req.Id)
if err != nil {
return
}
res.RoleIds, err = service.SysAuthRule().GetMenuRoles(ctx, req.Id)
return
}
// Update 菜单修改
func (c *menuController) Update(ctx context.Context, req *system.RuleUpdateReq) (res *system.RuleUpdateRes, err error) {
err = service.SysAuthRule().Update(ctx, req)
return
}
// Delete 删除菜单
func (c *menuController) Delete(ctx context.Context, req *system.RuleDeleteReq) (res *system.RuleDeleteRes, err error) {
err = service.SysAuthRule().DeleteMenuByIds(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,51 @@
/*
* @desc:系统参数配置
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/4/18 21:17
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
commonService "github.com/tiger1103/gfast/v3/internal/app/common/service"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var Config = configController{}
type configController struct {
BaseController
}
// List 系统参数列表
func (c *configController) List(ctx context.Context, req *system.ConfigSearchReq) (res *system.ConfigSearchRes, err error) {
res, err = commonService.SysConfig().List(ctx, req)
return
}
// Add 添加系统参数
func (c *configController) Add(ctx context.Context, req *system.ConfigAddReq) (res *system.ConfigAddRes, err error) {
err = commonService.SysConfig().Add(ctx, req, service.Context().GetUserId(ctx))
return
}
// Get 获取系统参数
func (c *configController) Get(ctx context.Context, req *system.ConfigGetReq) (res *system.ConfigGetRes, err error) {
res, err = commonService.SysConfig().Get(ctx, req.Id)
return
}
// Edit 修改系统参数
func (c *configController) Edit(ctx context.Context, req *system.ConfigEditReq) (res *system.ConfigEditRes, err error) {
err = commonService.SysConfig().Edit(ctx, req, service.Context().GetUserId(ctx))
return
}
// Delete 删除系统参数
func (c *configController) Delete(ctx context.Context, req *system.ConfigDeleteReq) (res *system.ConfigDeleteRes, err error) {
err = commonService.SysConfig().Delete(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,60 @@
/*
* @desc:部门管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/4/6 15:15
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var Dept = sysDeptController{}
type sysDeptController struct {
BaseController
}
// List 部门列表
func (c *sysDeptController) List(ctx context.Context, req *system.DeptSearchReq) (res *system.DeptSearchRes, err error) {
res = new(system.DeptSearchRes)
res.DeptList, err = service.SysDept().GetList(ctx, req)
return
}
// Add 添加部门
func (c *sysDeptController) Add(ctx context.Context, req *system.DeptAddReq) (res *system.DeptAddRes, err error) {
_, err = service.SysDept().Add(ctx, req)
return
}
// Edit 修改部门
func (c *sysDeptController) Edit(ctx context.Context, req *system.DeptEditReq) (res *system.DeptEditRes, err error) {
err = service.SysDept().Edit(ctx, req)
return
}
// Delete 删除部门
func (c *sysDeptController) Delete(ctx context.Context, req *system.DeptDeleteReq) (res *system.DeptDeleteRes, err error) {
err = service.SysDept().Delete(ctx, req.Id)
return
}
// TreeSelect 获取部门数据结构数据
func (c *sysDeptController) TreeSelect(ctx context.Context, req *system.DeptTreeSelectReq) (res *system.DeptTreeSelectRes, err error) {
var deptList []*entity.SysDept
deptList, err = service.SysDept().GetList(ctx, &system.DeptSearchReq{
Status: "1", //正常状态数据
})
if err != nil {
return
}
res = new(system.DeptTreeSelectRes)
res.Deps = service.SysDept().GetListTree(0, deptList)
return
}

View File

@@ -0,0 +1,61 @@
/*
* @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"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var DictData = dictDataController{}
type dictDataController struct {
}
// GetDictDataTree 根据remark获取字典数据树形结构
func (c *dictDataController) GetDictDataTree(ctx context.Context, req *system.GetDictTreeReq) (res *system.GetDictTreeRes, err error) {
res, err = commonService.SysDictData().GetDictDataTree(ctx, req.Remark)
return
}
// GetDictData 获取字典数据
func (c *dictDataController) GetDictData(ctx context.Context, req *system.GetDictReq) (res *system.GetDictRes, err error) {
res, err = commonService.SysDictData().GetDictWithDataByType(ctx, req)
return
}
// List 获取字典数据列表
func (c *dictDataController) List(ctx context.Context, req *system.DictDataSearchReq) (res *system.DictDataSearchRes, err error) {
res, err = commonService.SysDictData().List(ctx, req)
return
}
// Add 添加字典数据
func (c *dictDataController) Add(ctx context.Context, req *system.DictDataAddReq) (res *system.DictDataAddRes, err error) {
err = commonService.SysDictData().Add(ctx, req, service.Context().GetUserId(ctx))
return
}
// Get 获取对应的字典数据
func (c *dictDataController) Get(ctx context.Context, req *system.DictDataGetReq) (res *system.DictDataGetRes, err error) {
res, err = commonService.SysDictData().Get(ctx, req.DictCode)
return
}
// Edit 修改字典数据
func (c *dictDataController) Edit(ctx context.Context, req *system.DictDataEditReq) (res *system.DictDataEditRes, err error) {
err = commonService.SysDictData().Edit(ctx, req, service.Context().GetUserId(ctx))
return
}
func (c *dictDataController) Delete(ctx context.Context, req *system.DictDataDeleteReq) (res *system.DictDataDeleteRes, err error) {
err = commonService.SysDictData().Delete(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,57 @@
/*
* @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"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var DictType = &SysDictTypeController{}
type SysDictTypeController struct {
}
// List 字典类型列表
func (c *SysDictTypeController) List(ctx context.Context, req *system.DictTypeSearchReq) (res *system.DictTypeSearchRes, err error) {
res, err = commonService.SysDictType().List(ctx, req)
return
}
// Add 添加字典类型
func (c *SysDictTypeController) Add(ctx context.Context, req *system.DictTypeAddReq) (res *system.DictTypeAddRes, err error) {
err = commonService.SysDictType().Add(ctx, req, service.Context().GetUserId(ctx))
return
}
// Get 获取字典类型
func (c *SysDictTypeController) Get(ctx context.Context, req *system.DictTypeGetReq) (res *system.DictTypeGetRes, err error) {
res = new(system.DictTypeGetRes)
res.DictType, err = commonService.SysDictType().Get(ctx, req)
return
}
// Edit 修改字典数据
func (c *SysDictTypeController) Edit(ctx context.Context, req *system.DictTypeEditReq) (res *system.DictTypeEditRes, err error) {
err = commonService.SysDictType().Edit(ctx, req, service.Context().GetUserId(ctx))
return
}
func (c *SysDictTypeController) Delete(ctx context.Context, req *system.DictTypeDeleteReq) (res *system.DictTypeDeleteRes, err error) {
err = commonService.SysDictType().Delete(ctx, req.DictIds)
return
}
// OptionSelect 获取字典选择框列表
func (c *SysDictTypeController) OptionSelect(ctx context.Context, req *system.DictTypeAllReq) (res *system.DictTYpeAllRes, err error) {
res = new(system.DictTYpeAllRes)
res.DictType, err = commonService.SysDictType().GetAllDictType(ctx)
return
}

View File

@@ -0,0 +1,119 @@
/*
* @desc:登录
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/4/27 21:52
*/
package controller
import (
"context"
"github.com/gogf/gf/v2/crypto/gmd5"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/gmode"
"github.com/tiger1103/gfast/v3/api/v1/system"
commonService "github.com/tiger1103/gfast/v3/internal/app/common/service"
"github.com/tiger1103/gfast/v3/internal/app/system/model"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
"github.com/tiger1103/gfast/v3/library/libUtils"
)
var (
Login = loginController{}
)
type loginController struct {
BaseController
}
func (c *loginController) Login(ctx context.Context, req *system.UserLoginReq) (res *system.UserLoginRes, err error) {
var (
user *model.LoginUserRes
token string
permissions []string
menuList []*model.UserMenus
)
//判断验证码是否正确
debug := gmode.IsDevelop()
if !debug {
if !commonService.Captcha().VerifyString(req.VerifyKey, req.VerifyCode) {
err = gerror.New("验证码输入错误")
return
}
}
ip := libUtils.GetClientIp(ctx)
userAgent := libUtils.GetUserAgent(ctx)
user, err = service.SysUser().GetAdminUserByUsernamePassword(ctx, req)
if err != nil {
// 保存登录失败的日志信息
service.SysLoginLog().Invoke(gctx.New(), &model.LoginLogParams{
Status: 0,
Username: req.Username,
Ip: ip,
UserAgent: userAgent,
Msg: err.Error(),
Module: "系统后台",
})
return
}
err = service.SysUser().UpdateLoginInfo(ctx, user.Id, ip)
if err != nil {
return
}
// 报存登录成功的日志信息
service.SysLoginLog().Invoke(gctx.New(), &model.LoginLogParams{
Status: 1,
Username: req.Username,
Ip: ip,
UserAgent: userAgent,
Msg: "登录成功",
Module: "系统后台",
})
key := gconv.String(user.Id) + "-" + gmd5.MustEncryptString(user.UserName) + gmd5.MustEncryptString(user.UserPassword)
if g.Cfg().MustGet(ctx, "gfToken.multiLogin").Bool() {
key = gconv.String(user.Id) + "-" + gmd5.MustEncryptString(user.UserName) + gmd5.MustEncryptString(user.UserPassword+ip+userAgent)
}
user.UserPassword = ""
token, err = service.GfToken().GenerateToken(ctx, key, user)
g.Log().Debugf(ctx, "==========================key:%v;user:%v;token:%v==========================", key, user, token)
if err != nil {
g.Log().Error(ctx, err)
err = gerror.New("登录失败,后端服务出现错误")
return
}
_, err = service.ModuleTenant().AddRedisByTenantId(ctx, &system.AddRedisByTenantIdReq{TenantId: user.TenantId})
if err != nil {
return
}
//获取用户菜单数据
menuList, permissions, err = service.SysUser().GetAdminRules(ctx, user.Id)
if err != nil {
return
}
res = &system.UserLoginRes{
UserInfo: user,
Token: token,
MenuList: menuList,
Permissions: permissions,
}
//用户在线状态保存
service.SysUserOnline().Invoke(gctx.New(), &model.SysUserOnlineParams{
UserAgent: userAgent,
Uuid: gmd5.MustEncrypt(token),
Token: token,
Username: user.UserName,
Ip: ip,
})
return
}
// LoginOut 退出登录
func (c *loginController) LoginOut(ctx context.Context, req *system.UserLoginOutReq) (res *system.UserLoginOutRes, err error) {
err = service.GfToken().RemoveToken(ctx, service.GfToken().GetRequestToken(g.RequestFromCtx(ctx)))
return
}

View File

@@ -0,0 +1,35 @@
/*
* @desc:登录日志管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/4/24 22:14
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var LoginLog = loginLogController{}
type loginLogController struct {
BaseController
}
func (c *loginLogController) List(ctx context.Context, req *system.LoginLogSearchReq) (res *system.LoginLogSearchRes, err error) {
res, err = service.SysLoginLog().List(ctx, req)
return
}
func (c *loginLogController) Delete(ctx context.Context, req *system.LoginLogDelReq) (res *system.LoginLogDelRes, err error) {
err = service.SysLoginLog().DeleteLoginLogByIds(ctx, req.Ids)
return
}
func (c *loginLogController) Clear(ctx context.Context, req *system.LoginLogClearReq) (res *system.LoginLogClearRes, err error) {
err = service.SysLoginLog().ClearLoginLog(ctx)
return
}

View File

@@ -0,0 +1,147 @@
package controller
import (
"context"
"fmt"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/host"
"github.com/shirou/gopsutil/v3/load"
"github.com/shirou/gopsutil/v3/mem"
"github.com/shirou/gopsutil/v3/process"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/library/libUtils"
"os"
"runtime"
"strconv"
"time"
)
var Monitor = sysMonitorController{
startTime: gtime.Now(),
}
type sysMonitorController struct {
BaseController
startTime *gtime.Time
}
func (c *sysMonitorController) List(ctx context.Context, req *system.MonitorSearchReq) (res *system.MonitorSearchRes, err error) {
cpuNum := runtime.NumCPU() //核心数
var cpuUsed float64 = 0 //用户使用率
var cpuAvg5 float64 = 0 //CPU负载5
var cpuAvg15 float64 = 0 //当前空闲率
cpuInfo, err := cpu.Percent(time.Duration(time.Second), false)
if err == nil {
cpuUsed, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cpuInfo[0]), 64)
}
loadInfo, err := load.Avg()
if err == nil {
cpuAvg5, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", loadInfo.Load5), 64)
cpuAvg15, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", loadInfo.Load5), 64)
}
var memTotal uint64 = 0 //总内存
var memUsed uint64 = 0 //总内存 := 0 //已用内存
var memFree uint64 = 0 //剩余内存
var memUsage float64 = 0 //使用率
v, err := mem.VirtualMemory()
if err == nil {
memTotal = v.Total
memUsed = v.Used
memFree = memTotal - memUsed
memUsage, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.UsedPercent), 64)
}
var goTotal uint64 = 0 //go分配的总内存数
var goUsed uint64 = 0 //go使用的内存数
var goFree uint64 = 0 //go剩余的内存数
var goUsage float64 = 0 //使用率
p, err := process.NewProcess(int32(os.Getpid()))
if err == nil {
memInfo, err := p.MemoryInfo()
if err == nil {
goUsed = memInfo.RSS
goUsage = gconv.Float64(fmt.Sprintf("%.2f", gconv.Float64(goUsed)/gconv.Float64(memTotal)*100))
}
}
sysComputerIp := "" //服务器IP
ip, err := libUtils.GetLocalIP()
if err == nil {
sysComputerIp = ip
}
sysComputerName := "" //服务器名称
sysOsName := "" //操作系统
sysOsArch := "" //系统架构
sysInfo, err := host.Info()
if err == nil {
sysComputerName = sysInfo.Hostname
sysOsName = sysInfo.OS
sysOsArch = sysInfo.KernelArch
}
goName := "GoLang" //语言环境
goVersion := runtime.Version() //版本
gtime.Date()
goStartTime := c.startTime //启动时间
goRunTime := gtime.Now().Timestamp() - c.startTime.Timestamp() //运行时长(秒)
goHome := runtime.GOROOT() //安装路径
goUserDir := "" //项目路径
curDir, err := os.Getwd()
if err == nil {
goUserDir = curDir
}
//服务器磁盘信息
diskList := make([]disk.UsageStat, 0)
diskInfo, err := disk.Partitions(true) //所有分区
if err == nil {
for _, p := range diskInfo {
diskDetail, err := disk.Usage(p.Mountpoint)
if err == nil {
diskDetail.UsedPercent, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", diskDetail.UsedPercent), 64)
diskList = append(diskList, *diskDetail)
}
}
}
res = new(system.MonitorSearchRes)
res = &system.MonitorSearchRes{
"cpuNum": cpuNum,
"cpuUsed": cpuUsed,
"cpuAvg5": gconv.String(cpuAvg5),
"cpuAvg15": gconv.String(cpuAvg15),
"memTotal": memTotal,
"goTotal": goTotal,
"memUsed": memUsed,
"goUsed": goUsed,
"memFree": memFree,
"goFree": goFree,
"memUsage": memUsage,
"goUsage": goUsage,
"sysComputerName": sysComputerName,
"sysOsName": sysOsName,
"sysComputerIp": sysComputerIp,
"sysOsArch": sysOsArch,
"goName": goName,
"goVersion": goVersion,
"goStartTime": goStartTime,
"goRunTime": goRunTime,
"goHome": goHome,
"goUserDir": goUserDir,
"diskList": diskList,
}
return
}

View File

@@ -0,0 +1,43 @@
/*
* @desc:系统后台操作日志
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/9/21 16:10
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var OperLog = new(operateLogController)
type operateLogController struct {
BaseController
}
// List 列表
func (c *operateLogController) List(ctx context.Context, req *system.SysOperLogSearchReq) (res *system.SysOperLogSearchRes, err error) {
res, err = service.OperateLog().List(ctx, req)
return
}
// Get 获取操作日志
func (c *operateLogController) Get(ctx context.Context, req *system.SysOperLogGetReq) (res *system.SysOperLogGetRes, err error) {
res = new(system.SysOperLogGetRes)
res.SysOperLogInfoRes, err = service.OperateLog().GetByOperId(ctx, req.OperId)
return
}
func (c *operateLogController) Delete(ctx context.Context, req *system.SysOperLogDeleteReq) (res *system.SysOperLogDeleteRes, err error) {
err = service.OperateLog().DeleteByIds(ctx, req.OperIds)
return
}
func (c *operateLogController) Clear(ctx context.Context, req *system.SysOperLogClearReq) (res *system.SysOperLogClearRes, err error) {
err = service.OperateLog().ClearLog(ctx)
return
}

View File

@@ -0,0 +1,44 @@
/*
* @desc:岗位管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu
* @Date: 2022/4/7 23:12
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var Post = postController{}
type postController struct {
BaseController
}
// List 岗位列表
func (c *postController) List(ctx context.Context, req *system.PostSearchReq) (res *system.PostSearchRes, err error) {
res, err = service.SysPost().List(ctx, req)
return
}
// Add 添加岗位
func (c *postController) Add(ctx context.Context, req *system.PostAddReq) (res *system.PostAddRes, err error) {
err = service.SysPost().Add(ctx, req)
return
}
// Edit 修改岗位
func (c *postController) Edit(ctx context.Context, req *system.PostEditReq) (res *system.PostEditRes, err error) {
err = service.SysPost().Edit(ctx, req)
return
}
// Delete 删除岗位
func (c *postController) Delete(ctx context.Context, req *system.PostDeleteReq) (res *system.PostDeleteRes, err error) {
err = service.SysPost().Delete(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,69 @@
/*
* @desc:角色管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2022/3/30 9:08
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var Role = roleController{}
type roleController struct {
BaseController
}
// List 角色列表
func (c *roleController) List(ctx context.Context, req *system.RoleListReq) (res *system.RoleListRes, err error) {
res, err = service.SysRole().GetRoleListSearch(ctx, req)
return
}
// GetParams 获取角色表单参数
func (c *roleController) GetParams(ctx context.Context, req *system.RoleGetParamsReq) (res *system.RoleGetParamsRes, err error) {
res = new(system.RoleGetParamsRes)
res.Menu, err = service.SysAuthRule().GetMenuList(ctx)
return
}
// GetParamsInfo 获取角色表单参数信息
func (c *roleController) GetParamsInfo(ctx context.Context, req *system.RoleGetParamsInfoReq) (res *system.RoleGetParamsRes, err error) {
res = new(system.RoleGetParamsRes)
res.Menu, err = service.SysAuthRule().GetMenuListByRole(ctx)
return
}
// Add 添加角色信息
func (c *roleController) Add(ctx context.Context, req *system.RoleAddReq) (res *system.RoleAddRes, err error) {
err = service.SysRole().AddRole(ctx, req)
return
}
// Get 获取角色信息
func (c *roleController) Get(ctx context.Context, req *system.RoleGetReq) (res *system.RoleGetRes, err error) {
res = new(system.RoleGetRes)
res.Role, err = service.SysRole().Get(ctx, req.Id)
if err != nil {
return
}
res.MenuIds, err = service.SysRole().GetFilteredNamedPolicy(ctx, req.Id)
return
}
// Edit 修改角色信息
func (c *roleController) Edit(ctx context.Context, req *system.RoleEditReq) (res *system.RoleEditRes, err error) {
err = service.SysRole().EditRole(ctx, req)
return
}
// Delete 删除角色
func (c *roleController) Delete(ctx context.Context, req *system.RoleDeleteReq) (res *system.RoleDeleteRes, err error) {
err = service.SysRole().DeleteByIds(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,137 @@
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/model"
"github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var (
User = userController{}
)
type userController struct {
BaseController
}
// GetUserMenus 获取用户菜单及按钮权限
func (c *userController) GetUserMenus(ctx context.Context, req *system.UserMenusReq) (res *system.UserMenusRes, err error) {
var (
permissions []string
menuList []*model.UserMenus
)
userId := service.Context().GetUserId(ctx)
menuList, permissions, err = service.SysUser().GetAdminRules(ctx, userId)
res = &system.UserMenusRes{
MenuList: menuList,
Permissions: permissions,
}
return
}
// List 用户列表
func (c *userController) List(ctx context.Context, req *system.UserSearchReq) (res *system.UserSearchRes, err error) {
var (
total interface{}
userList []*entity.SysUser
)
res = new(system.UserSearchRes)
total, userList, err = service.SysUser().List(ctx, req)
if err != nil || total == 0 {
return
}
res.Total = total
res.UserList, err = service.SysUser().GetUsersRoleDept(ctx, userList)
return
}
// GetList 用户列表
func (c *userController) GetList(ctx context.Context, req *system.GetUserSearchReq) (res *system.UserSearchRes, err error) {
var (
total interface{}
userList []*entity.SysUser
)
res = new(system.UserSearchRes)
total, userList, err = service.SysUser().GetList(ctx, req)
if err != nil || total == 0 {
return
}
res.Total = total
res.UserList, err = service.SysUser().GetUsersRoleDeptInfo(ctx, userList)
res.UserList, err = service.SysUser().GetTenantInfo(ctx, res.UserList)
return
}
// GetParams 获取用户维护相关参数
func (c *userController) GetParams(ctx context.Context, req *system.UserGetParamsReq) (res *system.UserGetParamsRes, err error) {
res = new(system.UserGetParamsRes)
res.RoleList, err = service.SysRole().GetRoleList(ctx)
if err != nil {
return
}
res.Posts, err = service.SysPost().GetUsedPost(ctx)
return
}
// GetParamsInfo 获取用户维护相关参数信息
func (c *userController) GetParamsInfo(ctx context.Context, req *system.UserGetParamsInfoReq) (res *system.UserGetParamsRes, err error) {
res = new(system.UserGetParamsRes)
res.RoleList, err = service.SysRole().GetRoleListInfo(ctx)
if err != nil {
return
}
res.Posts, err = service.SysPost().GetUsedPost(ctx)
return
}
// Add 添加用户
func (c *userController) Add(ctx context.Context, req *system.UserAddReq) (res *system.UserAddRes, err error) {
_, err = service.SysUser().Add(ctx, req)
return
}
// GetEditUser 获取修改用户信息
func (c *userController) GetEditUser(ctx context.Context, req *system.UserGetEditReq) (res *system.UserGetEditRes, err error) {
res, err = service.SysUser().GetEditUser(ctx, req.Id)
return
}
// Edit 修改用户
func (c *userController) Edit(ctx context.Context, req *system.UserEditReq) (res *system.UserEditRes, err error) {
err = service.SysUser().Edit(ctx, req)
return
}
// ResetPwd 重置密码
func (c *userController) ResetPwd(ctx context.Context, req *system.UserResetPwdReq) (res *system.UserResetPwdRes, err error) {
err = service.SysUser().ResetUserPwd(ctx, req)
return
}
// SetStatus 修改用户状态
func (c *userController) SetStatus(ctx context.Context, req *system.UserStatusReq) (res *system.UserStatusRes, err error) {
err = service.SysUser().ChangeUserStatus(ctx, req)
return
}
// Delete 删除用户
func (c *userController) Delete(ctx context.Context, req *system.UserDeleteReq) (res *system.UserDeleteRes, err error) {
err = service.SysUser().Delete(ctx, req.Ids)
return
}
// GetUsers 通过用户id批量获取用户信息
func (c *userController) GetUsers(ctx context.Context, req *system.UserGetByIdsReq) (res *system.UserGetByIdsRes, err error) {
res = new(system.UserGetByIdsRes)
res.List, err = service.SysUser().GetUsers(ctx, req.Ids)
return
}
func (c *userController) IsSuperAdmin(ctx context.Context, req *system.IsSuperAdminReq) (IsSuperAdminRes *system.IsSuperAdminRes, err error) {
IsSuperAdminRes = new(system.IsSuperAdminRes)
IsSuperAdminRes.IsSuperAdmin, err = service.SysUser().IsSuperAdmin(ctx, req)
return
}

View File

@@ -0,0 +1,28 @@
/*
* @desc:在线用户管理
* @company:云南奇讯科技有限公司
* @Author: yixiaohu<yxh669@qq.com>
* @Date: 2023/1/10 17:23
*/
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var UserOnline = new(SysUserOnlineController)
type SysUserOnlineController struct{}
func (c *SysUserOnlineController) List(ctx context.Context, req *system.SysUserOnlineSearchReq) (res *system.SysUserOnlineSearchRes, err error) {
res, err = service.SysUserOnline().GetOnlineListPage(ctx, req)
return
}
func (c *SysUserOnlineController) ForceLogout(ctx context.Context, req *system.SysUserOnlineForceLogoutReq) (res *system.SysUserOnlineForceLogoutRes, err error) {
err = service.SysUserOnline().ForceLogout(ctx, req.Ids)
return
}

View File

@@ -0,0 +1,57 @@
package controller
import (
"context"
"github.com/tiger1103/gfast/v3/api/v1/system"
"github.com/tiger1103/gfast/v3/internal/app/system/service"
)
var (
Tenant = tenantController{}
)
type tenantController struct {
BaseController
}
// List 用户列表
func (c *tenantController) List(ctx context.Context, req *system.TenantListReq) (res *system.TenantListRes, err error) {
res, err = service.Tenant().GetTenantListSearch(ctx, req)
return
}
// Add 添加用户
func (c *tenantController) Add(ctx context.Context, req *system.TenantAddReq) (res *system.TenantAddRes, err error) {
err = service.Tenant().Add(ctx, req)
return
}
// Edit 修改租户
func (c *tenantController) Edit(ctx context.Context, req *system.TenantEditReq) (res *system.TenantEditRes, err error) {
err = service.Tenant().Edit(ctx, req)
return
}
func (c *tenantController) GetTenantDetailsByIds(ctx context.Context, req *system.GetTenantDetailsByIdsReq) (res *system.GetTenantDetailsByIdsRes, err error) {
res, err = service.Tenant().GetTenantDetailsByIds(ctx, req)
return
}
func (c *tenantController) GetTenantDetails(ctx context.Context, req *system.GetTenantDetailsReq) (res *system.GetTenantDetailsRes, err error) {
res = new(system.GetTenantDetailsRes)
res.Tenant, err = service.Tenant().GetTenantDetails(ctx, req.TenantId)
return
}
func (c *tenantController) GetTenantAdminById(ctx context.Context, req *system.GetTenantDetailsReq) (res *system.GetTenantListRes, err error) {
res = new(system.GetTenantListRes)
res.List, err = service.Tenant().GetTenantAdminById(ctx, req.TenantId)
return
}
func (c *tenantController) GetTenantList(ctx context.Context, req *system.GetTenantListReq) (res *system.GetTenantListRes, err error) {
res = new(system.GetTenantListRes)
res.List, err = service.Tenant().GetTenantIdList(ctx, req)
return
}

View File

@@ -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/system/dao/internal"
)
// areaDictDao is the data access object for table sys_user.
// You can define custom methods on it to extend its functionality as you wish.
type areaDictDao struct {
*internal.AreaDictDao
}
var (
// AreaDictDao is globally public accessible object for table sys_user operations.
AreaDictDao = areaDictDao{
internal.NewAreaDictDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,83 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-02 16:48:23
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// AreaDictDao is the data access object for table sys_user.
type AreaDictDao 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 AreaDictColumns // columns contains all the column names of Table for convenient usage.
}
// AreaDictColumns defines and stores column names for table sys_user.
type AreaDictColumns struct {
Id string //
CityName string // 城市名称
ParentId string // 父级id
ShortName string // 城市缩写名称
Depth string // 城市层级
MergerName string // 城市组合名称
}
// areaDictColumns holds the columns for table sys_user.
var areaDictColumns = AreaDictColumns{
Id: "id",
CityName: "city_name",
ParentId: "parent_id",
ShortName: "short_name",
Depth: "depth",
MergerName: "merger_name",
}
// NewAreaDictDao creates and returns a new DAO object for table data access.
func NewAreaDictDao() *AreaDictDao {
return &AreaDictDao{
group: "default",
table: "area_dict",
columns: areaDictColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *AreaDictDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *AreaDictDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *AreaDictDao) Columns() AreaDictColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *AreaDictDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *AreaDictDao) 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 *AreaDictDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,95 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2026-01-06
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// ModuleTenantDao is the data access object for table module_tenant.
type ModuleTenantDao 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 ModuleTenantColumns // columns contains all the column names of Table for convenient usage.
}
// ModuleTenantColumns defines and stores column names for table module_tenant.
type ModuleTenantColumns struct {
Id string //
CreateBy string // 创建者
UpdateBy string // 更新者
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
ModuleKey string // 模块Key
TenantId string // 租户ID
ExpireAt string // 到期时间
AssetId string // 资产ID
AssetSkuId string // 资产SKU ID
TenantModuleType string // 租户模块类型
CertificationStatus string // 状态
}
// moduleTenantColumns holds the columns for table module_tenant.
var moduleTenantColumns = ModuleTenantColumns{
Id: "id",
CreateBy: "create_by",
UpdateBy: "update_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
ModuleKey: "module_key",
TenantId: "tenant_id",
ExpireAt: "expire_at",
AssetId: "asset_id",
AssetSkuId: "asset_sku_id",
TenantModuleType: "tenant_module_type",
CertificationStatus: "certification_status",
}
// NewModuleTenantDao creates and returns a new DAO object for table data access.
func NewModuleTenantDao() *ModuleTenantDao {
return &ModuleTenantDao{
group: "default",
table: "module_tenant",
columns: moduleTenantColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ModuleTenantDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *ModuleTenantDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *ModuleTenantDao) Columns() ModuleTenantColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *ModuleTenantDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ModuleTenantDao) 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 *ModuleTenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,114 @@
// ==========================================================================
// 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"
)
// SysAuthRuleDao is the data access object for table sys_auth_rule.
type SysAuthRuleDao 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 SysAuthRuleColumns // columns contains all the column names of Table for convenient usage.
}
// SysAuthRuleColumns defines and stores column names for table sys_auth_rule.
type SysAuthRuleColumns struct {
Id string //
Pid string // 父ID
Name string // 规则名称
Title string // 规则名称
Icon string // 图标
Condition string // 条件
Remark string // 备注
MenuType string // 类型 0目录 1菜单 2按钮
Weigh string // 权重
IsHide string // 显示状态
Path string // 路由地址
Component string // 组件路径
IsLink string // 是否外链 1是 0否
ModuleType string // 所属模块
ModelId string // 模型ID
IsIframe string // 是否内嵌iframe
IsCached string // 是否缓存
Redirect string // 路由重定向地址
IsAffix string // 是否固定
LinkUrl string // 链接地址
CreatedAt string // 创建日期
UpdatedAt string // 修改日期
}
// sysAuthRuleColumns holds the columns for table sys_auth_rule.
var sysAuthRuleColumns = SysAuthRuleColumns{
Id: "id",
Pid: "pid",
Name: "name",
Title: "title",
Icon: "icon",
Condition: "condition",
Remark: "remark",
MenuType: "menu_type",
Weigh: "weigh",
IsHide: "is_hide",
Path: "path",
Component: "component",
IsLink: "is_link",
ModuleType: "module_type",
ModelId: "model_id",
IsIframe: "is_iframe",
IsCached: "is_cached",
Redirect: "redirect",
IsAffix: "is_affix",
LinkUrl: "link_url",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysAuthRuleDao creates and returns a new DAO object for table data access.
func NewSysAuthRuleDao() *SysAuthRuleDao {
return &SysAuthRuleDao{
group: "default",
table: "sys_auth_rule",
columns: sysAuthRuleColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysAuthRuleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysAuthRuleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysAuthRuleDao) Columns() SysAuthRuleColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysAuthRuleDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysAuthRuleDao) 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 *SysAuthRuleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,98 @@
// ==========================================================================
// 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"
)
// SysDeptDao is the data access object for table sys_dept.
type SysDeptDao 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 SysDeptColumns // columns contains all the column names of Table for convenient usage.
}
// SysDeptColumns defines and stores column names for table sys_dept.
type SysDeptColumns struct {
DeptId string // 部门id
ParentId string // 父部门id
Ancestors string // 祖级列表
DeptName string // 部门名称
OrderNum string // 显示顺序
Leader string // 负责人
Phone string // 联系电话
Email string // 邮箱
Status string // 部门状态0正常 1停用
CreatedBy string // 创建人
UpdatedBy string // 修改人
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// sysDeptColumns holds the columns for table sys_dept.
var sysDeptColumns = SysDeptColumns{
DeptId: "dept_id",
ParentId: "parent_id",
Ancestors: "ancestors",
DeptName: "dept_name",
OrderNum: "order_num",
Leader: "leader",
Phone: "phone",
Email: "email",
Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewSysDeptDao creates and returns a new DAO object for table data access.
func NewSysDeptDao() *SysDeptDao {
return &SysDeptDao{
group: "default",
table: "sys_dept",
columns: sysDeptColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysDeptDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysDeptDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysDeptDao) Columns() SysDeptColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysDeptDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysDeptDao) 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 *SysDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,102 @@
// ==========================================================================
// GFast自动生成dao internal操作代码。
// 生成日期2023-01-12 17:43:50
// 生成路径: internal/app/system/dao/internal/sys_job.go
// 生成人gfast
// desc:定时任务
// company:云南奇讯科技有限公司
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysJobDao is the manager for logic model data accessing and custom defined data operations functions management.
type SysJobDao 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 SysJobColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}
// SysJobColumns defines and stores column names for table sys_job.
type SysJobColumns struct {
JobId string // 任务ID
JobName string // 任务名称
JobParams string // 参数
JobGroup string // 任务组名
InvokeTarget string // 任务方法
CronExpression string // cron执行表达式
MisfirePolicy string // 计划执行策略
Concurrent string // 是否并发执行
Status string // 状态
CreatedBy string // 创建者
UpdatedBy string // 更新者
Remark string // 备注信息
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
var sysJobColumns = SysJobColumns{
JobId: "job_id",
JobName: "job_name",
JobParams: "job_params",
JobGroup: "job_group",
InvokeTarget: "invoke_target",
CronExpression: "cron_expression",
MisfirePolicy: "misfire_policy",
Concurrent: "concurrent",
Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
Remark: "remark",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysJobDao creates and returns a new DAO object for table data access.
func NewSysJobDao() *SysJobDao {
return &SysJobDao{
group: "default",
table: "sys_job",
columns: sysJobColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysJobDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysJobDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysJobDao) Columns() SysJobColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysJobDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysJobDao) 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 *SysJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,79 @@
// ==========================================================================
// 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"
)
// SysJobLogDao is the data access object for table sys_job_log.
type SysJobLogDao 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 SysJobLogColumns // columns contains all the column names of Table for convenient usage.
}
// SysJobLogColumns defines and stores column names for table sys_job_log.
type SysJobLogColumns struct {
Id string // 主键
TargetName string // 方法名
CreatedAt string // 执行日期
Result string // 执行结果
}
// sysJobLogColumns holds the columns for table sys_job_log.
var sysJobLogColumns = SysJobLogColumns{
Id: "id",
TargetName: "target_name",
CreatedAt: "created_at",
Result: "result",
}
// NewSysJobLogDao creates and returns a new DAO object for table data access.
func NewSysJobLogDao() *SysJobLogDao {
return &SysJobLogDao{
group: "default",
table: "sys_job_log",
columns: sysJobLogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysJobLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysJobLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysJobLogDao) Columns() SysJobLogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysJobLogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysJobLogDao) 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 *SysJobLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,90 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-08 11:31:48
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysLoginLogDao is the data access object for table sys_login_log.
type SysLoginLogDao 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 SysLoginLogColumns // columns contains all the column names of Table for convenient usage.
}
// SysLoginLogColumns defines and stores column names for table sys_login_log.
type SysLoginLogColumns struct {
InfoId string // 访问ID
LoginName string // 登录账号
Ipaddr string // 登录IP地址
LoginLocation string // 登录地点
Browser string // 浏览器类型
Os string // 操作系统
Status string // 登录状态0成功 1失败
Msg string // 提示消息
LoginTime string // 登录时间
Module string // 登录模块
}
// sysLoginLogColumns holds the columns for table sys_login_log.
var sysLoginLogColumns = SysLoginLogColumns{
InfoId: "info_id",
LoginName: "login_name",
Ipaddr: "ipaddr",
LoginLocation: "login_location",
Browser: "browser",
Os: "os",
Status: "status",
Msg: "msg",
LoginTime: "login_time",
Module: "module",
}
// NewSysLoginLogDao creates and returns a new DAO object for table data access.
func NewSysLoginLogDao() *SysLoginLogDao {
return &SysLoginLogDao{
group: "default",
table: "sys_login_log",
columns: sysLoginLogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysLoginLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysLoginLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysLoginLogDao) Columns() SysLoginLogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysLoginLogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysLoginLogDao) 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 *SysLoginLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,99 @@
// ==========================================================================
// 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"
)
// SysOperLogDao is the data access object for table sys_oper_log.
type SysOperLogDao 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 SysOperLogColumns // columns contains all the column names of Table for convenient usage.
}
// SysOperLogColumns defines and stores column names for table sys_oper_log.
type SysOperLogColumns struct {
OperId string // 日志主键
Title string // 模块标题
BusinessType string // 业务类型0其它 1新增 2修改 3删除
Method string // 方法名称
RequestMethod string // 请求方式
OperatorType string // 操作类别0其它 1后台用户 2手机端用户
OperName string // 操作人员
DeptName string // 部门名称
OperUrl string // 请求URL
OperIp string // 主机地址
OperLocation string // 操作地点
OperParam string // 请求参数
ErrorMsg string // 错误消息
OperTime string // 操作时间
}
// sysOperLogColumns holds the columns for table sys_oper_log.
var sysOperLogColumns = SysOperLogColumns{
OperId: "oper_id",
Title: "title",
BusinessType: "business_type",
Method: "method",
RequestMethod: "request_method",
OperatorType: "operator_type",
OperName: "oper_name",
DeptName: "dept_name",
OperUrl: "oper_url",
OperIp: "oper_ip",
OperLocation: "oper_location",
OperParam: "oper_param",
ErrorMsg: "error_msg",
OperTime: "oper_time",
}
// NewSysOperLogDao creates and returns a new DAO object for table data access.
func NewSysOperLogDao() *SysOperLogDao {
return &SysOperLogDao{
group: "default",
table: "sys_oper_log",
columns: sysOperLogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysOperLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysOperLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysOperLogDao) Columns() SysOperLogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysOperLogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysOperLogDao) 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 *SysOperLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,92 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-07 23:26:21
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysPostDao is the data access object for table sys_post.
type SysPostDao 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 SysPostColumns // columns contains all the column names of Table for convenient usage.
}
// SysPostColumns defines and stores column names for table sys_post.
type SysPostColumns struct {
PostId string // 岗位ID
PostCode string // 岗位编码
PostName string // 岗位名称
PostSort string // 显示顺序
Status string // 状态0正常 1停用
Remark string // 备注
CreatedBy string // 创建人
UpdatedBy string // 修改人
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// sysPostColumns holds the columns for table sys_post.
var sysPostColumns = SysPostColumns{
PostId: "post_id",
PostCode: "post_code",
PostName: "post_name",
PostSort: "post_sort",
Status: "status",
Remark: "remark",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewSysPostDao creates and returns a new DAO object for table data access.
func NewSysPostDao() *SysPostDao {
return &SysPostDao{
group: "default",
table: "sys_post",
columns: sysPostColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysPostDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysPostDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysPostDao) Columns() SysPostColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysPostDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysPostDao) 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 *SysPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,86 @@
// ==========================================================================
// 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"
)
// SysRoleDao is the data access object for table sys_role.
type SysRoleDao 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 SysRoleColumns // columns contains all the column names of Table for convenient usage.
}
// SysRoleColumns defines and stores column names for table sys_role.
type SysRoleColumns struct {
Id string //
Status string // 状态;0:禁用;1:正常
ListOrder string // 排序
Name string // 角色名称
Remark string // 备注
DataScope string // 数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysRoleColumns holds the columns for table sys_role.
var sysRoleColumns = SysRoleColumns{
Id: "id",
Status: "status",
ListOrder: "list_order",
Name: "name",
Remark: "remark",
DataScope: "data_scope",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysRoleDao creates and returns a new DAO object for table data access.
func NewSysRoleDao() *SysRoleDao {
return &SysRoleDao{
group: "default",
table: "sys_role",
columns: sysRoleColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysRoleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysRoleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysRoleDao) Columns() SysRoleColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysRoleDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysRoleDao) 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 *SysRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,75 @@
// ==========================================================================
// 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"
)
// SysRoleDeptDao is the data access object for table sys_role_dept.
type SysRoleDeptDao 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 SysRoleDeptColumns // columns contains all the column names of Table for convenient usage.
}
// SysRoleDeptColumns defines and stores column names for table sys_role_dept.
type SysRoleDeptColumns struct {
RoleId string // 角色ID
DeptId string // 部门ID
}
// sysRoleDeptColumns holds the columns for table sys_role_dept.
var sysRoleDeptColumns = SysRoleDeptColumns{
RoleId: "role_id",
DeptId: "dept_id",
}
// NewSysRoleDeptDao creates and returns a new DAO object for table data access.
func NewSysRoleDeptDao() *SysRoleDeptDao {
return &SysRoleDeptDao{
group: "default",
table: "sys_role_dept",
columns: sysRoleDeptColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysRoleDeptDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysRoleDeptDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysRoleDeptDao) Columns() SysRoleDeptColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysRoleDeptDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysRoleDeptDao) 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 *SysRoleDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,114 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-02 16:48:23
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysUserDao is the data access object for table sys_user.
type SysUserDao 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 SysUserColumns // columns contains all the column names of Table for convenient usage.
}
// SysUserColumns defines and stores column names for table sys_user.
type SysUserColumns struct {
Id string //
UserName string // 用户名
Mobile string // 中国手机不带国家代码,国际手机号格式为:国家代码-手机号
UserNickname string // 用户昵称
Birthday string // 生日
UserPassword string // 登录密码;cmf_password加密
UserSalt string // 加密盐
UserStatus string // 用户状态;0:禁用,1:正常,2:未验证
UserEmail string // 用户登录邮箱
Sex string // 性别;0:保密,1:男,2:女
Avatar string // 用户头像
DeptId string // 部门id
Remark string // 备注
IsAdmin string // 是否后台管理员 1 是 0 否
Address string // 联系地址
Describe string // 描述信息
LastLoginIp string // 最后登录ip
LastLoginTime string // 最后登录时间
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 删除时间
TenantId string
}
// sysUserColumns holds the columns for table sys_user.
var sysUserColumns = SysUserColumns{
Id: "id",
UserName: "user_name",
Mobile: "mobile",
UserNickname: "user_nickname",
Birthday: "birthday",
UserPassword: "user_password",
UserSalt: "user_salt",
UserStatus: "user_status",
UserEmail: "user_email",
Sex: "sex",
Avatar: "avatar",
DeptId: "dept_id",
Remark: "remark",
IsAdmin: "is_admin",
Address: "address",
Describe: "describe",
LastLoginIp: "last_login_ip",
LastLoginTime: "last_login_time",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
TenantId: "tenant_id",
}
// NewSysUserDao creates and returns a new DAO object for table data access.
func NewSysUserDao() *SysUserDao {
return &SysUserDao{
group: "default",
table: "sys_user",
columns: sysUserColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysUserDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysUserDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysUserDao) Columns() SysUserColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysUserDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysUserDao) 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 *SysUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,87 @@
// ==========================================================================
// 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"
)
// SysUserOnlineDao is the data access object for table sys_user_online.
type SysUserOnlineDao 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 SysUserOnlineColumns // columns contains all the column names of Table for convenient usage.
}
// SysUserOnlineColumns defines and stores column names for table sys_user_online.
type SysUserOnlineColumns struct {
Id string //
Uuid string // 用户标识
Token string // 用户token
CreateTime string // 登录时间
UserName string // 用户名
Ip string // 登录ip
Explorer string // 浏览器
Os string // 操作系统
}
// sysUserOnlineColumns holds the columns for table sys_user_online.
var sysUserOnlineColumns = SysUserOnlineColumns{
Id: "id",
Uuid: "uuid",
Token: "token",
CreateTime: "create_time",
UserName: "user_name",
Ip: "ip",
Explorer: "explorer",
Os: "os",
}
// NewSysUserOnlineDao creates and returns a new DAO object for table data access.
func NewSysUserOnlineDao() *SysUserOnlineDao {
return &SysUserOnlineDao{
group: "default",
table: "sys_user_online",
columns: sysUserOnlineColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysUserOnlineDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysUserOnlineDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysUserOnlineDao) Columns() SysUserOnlineColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysUserOnlineDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysUserOnlineDao) 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 *SysUserOnlineDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,74 @@
// ==========================================================================
// 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"
)
// SysUserPostDao is the data access object for table sys_user_post.
type SysUserPostDao 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 SysUserPostColumns // columns contains all the column names of Table for convenient usage.
}
// SysUserPostColumns defines and stores column names for table sys_user_post.
type SysUserPostColumns struct {
UserId string // 用户ID
PostId string // 岗位ID
}
// sysUserPostColumns holds the columns for table sys_user_post.
var sysUserPostColumns = SysUserPostColumns{
UserId: "user_id",
PostId: "post_id",
}
// NewSysUserPostDao creates and returns a new DAO object for table data access.
func NewSysUserPostDao() *SysUserPostDao {
return &SysUserPostDao{
group: "default",
table: "sys_user_post",
columns: sysUserPostColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysUserPostDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysUserPostDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysUserPostDao) Columns() SysUserPostColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysUserPostDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysUserPostDao) 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 *SysUserPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,91 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-02 16:48:23
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// TenantDao is the data access object for table sys_user.
type TenantDao 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 TenantColumns // columns contains all the column names of Table for convenient usage.
}
// TenantColumns defines and stores column names for table sys_user.
type TenantColumns struct {
Id string //
CreateBy string // 创建者
UpdateBy string // 更新者
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
TenantName string // 租户名称
TenantType string // 租户类型
CityCode string // 城市编码
BusinessLicense string // 营业执照
TenantSource string // 租户来源
}
// tenantColumns holds the columns for table sys_user.
var tenantColumns = TenantColumns{
Id: "id",
CreateBy: "create_by",
UpdateBy: "update_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
TenantName: "tenant_name",
TenantType: "tenant_type",
CityCode: "city_code",
BusinessLicense: "business_license",
TenantSource: "tenant_source",
}
// NewTenantDao creates and returns a new DAO object for table data access.
func NewTenantDao() *TenantDao {
return &TenantDao{
group: "default",
table: "tenant",
columns: tenantColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *TenantDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *TenantDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *TenantDao) Columns() TenantColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *TenantDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *TenantDao) 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 *TenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,107 @@
// ==========================================================================
// 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"
)
// ToolsGenTableDao is the data access object for table tools_gen_table.
type ToolsGenTableDao 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 ToolsGenTableColumns // columns contains all the column names of Table for convenient usage.
}
// ToolsGenTableColumns defines and stores column names for table tools_gen_table.
type ToolsGenTableColumns struct {
TableId string // 编号
TableName string // 表名称
TableComment string // 表描述
ClassName string // 实体类名称
TplCategory string // 使用的模板crud单表操作 tree树表操作
PackageName string // 生成包路径
ModuleName string // 生成模块名
BusinessName string // 生成业务名
FunctionName string // 生成功能名
FunctionAuthor string // 生成功能作者
Options string // 其它生成选项
CreateTime string // 创建时间
UpdateTime string // 更新时间
Remark string // 备注
Overwrite string // 是否覆盖原有文件
SortColumn string // 排序字段名
SortType string // 排序方式 (asc顺序 desc倒序)
ShowDetail string // 是否有查看详情功能
}
// toolsGenTableColumns holds the columns for table tools_gen_table.
var toolsGenTableColumns = ToolsGenTableColumns{
TableId: "table_id",
TableName: "table_name",
TableComment: "table_comment",
ClassName: "class_name",
TplCategory: "tpl_category",
PackageName: "package_name",
ModuleName: "module_name",
BusinessName: "business_name",
FunctionName: "function_name",
FunctionAuthor: "function_author",
Options: "options",
CreateTime: "create_time",
UpdateTime: "update_time",
Remark: "remark",
Overwrite: "overwrite",
SortColumn: "sort_column",
SortType: "sort_type",
ShowDetail: "show_detail",
}
// NewToolsGenTableDao creates and returns a new DAO object for table data access.
func NewToolsGenTableDao() *ToolsGenTableDao {
return &ToolsGenTableDao{
group: "default",
table: "tools_gen_table",
columns: toolsGenTableColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ToolsGenTableDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *ToolsGenTableDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *ToolsGenTableDao) Columns() ToolsGenTableColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *ToolsGenTableDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ToolsGenTableDao) 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 *ToolsGenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -0,0 +1,151 @@
// ==========================================================================
// 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"
)
// ToolsGenTableColumnDao is the data access object for table tools_gen_table_column.
type ToolsGenTableColumnDao 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 ToolsGenTableColumnColumns // columns contains all the column names of Table for convenient usage.
}
// ToolsGenTableColumnColumns defines and stores column names for table tools_gen_table_column.
type ToolsGenTableColumnColumns struct {
ColumnId string // 编号
TableId string // 归属表编号
ColumnName string // 列名称
ColumnComment string // 列描述
ColumnType string // 列类型
GoType string // Go类型
TsType string // TS类型
GoField string // Go字段名
HtmlField string // html字段名
IsPk string // 是否主键1是
IsIncrement string // 是否自增1是
IsRequired string // 是否必填1是
IsInsert string // 是否为插入字段1是
IsEdit string // 是否编辑字段1是
IsList string // 是否列表字段1是
IsDetail string // 是否详情字段
IsQuery string // 是否查询字段1是
SortOrderEdit string // 插入编辑显示顺序
SortOrderList string // 列表显示顺序
SortOrderDetail string // 详情显示顺序
SortOrderQuery string // 查询显示顺序
QueryType string // 查询方式(等于、不等于、大于、小于、范围)
HtmlType string // 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
DictType string // 字典类型
LinkTableName string // 关联表名
LinkTableClass string // 关联表类名
LinkTableModuleName string // 关联表模块名
LinkTableBusinessName string // 关联表业务名
LinkTablePackage string // 关联表包名
LinkLabelId string // 关联表键名
LinkLabelName string // 关联表字段值
ColSpan string // 详情页占列数
RowSpan string // 详情页占行数
IsRowStart string // 详情页为行首
MinWidth string // 表格最小宽度
IsFixed string // 是否表格列左固定
IsOverflowTooltip string // 是否过长自动隐藏
IsCascade string // 是否级联查询
ParentColumnName string // 上级字段名
CascadeColumnName string // 级联查询字段
}
// toolsGenTableColumnColumns holds the columns for table tools_gen_table_column.
var toolsGenTableColumnColumns = ToolsGenTableColumnColumns{
ColumnId: "column_id",
TableId: "table_id",
ColumnName: "column_name",
ColumnComment: "column_comment",
ColumnType: "column_type",
GoType: "go_type",
TsType: "ts_type",
GoField: "go_field",
HtmlField: "html_field",
IsPk: "is_pk",
IsIncrement: "is_increment",
IsRequired: "is_required",
IsInsert: "is_insert",
IsEdit: "is_edit",
IsList: "is_list",
IsDetail: "is_detail",
IsQuery: "is_query",
SortOrderEdit: "sort_order_edit",
SortOrderList: "sort_order_list",
SortOrderDetail: "sort_order_detail",
SortOrderQuery: "sort_order_query",
QueryType: "query_type",
HtmlType: "html_type",
DictType: "dict_type",
LinkTableName: "link_table_name",
LinkTableClass: "link_table_class",
LinkTableModuleName: "link_table_module_name",
LinkTableBusinessName: "link_table_business_name",
LinkTablePackage: "link_table_package",
LinkLabelId: "link_label_id",
LinkLabelName: "link_label_name",
ColSpan: "col_span",
RowSpan: "row_span",
IsRowStart: "is_row_start",
MinWidth: "min_width",
IsFixed: "is_fixed",
IsOverflowTooltip: "is_overflow_tooltip",
IsCascade: "is_cascade",
ParentColumnName: "parent_column_name",
CascadeColumnName: "cascade_column_name",
}
// NewToolsGenTableColumnDao creates and returns a new DAO object for table data access.
func NewToolsGenTableColumnDao() *ToolsGenTableColumnDao {
return &ToolsGenTableColumnDao{
group: "default",
table: "tools_gen_table_column",
columns: toolsGenTableColumnColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ToolsGenTableColumnDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *ToolsGenTableColumnDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *ToolsGenTableColumnDao) Columns() ToolsGenTableColumnColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *ToolsGenTableColumnDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *ToolsGenTableColumnDao) 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 *ToolsGenTableColumnDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -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/system/dao/internal"
)
// moduleTenantDao is the data access object for table module_tenant.
// You can define custom methods on it to extend its functionality as you wish.
type moduleTenantDao struct {
*internal.ModuleTenantDao
}
var (
// ModuleTenant is globally public accessible object for table module_tenant operations.
ModuleTenant = moduleTenantDao{
internal.NewModuleTenantDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// sysAuthRuleDao is the data access object for table sys_auth_rule.
// You can define custom methods on it to extend its functionality as you wish.
type sysAuthRuleDao struct {
*internal.SysAuthRuleDao
}
var (
// SysAuthRule is globally public accessible object for table sys_auth_rule operations.
SysAuthRule = sysAuthRuleDao{
internal.NewSysAuthRuleDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysDeptDao is internal type for wrapping internal DAO implements.
type internalSysDeptDao = *internal.SysDeptDao
// sysDeptDao is the data access object for table sys_dept.
// You can define custom methods on it to extend its functionality as you wish.
type sysDeptDao struct {
internalSysDeptDao
}
var (
// SysDept is globally public accessible object for table sys_dept operations.
SysDept = sysDeptDao{
internal.NewSysDeptDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,29 @@
// ==========================================================================
// GFast自动生成dao操作代码。
// 生成日期2023-01-12 17:43:50
// 生成路径: internal/app/system/dao/sys_job.go
// 生成人gfast
// desc:定时任务
// company:云南奇讯科技有限公司
// ==========================================================================
package dao
import (
"github.com/tiger1103/gfast/v3/internal/app/system/dao/internal"
)
// sysJobDao is the manager for logic model data accessing and custom defined data operations functions management.
// You can define custom methods on it to extend its functionality as you wish.
type sysJobDao struct {
*internal.SysJobDao
}
var (
// SysJob is globally public accessible object for table tools_gen_table operations.
SysJob = sysJobDao{
internal.NewSysJobDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysJobLogDao is internal type for wrapping internal DAO implements.
type internalSysJobLogDao = *internal.SysJobLogDao
// sysJobLogDao is the data access object for table sys_job_log.
// You can define custom methods on it to extend its functionality as you wish.
type sysJobLogDao struct {
internalSysJobLogDao
}
var (
// SysJobLog is globally public accessible object for table sys_job_log operations.
SysJobLog = sysJobLogDao{
internal.NewSysJobLogDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// sysLoginLogDao is the data access object for table sys_login_log.
// You can define custom methods on it to extend its functionality as you wish.
type sysLoginLogDao struct {
*internal.SysLoginLogDao
}
var (
// SysLoginLog is globally public accessible object for table sys_login_log operations.
SysLoginLog = sysLoginLogDao{
internal.NewSysLoginLogDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysOperLogDao is internal type for wrapping internal DAO implements.
type internalSysOperLogDao = *internal.SysOperLogDao
// sysOperLogDao is the data access object for table sys_oper_log.
// You can define custom methods on it to extend its functionality as you wish.
type sysOperLogDao struct {
internalSysOperLogDao
}
var (
// SysOperLog is globally public accessible object for table sys_oper_log operations.
SysOperLog = sysOperLogDao{
internal.NewSysOperLogDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// sysPostDao is the data access object for table sys_post.
// You can define custom methods on it to extend its functionality as you wish.
type sysPostDao struct {
*internal.SysPostDao
}
var (
// SysPost is globally public accessible object for table sys_post operations.
SysPost = sysPostDao{
internal.NewSysPostDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// sysRoleDao is the data access object for table sys_role.
// You can define custom methods on it to extend its functionality as you wish.
type sysRoleDao struct {
*internal.SysRoleDao
}
var (
// SysRole is globally public accessible object for table sys_role operations.
SysRole = sysRoleDao{
internal.NewSysRoleDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysRoleDeptDao is internal type for wrapping internal DAO implements.
type internalSysRoleDeptDao = *internal.SysRoleDeptDao
// sysRoleDeptDao is the data access object for table sys_role_dept.
// You can define custom methods on it to extend its functionality as you wish.
type sysRoleDeptDao struct {
internalSysRoleDeptDao
}
var (
// SysRoleDept is globally public accessible object for table sys_role_dept operations.
SysRoleDept = sysRoleDeptDao{
internal.NewSysRoleDeptDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// sysUserDao is the data access object for table sys_user.
// You can define custom methods on it to extend its functionality as you wish.
type sysUserDao struct {
*internal.SysUserDao
}
var (
// SysUser is globally public accessible object for table sys_user operations.
SysUser = sysUserDao{
internal.NewSysUserDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysUserOnlineDao is internal type for wrapping internal DAO implements.
type internalSysUserOnlineDao = *internal.SysUserOnlineDao
// sysUserOnlineDao is the data access object for table sys_user_online.
// You can define custom methods on it to extend its functionality as you wish.
type sysUserOnlineDao struct {
internalSysUserOnlineDao
}
var (
// SysUserOnline is globally public accessible object for table sys_user_online operations.
SysUserOnline = sysUserOnlineDao{
internal.NewSysUserOnlineDao(),
}
)
// Fill with you ideas below.

View File

@@ -0,0 +1,27 @@
// =================================================================================
// 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/system/dao/internal"
)
// internalSysUserPostDao is internal type for wrapping internal DAO implements.
type internalSysUserPostDao = *internal.SysUserPostDao
// sysUserPostDao is the data access object for table sys_user_post.
// You can define custom methods on it to extend its functionality as you wish.
type sysUserPostDao struct {
internalSysUserPostDao
}
var (
// SysUserPost is globally public accessible object for table sys_user_post operations.
SysUserPost = sysUserPostDao{
internal.NewSysUserPostDao(),
}
)
// Fill with you ideas below.

View File

@@ -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/system/dao/internal"
)
// tenantDao is the data access object for table sys_user.
// You can define custom methods on it to extend its functionality as you wish.
type tenantDao struct {
*internal.TenantDao
}
var (
// TenantDao is globally public accessible object for table sys_user operations.
TenantDao = tenantDao{
internal.NewTenantDao(),
}
)
// Fill with you ideas below.

Some files were not shown because too many files have changed in this diff Show More