发布代码生成、更新20+表单组件,优化数据字典,gf版本更新到2.3.1

This commit is contained in:
孟帅
2023-01-18 16:23:39 +08:00
parent 50207ded90
commit 87c27a17a3
386 changed files with 27926 additions and 44297 deletions

View File

@@ -29,15 +29,9 @@ var (
}
)
// UpdatePostIds
// @Description:
// @receiver dao
// @param ctx
// @param memberId
// @param postIds
// @return err
//
// UpdatePostIds 更新管理员岗位
func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) {
g.DumpWithType(postIds)
_, err = dao.Ctx(ctx).
Where("member_id", memberId).
Delete()
@@ -61,16 +55,8 @@ func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64
return nil
}
// GetMemberByIds 获取指定员的岗位ids
// @Description:
// @receiver dao
// @param ctx
// @param memberId
// @return postIds
// @return err
//
// GetMemberByIds 获取指定关联员的岗位ids
func (dao *adminMemberPostDao) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) {
var list []*entity.AdminMemberPost
err = dao.Ctx(ctx).
Fields("post_id").
@@ -85,6 +71,5 @@ func (dao *adminMemberPostDao) GetMemberByIds(ctx context.Context, memberId int6
postIds = append(postIds, list[i].PostId)
}
g.Log().Print(ctx, "post_ids:", postIds)
return postIds, nil
}

View File

@@ -1,27 +0,0 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"hotgo/internal/dao/internal"
)
// internalAdminRoleDeptDao is internal type for wrapping internal DAO implements.
type internalAdminRoleDeptDao = *internal.AdminRoleDeptDao
// adminRoleDeptDao is the data access object for table hg_admin_role_dept.
// You can define custom methods on it to extend its functionality as you wish.
type adminRoleDeptDao struct {
internalAdminRoleDeptDao
}
var (
// AdminRoleDept is globally common accessible object for table hg_admin_role_dept operations.
AdminRoleDept = adminRoleDeptDao{
internal.NewAdminRoleDeptDao(),
}
)
// 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 (
"hotgo/internal/dao/internal"
)
// internalDemoDao is internal type for wrapping internal DAO implements.
type internalDemoDao = *internal.DemoDao
// demoDao is the data access object for table hg_demo.
// You can define custom methods on it to extend its functionality as you wish.
type demoDao struct {
internalDemoDao
}
var (
// Demo is globally public accessible object for table hg_demo operations.
Demo = demoDao{
internal.NewDemoDao(),
}
)
// Fill with you ideas below.

View File

@@ -20,8 +20,8 @@ type AdminDeptDao struct {
// AdminDeptColumns defines and stores column names for table hg_admin_dept.
type AdminDeptColumns struct {
Id string // 部门id
Pid string // 父部门id
Id string // 部门ID
Pid string // 父部门ID
Name string // 部门名称
Code string // 部门编码
Type string // 部门类型
@@ -34,7 +34,7 @@ type AdminDeptColumns struct {
UpdatedAt string // 更新时间
}
// adminDeptColumns holds the columns for table hg_admin_dept.
// adminDeptColumns holds the columns for table hg_admin_dept.
var adminDeptColumns = AdminDeptColumns{
Id: "id",
Pid: "pid",
@@ -90,6 +90,6 @@ func (dao *AdminDeptDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,64 +20,64 @@ type AdminMemberDao struct {
// AdminMemberColumns defines and stores column names for table hg_admin_member.
type AdminMemberColumns struct {
Id string //
Id string // 管理员ID
DeptId string // 部门ID
RoleId string // 角色ID
RealName string // 真实姓名
Username string // 帐号
PasswordHash string // 密码
Salt string // 密码盐
AuthKey string // 授权令牌
PasswordResetToken string // 密码重置令牌
Type string // 1:普通管理员;10超级管理员
Realname string // 真实姓名
Avatar string // 头像
Sex string // 性别[1:男;2:女;3:未知]
Sex string // 性别
Qq string // qq
Email string // 邮箱
Birthday string // 生日
ProvinceId string // 省
CityId string // 城市
AreaId string // 地区
Address string // 默认地址
Mobile string // 手机号码
HomePhone string // 家庭号码
DingtalkRobotToken string // 钉钉机器人token
Birthday string // 生日
ProvinceId string // 省编码
CityId string // 城市编码
CountyId string // 区域编码
Address string // 联系地址
VisitCount string // 访问次数
LastTime string // 最后一次登录时间
LastIp string // 最后一次登录ip
Role string // 权限
Pid string // 上级管理员ID
Level string // 关系树等级
Tree string // 关系树
Remark string // 备注
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
}
// adminMemberColumns holds the columns for table hg_admin_member.
// adminMemberColumns holds the columns for table hg_admin_member.
var adminMemberColumns = AdminMemberColumns{
Id: "id",
DeptId: "dept_id",
RoleId: "role_id",
RealName: "real_name",
Username: "username",
PasswordHash: "password_hash",
Salt: "salt",
AuthKey: "auth_key",
PasswordResetToken: "password_reset_token",
Type: "type",
Realname: "realname",
Avatar: "avatar",
Sex: "sex",
Qq: "qq",
Email: "email",
Mobile: "mobile",
Birthday: "birthday",
ProvinceId: "province_id",
CityId: "city_id",
AreaId: "area_id",
CountyId: "county_id",
Address: "address",
Mobile: "mobile",
HomePhone: "home_phone",
DingtalkRobotToken: "dingtalk_robot_token",
VisitCount: "visit_count",
LastTime: "last_time",
LastIp: "last_ip",
Role: "role",
Pid: "pid",
Level: "level",
Tree: "tree",
Remark: "remark",
Status: "status",
CreatedAt: "created_at",
@@ -124,6 +124,6 @@ func (dao *AdminMemberDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminMemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminMemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,11 +20,11 @@ type AdminMemberPostDao struct {
// AdminMemberPostColumns defines and stores column names for table hg_admin_member_post.
type AdminMemberPostColumns struct {
MemberId string // 用户ID
MemberId string // 管理员ID
PostId string // 岗位ID
}
// adminMemberPostColumns holds the columns for table hg_admin_member_post.
// adminMemberPostColumns holds the columns for table hg_admin_member_post.
var adminMemberPostColumns = AdminMemberPostColumns{
MemberId: "member_id",
PostId: "post_id",
@@ -70,6 +70,6 @@ func (dao *AdminMemberPostDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminMemberPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminMemberPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,11 +20,11 @@ type AdminMemberRoleDao struct {
// AdminMemberRoleColumns defines and stores column names for table hg_admin_member_role.
type AdminMemberRoleColumns struct {
MemberId string // 用户ID
MemberId string // 管理员ID
RoleId string // 角色ID
}
// adminMemberRoleColumns holds the columns for table hg_admin_member_role.
// adminMemberRoleColumns holds the columns for table hg_admin_member_role.
var adminMemberRoleColumns = AdminMemberRoleColumns{
MemberId: "member_id",
RoleId: "role_id",
@@ -70,6 +70,6 @@ func (dao *AdminMemberRoleDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminMemberRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminMemberRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -39,8 +39,8 @@ type AdminMenuColumns struct {
KeepAlive string // 缓存该路由
Hidden string // 是否隐藏
Affix string // 是否固定
Level string // 级
Tree string // 树
Level string // 关系树等
Tree string // 关系
Sort string // 排序
Remark string // 备注
Status string // 菜单状态
@@ -48,7 +48,7 @@ type AdminMenuColumns struct {
UpdatedAt string // 更新时间
}
// adminMenuColumns holds the columns for table hg_admin_menu.
// adminMenuColumns holds the columns for table hg_admin_menu.
var adminMenuColumns = AdminMenuColumns{
Id: "id",
Pid: "pid",
@@ -118,6 +118,6 @@ func (dao *AdminMenuDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -22,7 +22,7 @@ type AdminNoticeDao struct {
type AdminNoticeColumns struct {
Id string // 公告ID
Title string // 公告标题
Type string // 公告类型1通知 2公告
Type string // 公告类型
Content string // 公告内容
Receiver string // 接收者
Reader string // 已读人
@@ -33,7 +33,7 @@ type AdminNoticeColumns struct {
UpdatedAt string // 更新时间
}
// adminNoticeColumns holds the columns for table hg_admin_notice.
// adminNoticeColumns holds the columns for table hg_admin_notice.
var adminNoticeColumns = AdminNoticeColumns{
Id: "id",
Title: "title",
@@ -88,6 +88,6 @@ func (dao *AdminNoticeDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -30,7 +30,7 @@ type AdminPostColumns struct {
UpdatedAt string // 更新时间
}
// adminPostColumns holds the columns for table hg_admin_post.
// adminPostColumns holds the columns for table hg_admin_post.
var adminPostColumns = AdminPostColumns{
Id: "id",
Code: "code",
@@ -82,6 +82,6 @@ func (dao *AdminPostDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,32 +20,36 @@ type AdminRoleDao struct {
// AdminRoleColumns defines and stores column names for table hg_admin_role.
type AdminRoleColumns struct {
Id string // 角色ID
Name string // 角色名称
Key string // 角色权限字符串
DataScope string // 数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限
MenuCheckStrictly string // 菜单树选择项是否关联显示
DeptCheckStrictly string // 部门树选择项是否关联显示
Remark string // 备注
Sort string // 排序
Status string // 角色状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
Id string // 角色ID
Name string // 角色名称
Key string // 角色权限字符串
DataScope string // 数据范围
CustomDept string // 自定义部门权限
Pid string // 上级角色ID
Level string // 关系树等级
Tree string // 关系树
Remark string // 备注
Sort string // 排序
Status string // 角色状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// adminRoleColumns holds the columns for table hg_admin_role.
// adminRoleColumns holds the columns for table hg_admin_role.
var adminRoleColumns = AdminRoleColumns{
Id: "id",
Name: "name",
Key: "key",
DataScope: "data_scope",
MenuCheckStrictly: "menu_check_strictly",
DeptCheckStrictly: "dept_check_strictly",
Remark: "remark",
Sort: "sort",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
Id: "id",
Name: "name",
Key: "key",
DataScope: "data_scope",
CustomDept: "custom_dept",
Pid: "pid",
Level: "level",
Tree: "tree",
Remark: "remark",
Sort: "sort",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewAdminRoleDao creates and returns a new DAO object for table data access.
@@ -88,6 +92,6 @@ func (dao *AdminRoleDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -30,7 +30,7 @@ type AdminRoleCasbinColumns struct {
V5 string //
}
// adminRoleCasbinColumns holds the columns for table hg_admin_role_casbin.
// adminRoleCasbinColumns holds the columns for table hg_admin_role_casbin.
var adminRoleCasbinColumns = AdminRoleCasbinColumns{
Id: "id",
PType: "p_type",
@@ -82,6 +82,6 @@ func (dao *AdminRoleCasbinDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminRoleCasbinDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminRoleCasbinDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

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

View File

@@ -24,7 +24,7 @@ type AdminRoleMenuColumns struct {
MenuId string // 菜单ID
}
// adminRoleMenuColumns holds the columns for table hg_admin_role_menu.
// adminRoleMenuColumns holds the columns for table hg_admin_role_menu.
var adminRoleMenuColumns = AdminRoleMenuColumns{
RoleId: "role_id",
MenuId: "menu_id",
@@ -70,6 +70,6 @@ func (dao *AdminRoleMenuDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *AdminRoleMenuDao) 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,143 @@
// ==========================================================================
// 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"
)
// DemoDao is the data access object for table hg_demo.
type DemoDao 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 DemoColumns // columns contains all the column names of Table for convenient usage.
}
// DemoColumns defines and stores column names for table hg_demo.
type DemoColumns struct {
Id string // ID
CategoryId string // 分类ID
Flag string // 标签
Title string // 标题
Description string // 描述
Content string // 内容
Image string // 单图
Images string // 多图
Attachfile string // 附件
Attachfiles string // 多附件
Map string // 动态键值对
Star string // 推荐星
Price string // 价格
Views string // 浏览次数
ActivityAt string // 活动时间
StartAt string // 开启时间
EndAt string // 结束时间
Switch string // 开关
Sort string // 排序
Avatar string // 头像
Sex string // 性别
Qq string // qq
Email string // 邮箱
Mobile string // 手机号码
Hobby string // 爱好
Channel string // 渠道
Pid string // 上级ID
Level string // 树等级
Tree string // 关系树
Remark string // 备注
Status string // 状态
CreatedBy string // 创建者
UpdatedBy string // 更新者
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// demoColumns holds the columns for table hg_demo.
var demoColumns = DemoColumns{
Id: "id",
CategoryId: "category_id",
Flag: "flag",
Title: "title",
Description: "description",
Content: "content",
Image: "image",
Images: "images",
Attachfile: "attachfile",
Attachfiles: "attachfiles",
Map: "map",
Star: "star",
Price: "price",
Views: "views",
ActivityAt: "activity_at",
StartAt: "start_at",
EndAt: "end_at",
Switch: "switch",
Sort: "sort",
Avatar: "avatar",
Sex: "sex",
Qq: "qq",
Email: "email",
Mobile: "mobile",
Hobby: "hobby",
Channel: "channel",
Pid: "pid",
Level: "level",
Tree: "tree",
Remark: "remark",
Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewDemoDao creates and returns a new DAO object for table data access.
func NewDemoDao() *DemoDao {
return &DemoDao{
group: "default",
table: "hg_demo",
columns: demoColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *DemoDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *DemoDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *DemoDao) Columns() DemoColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *DemoDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *DemoDao) 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 *DemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,18 +20,18 @@ type SysAttachmentDao struct {
// SysAttachmentColumns defines and stores column names for table hg_sys_attachment.
type SysAttachmentColumns struct {
Id string //
Id string // 文件ID
AppId string // 应用ID
MemberId string // 用户
CateId string // 分类
Drive string // 驱动
MemberId string // 管理员ID
CateId string // 上传分类
Drive string // 上传驱动
Name string // 文件原始名
Kind string // 上传类型
MetaType string // 类别
MetaType string // 文件类型
NaiveType string // NaiveUI类型
Path string // 本地路径
FileUrl string // url
Size string // 长度
Size string // 文件大小
Ext string // 扩展名
Md5 string // md5校验码
Status string // 状态
@@ -39,7 +39,7 @@ type SysAttachmentColumns struct {
UpdatedAt string // 修改时间
}
// sysAttachmentColumns holds the columns for table hg_sys_attachment.
// sysAttachmentColumns holds the columns for table hg_sys_attachment.
var sysAttachmentColumns = SysAttachmentColumns{
Id: "id",
AppId: "app_id",
@@ -100,6 +100,6 @@ func (dao *SysAttachmentDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysAttachmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysAttachmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,15 +20,15 @@ type SysBlacklistDao struct {
// SysBlacklistColumns defines and stores column names for table hg_sys_blacklist.
type SysBlacklistColumns struct {
Id string // 主键
Ip string // ip地址
Id string // 黑名单ID
Ip string // IP地址
Remark string // 备注
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysBlacklistColumns holds the columns for table hg_sys_blacklist.
// sysBlacklistColumns holds the columns for table hg_sys_blacklist.
var sysBlacklistColumns = SysBlacklistColumns{
Id: "id",
Ip: "ip",
@@ -78,6 +78,6 @@ func (dao *SysBlacklistDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysBlacklistDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysBlacklistDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -21,21 +21,21 @@ type SysConfigDao struct {
// SysConfigColumns defines and stores column names for table hg_sys_config.
type SysConfigColumns struct {
Id string // 配置ID
Group string // 分组
Group string // 配置分组
Name string // 参数名称
Type string // 类型:string,text,int,bool,array,datetime,date,file
Type string // 键值类型:string,int,uint,bool,datetime,date
Key string // 参数键名
Value string // 参数键值
DefaultValue string // 默认值
Sort string // 排序
Tip string // 变量描述
IsDefault string // 是否默认
IsDefault string // 是否为系统默认
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysConfigColumns holds the columns for table hg_sys_config.
// sysConfigColumns holds the columns for table hg_sys_config.
var sysConfigColumns = SysConfigColumns{
Id: "id",
Group: "group",
@@ -92,6 +92,6 @@ func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {
//
// 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) {
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

@@ -20,7 +20,7 @@ type SysCronDao struct {
// SysCronColumns defines and stores column names for table hg_sys_cron.
type SysCronColumns struct {
Id string // 主键
Id string // 任务ID
GroupId string // 分组ID
Name string // 任务名称
Params string // 函数参数
@@ -29,12 +29,12 @@ type SysCronColumns struct {
Count string // 执行次数
Sort string // 排序
Remark string // 备注
Status string // 状态
Status string // 任务状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysCronColumns holds the columns for table hg_sys_cron.
// sysCronColumns holds the columns for table hg_sys_cron.
var sysCronColumns = SysCronColumns{
Id: "id",
GroupId: "group_id",
@@ -90,6 +90,6 @@ func (dao *SysCronDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysCronDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysCronDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,18 +20,18 @@ type SysCronGroupDao struct {
// SysCronGroupColumns defines and stores column names for table hg_sys_cron_group.
type SysCronGroupColumns struct {
Id string // 主键
Pid string // 父类ID
Id string // 任务分组ID
Pid string // 父类任务分组ID
Name string // 分组名称
IsDefault string // 是否默认
Sort string // 排序
Remark string // 备注
Status string // 状态
Status string // 分组状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysCronGroupColumns holds the columns for table hg_sys_cron_group.
// sysCronGroupColumns holds the columns for table hg_sys_cron_group.
var sysCronGroupColumns = SysCronGroupColumns{
Id: "id",
Pid: "pid",
@@ -84,6 +84,6 @@ func (dao *SysCronGroupDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysCronGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysCronGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,12 +20,13 @@ type SysDictDataDao struct {
// SysDictDataColumns defines and stores column names for table hg_sys_dict_data.
type SysDictDataColumns struct {
Id string // 字典编码
Id string // 字典数据ID
Label string // 字典标签
Value string // 字典键值
ValueType string // 键值数据类型string,int,uint,bool,datetime,date
Type string // 字典类型
ListClass string // 表格回显样式
IsDefault string // 是否默认
IsDefault string // 是否为系统默认
Sort string // 字典排序
Remark string // 备注
Status string // 状态
@@ -33,11 +34,12 @@ type SysDictDataColumns struct {
UpdatedAt string // 更新时间
}
// sysDictDataColumns holds the columns for table hg_sys_dict_data.
// sysDictDataColumns holds the columns for table hg_sys_dict_data.
var sysDictDataColumns = SysDictDataColumns{
Id: "id",
Label: "label",
Value: "value",
ValueType: "value_type",
Type: "type",
ListClass: "list_class",
IsDefault: "is_default",
@@ -88,6 +90,6 @@ func (dao *SysDictDataDao) Ctx(ctx context.Context) *gdb.Model {
//
// 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) {
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

@@ -20,18 +20,18 @@ type SysDictTypeDao struct {
// SysDictTypeColumns defines and stores column names for table hg_sys_dict_type.
type SysDictTypeColumns struct {
Id string // 字典主键
Pid string // 父类ID
Name string // 字典名称
Id string // 字典类型ID
Pid string // 父类字典类型ID
Name string // 字典类型名称
Type string // 字典类型
Sort string // 排序
Remark string // 备注
Status string // 状态
Status string // 字典类型状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysDictTypeColumns holds the columns for table hg_sys_dict_type.
// sysDictTypeColumns holds the columns for table hg_sys_dict_type.
var sysDictTypeColumns = SysDictTypeColumns{
Id: "id",
Pid: "pid",
@@ -84,6 +84,6 @@ func (dao *SysDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
//
// 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) {
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,95 @@
// ==========================================================================
// 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"
)
// SysGenCodesDao is the data access object for table hg_sys_gen_codes.
type SysGenCodesDao 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 SysGenCodesColumns // columns contains all the column names of Table for convenient usage.
}
// SysGenCodesColumns defines and stores column names for table hg_sys_gen_codes.
type SysGenCodesColumns struct {
Id string // 生成ID
GenType string // 生成类型
VarName string // 实体命名
Options string // 配置选项
DbName string // 数据库名称
TableName string // 主表名称
TableComment string // 主表注释
DaoName string // 主表dao模型
MasterColumns string // 主表字段
Status string // 生成状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysGenCodesColumns holds the columns for table hg_sys_gen_codes.
var sysGenCodesColumns = SysGenCodesColumns{
Id: "id",
GenType: "gen_type",
VarName: "var_name",
Options: "options",
DbName: "db_name",
TableName: "table_name",
TableComment: "table_comment",
DaoName: "dao_name",
MasterColumns: "master_columns",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysGenCodesDao creates and returns a new DAO object for table data access.
func NewSysGenCodesDao() *SysGenCodesDao {
return &SysGenCodesDao{
group: "default",
table: "hg_sys_gen_codes",
columns: sysGenCodesColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysGenCodesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysGenCodesDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysGenCodesDao) Columns() SysGenCodesColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysGenCodesDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysGenCodesDao) 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 *SysGenCodesDao) 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,101 @@
// ==========================================================================
// 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"
)
// SysGenCurdDemoDao is the data access object for table hg_sys_gen_curd_demo.
type SysGenCurdDemoDao 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 SysGenCurdDemoColumns // columns contains all the column names of Table for convenient usage.
}
// SysGenCurdDemoColumns defines and stores column names for table hg_sys_gen_curd_demo.
type SysGenCurdDemoColumns struct {
Id string // ID
CategoryId string // 分类ID
Title string // 标题
Description string // 描述
Content string // 内容
Image string // 单图
Attachfile string // 附件
Switch string // 显示开关
Sort string // 排序
Status string // 状态
CreatedBy string // 创建者
UpdatedBy string // 更新者
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// sysGenCurdDemoColumns holds the columns for table hg_sys_gen_curd_demo.
var sysGenCurdDemoColumns = SysGenCurdDemoColumns{
Id: "id",
CategoryId: "category_id",
Title: "title",
Description: "description",
Content: "content",
Image: "image",
Attachfile: "attachfile",
Switch: "switch",
Sort: "sort",
Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewSysGenCurdDemoDao creates and returns a new DAO object for table data access.
func NewSysGenCurdDemoDao() *SysGenCurdDemoDao {
return &SysGenCurdDemoDao{
group: "default",
table: "hg_sys_gen_curd_demo",
columns: sysGenCurdDemoColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysGenCurdDemoDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysGenCurdDemoDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysGenCurdDemoDao) Columns() SysGenCurdDemoColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysGenCurdDemoDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysGenCurdDemoDao) 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 *SysGenCurdDemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,23 +20,23 @@ type SysLogDao struct {
// SysLogColumns defines and stores column names for table hg_sys_log.
type SysLogColumns struct {
Id string //
AppId string // 应用id
MerchantId string // 商户id
MemberId string // 用户id
Id string // 日志ID
AppId string // 应用ID
MerchantId string // 商户ID
MemberId string // 用户ID
Method string // 提交类型
Module string // 模块
Module string // 访问模块
Url string // 提交url
GetData string // get数据
PostData string // post数据
HeaderData string // header数据
Ip string // ip地址
Ip string // IP地址
ProvinceId string // 省编码
CityId string // 市编码
ErrorCode string // 报错code
ErrorMsg string // 报错信息
ErrorData string // 报错日志
ReqId string // 对外id
ReqId string // 对外ID
Timestamp string // 响应时间
UserAgent string // UA信息
TakeUpTime string // 请求耗时
@@ -45,7 +45,7 @@ type SysLogColumns struct {
UpdatedAt string // 修改时间
}
// sysLogColumns holds the columns for table hg_sys_log.
// sysLogColumns holds the columns for table hg_sys_log.
var sysLogColumns = SysLogColumns{
Id: "id",
AppId: "app_id",
@@ -112,6 +112,6 @@ func (dao *SysLogDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -20,34 +20,34 @@ type SysProvincesDao struct {
// SysProvincesColumns defines and stores column names for table hg_sys_provinces.
type SysProvincesColumns struct {
Id string // ID
Title string // 栏目名
Pid string // 父栏目
Id string // 省市区ID
Title string // 栏目名
ShortTitle string // 缩写
Areacode string // 区域编码
Zipcode string // 邮政编码
Pinyin string // 拼音
Lng string // 经度
Lat string // 纬度
Level string // 级别
Tree string //
Pid string // 父栏目
Level string // 关系树等级
Tree string // 关系
Sort string // 排序
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysProvincesColumns holds the columns for table hg_sys_provinces.
// sysProvincesColumns holds the columns for table hg_sys_provinces.
var sysProvincesColumns = SysProvincesColumns{
Id: "id",
Title: "title",
Pid: "pid",
ShortTitle: "short_title",
Areacode: "areacode",
Zipcode: "zipcode",
Pinyin: "pinyin",
Lng: "lng",
Lat: "lat",
Pid: "pid",
Level: "level",
Tree: "tree",
Sort: "sort",
@@ -96,6 +96,6 @@ func (dao *SysProvincesDao) Ctx(ctx context.Context) *gdb.Model {
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysProvincesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
func (dao *SysProvincesDao) 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,143 @@
// ==========================================================================
// 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"
)
// TestDao is the data access object for table hg_test.
type TestDao 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 TestColumns // columns contains all the column names of Table for convenient usage.
}
// TestColumns defines and stores column names for table hg_test.
type TestColumns struct {
Id string // ID
CategoryId string // 分类ID
Flag string // 标签
Title string // 标题
Description string // 描述
Content string // 内容
Image string // 单图
Images string // 多图
Attachfile string // 附件
Attachfiles string // 多附件
Map string // 动态键值对
Star string // 推荐星
Price string // 价格
Views string // 浏览次数
ActivityAt string // 活动时间
StartAt string // 开启时间
EndAt string // 结束时间
Switch string // 开关
Sort string // 排序
Avatar string // 头像
Sex string // 性别
Qq string // qq
Email string // 邮箱
Mobile string // 手机号码
Hobby string // 爱好
Channel string // 渠道
Pid string // 上级ID
Level string // 树等级
Tree string // 关系树
Remark string // 备注
Status string // 状态
CreatedBy string // 创建者
UpdatedBy string // 更新者
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// testColumns holds the columns for table hg_test.
var testColumns = TestColumns{
Id: "id",
CategoryId: "category_id",
Flag: "flag",
Title: "title",
Description: "description",
Content: "content",
Image: "image",
Images: "images",
Attachfile: "attachfile",
Attachfiles: "attachfiles",
Map: "map",
Star: "star",
Price: "price",
Views: "views",
ActivityAt: "activity_at",
StartAt: "start_at",
EndAt: "end_at",
Switch: "switch",
Sort: "sort",
Avatar: "avatar",
Sex: "sex",
Qq: "qq",
Email: "email",
Mobile: "mobile",
Hobby: "hobby",
Channel: "channel",
Pid: "pid",
Level: "level",
Tree: "tree",
Remark: "remark",
Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewTestDao creates and returns a new DAO object for table data access.
func NewTestDao() *TestDao {
return &TestDao{
group: "default",
table: "hg_test",
columns: testColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *TestDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *TestDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *TestDao) Columns() TestColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *TestDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *TestDao) 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 *TestDao) 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,89 @@
// ==========================================================================
// 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"
)
// TestCategoryDao is the data access object for table hg_test_category.
type TestCategoryDao 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 TestCategoryColumns // columns contains all the column names of Table for convenient usage.
}
// TestCategoryColumns defines and stores column names for table hg_test_category.
type TestCategoryColumns struct {
Id string // 分类ID
Name string // 分类名称
Description string // 描述
Sort string // 排序
Remark string // 备注
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// testCategoryColumns holds the columns for table hg_test_category.
var testCategoryColumns = TestCategoryColumns{
Id: "id",
Name: "name",
Description: "description",
Sort: "sort",
Remark: "remark",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewTestCategoryDao creates and returns a new DAO object for table data access.
func NewTestCategoryDao() *TestCategoryDao {
return &TestCategoryDao{
group: "default",
table: "hg_test_category",
columns: testCategoryColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *TestCategoryDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *TestCategoryDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *TestCategoryDao) Columns() TestCategoryColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *TestCategoryDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *TestCategoryDao) 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 *TestCategoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -7,6 +7,8 @@ package dao
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/dao/internal"
"hotgo/internal/model/input/sysin"
@@ -31,10 +33,8 @@ var (
)
func (dao *sysAttachmentDao) GetMd5File(ctx context.Context, md5 string) (data *sysin.AttachmentListModel, err error) {
if err = dao.Ctx(ctx).
Where("md5", md5).
Where("status", consts.StatusEnabled).
Scan(&data); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return nil, err
@@ -44,8 +44,21 @@ func (dao *sysAttachmentDao) GetMd5File(ctx context.Context, md5 string) (data *
return nil, nil
}
conf, err := service.SysConfig().GetUpload(ctx)
if err != nil {
return nil, nil
}
data.SizeFormat = format.FileSize(data.Size)
data.FileUrl = service.CommonUpload().LastUrl(ctx, data.FileUrl, data.Drive)
data.FileUrl = service.CommonUpload().LastUrl(ctx, conf, data.FileUrl, data.Drive)
// 只有在上传时才会检查md5值如果文件存在则更新最后上传时间保证上传列表更新显示在最前面
if data.Id > 0 {
_, _ = dao.Ctx(ctx).Where("id", data.Id).Data(g.Map{
"status": consts.StatusEnabled,
"updated_at": gtime.Now(),
}).Update()
}
return data, nil
}

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 (
"hotgo/internal/dao/internal"
)
// internalSysGenCodesDao is internal type for wrapping internal DAO implements.
type internalSysGenCodesDao = *internal.SysGenCodesDao
// sysGenCodesDao is the data access object for table hg_sys_gen_codes.
// You can define custom methods on it to extend its functionality as you wish.
type sysGenCodesDao struct {
internalSysGenCodesDao
}
var (
// SysGenCodes is globally public accessible object for table hg_sys_gen_codes operations.
SysGenCodes = sysGenCodesDao{
internal.NewSysGenCodesDao(),
}
)
// 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 (
"hotgo/internal/dao/internal"
)
// internalSysGenCurdDemoDao is internal type for wrapping internal DAO implements.
type internalSysGenCurdDemoDao = *internal.SysGenCurdDemoDao
// sysGenCurdDemoDao is the data access object for table hg_sys_gen_curd_demo.
// You can define custom methods on it to extend its functionality as you wish.
type sysGenCurdDemoDao struct {
internalSysGenCurdDemoDao
}
var (
// SysGenCurdDemo is globally public accessible object for table hg_sys_gen_curd_demo operations.
SysGenCurdDemo = sysGenCurdDemoDao{
internal.NewSysGenCurdDemoDao(),
}
)
// 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 (
"hotgo/internal/dao/internal"
)
// internalTestDao is internal type for wrapping internal DAO implements.
type internalTestDao = *internal.TestDao
// testDao is the data access object for table hg_test.
// You can define custom methods on it to extend its functionality as you wish.
type testDao struct {
internalTestDao
}
var (
// Test is globally public accessible object for table hg_test operations.
Test = testDao{
internal.NewTestDao(),
}
)
// 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 (
"hotgo/internal/dao/internal"
)
// internalTestCategoryDao is internal type for wrapping internal DAO implements.
type internalTestCategoryDao = *internal.TestCategoryDao
// testCategoryDao is the data access object for table hg_test_category.
// You can define custom methods on it to extend its functionality as you wish.
type testCategoryDao struct {
internalTestCategoryDao
}
var (
// TestCategory is globally public accessible object for table hg_test_category operations.
TestCategory = testCategoryDao{
internal.NewTestCategoryDao(),
}
)
// Fill with you ideas below.