mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
v2.0
This commit is contained in:
0
server/internal/dao/.gitkeep
Normal file
0
server/internal/dao/.gitkeep
Normal file
65
server/internal/dao/admin_dept.go
Normal file
65
server/internal/dao/admin_dept.go
Normal file
@@ -0,0 +1,65 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminDeptDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminDeptDao = *internal.AdminDeptDao
|
||||
|
||||
// adminDeptDao is the data access object for table hg_admin_dept.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminDeptDao struct {
|
||||
internalAdminDeptDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminDept is globally common accessible object for table hg_admin_dept operations.
|
||||
AdminDept = adminDeptDao{
|
||||
internal.NewAdminDeptDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// IsUniqueName 判断名称是否唯一
|
||||
func (dao *adminDeptDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminDept
|
||||
m := dao.Ctx(ctx).Where("name", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// TopPid 获取最上级pid
|
||||
func (dao *adminDeptDao) TopPid(ctx context.Context, data *entity.AdminDept) (int64, error) {
|
||||
var pidData *entity.AdminDept
|
||||
if data.Pid == 0 {
|
||||
return data.Id, nil
|
||||
}
|
||||
err := dao.Ctx(ctx).Where("id", data.Pid).Scan(&pidData)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return dao.TopPid(ctx, pidData)
|
||||
}
|
||||
119
server/internal/dao/admin_member.go
Normal file
119
server/internal/dao/admin_member.go
Normal file
@@ -0,0 +1,119 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminMemberDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminMemberDao = *internal.AdminMemberDao
|
||||
|
||||
// adminMemberDao is the data access object for table hg_admin_member.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminMemberDao struct {
|
||||
internalAdminMemberDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminMember is globally common accessible object for table hg_admin_member operations.
|
||||
AdminMember = adminMemberDao{
|
||||
internal.NewAdminMemberDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
|
||||
// IsUniqueName 判断用户名是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param name
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminDept
|
||||
m := dao.Ctx(ctx).Where("username", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueEmail 判断邮箱是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param email
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueEmail(ctx context.Context, id int64, email string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("email", email)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueMobile 判断手机号是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param mobile
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueMobile(ctx context.Context, id int64, mobile string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("mobile", mobile)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
90
server/internal/dao/admin_member_post.go
Normal file
90
server/internal/dao/admin_member_post.go
Normal file
@@ -0,0 +1,90 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminMemberPostDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminMemberPostDao = *internal.AdminMemberPostDao
|
||||
|
||||
// adminMemberPostDao is the data access object for table hg_admin_member_post.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminMemberPostDao struct {
|
||||
internalAdminMemberPostDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminMemberPost is globally common accessible object for table hg_admin_member_post operations.
|
||||
AdminMemberPost = adminMemberPostDao{
|
||||
internal.NewAdminMemberPostDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// UpdatePostIds
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param memberId
|
||||
// @param postIds
|
||||
// @return err
|
||||
//
|
||||
func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) {
|
||||
_, err = dao.Ctx(ctx).
|
||||
Where("member_id", memberId).
|
||||
Delete()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, "删除失败")
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(postIds); i++ {
|
||||
_, err = dao.Ctx(ctx).
|
||||
Insert(entity.AdminMemberPost{
|
||||
MemberId: memberId,
|
||||
PostId: postIds[i],
|
||||
})
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, "插入会员岗位失败")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMemberByIds 获取指定会员的岗位ids
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param memberId
|
||||
// @return postIds
|
||||
// @return err
|
||||
//
|
||||
func (dao *adminMemberPostDao) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) {
|
||||
|
||||
var list []*entity.AdminMemberPost
|
||||
err = dao.Ctx(ctx).
|
||||
Fields("post_id").
|
||||
Where("member_id", memberId).
|
||||
Scan(&list)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return postIds, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(list); i++ {
|
||||
postIds = append(postIds, list[i].PostId)
|
||||
}
|
||||
|
||||
g.Log().Print(ctx, "post_ids:", postIds)
|
||||
return postIds, nil
|
||||
}
|
||||
27
server/internal/dao/admin_member_role.go
Normal file
27
server/internal/dao/admin_member_role.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalAdminMemberRoleDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminMemberRoleDao = *internal.AdminMemberRoleDao
|
||||
|
||||
// adminMemberRoleDao is the data access object for table hg_admin_member_role.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminMemberRoleDao struct {
|
||||
internalAdminMemberRoleDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminMemberRole is globally common accessible object for table hg_admin_member_role operations.
|
||||
AdminMemberRole = adminMemberRoleDao{
|
||||
internal.NewAdminMemberRoleDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
165
server/internal/dao/admin_menu.go
Normal file
165
server/internal/dao/admin_menu.go
Normal file
@@ -0,0 +1,165 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminMenuDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminMenuDao = *internal.AdminMenuDao
|
||||
|
||||
// adminMenuDao is the data access object for table hg_admin_menu.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminMenuDao struct {
|
||||
internalAdminMenuDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminMenu is globally common accessible object for table hg_admin_menu operations.
|
||||
AdminMenu = adminMenuDao{
|
||||
internal.NewAdminMenuDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// IsUniqueTitle 判断标题是否唯一
|
||||
func (dao *adminMenuDao) IsUniqueTitle(ctx context.Context, id int64, title string) (bool, error) {
|
||||
var data *entity.AdminMenu
|
||||
m := dao.Ctx(ctx).Where("title", title)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueName 判断编码是否唯一
|
||||
func (dao *adminMenuDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminMenu
|
||||
m := dao.Ctx(ctx).Where("name", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GenLabelTreeList
|
||||
func (dao *adminMenuDao) GenLabelTreeList(ctx context.Context, pid int64) ([]*model.LabelTreeMenu, error) {
|
||||
|
||||
var (
|
||||
newLst []*model.LabelTreeMenu
|
||||
)
|
||||
if err := dao.Ctx(ctx).Where("pid", pid).Order("sort asc,id desc").Scan(&newLst); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(newLst); i++ {
|
||||
newLst[i].Key = newLst[i].Id
|
||||
newLst[i].Label = newLst[i].Name
|
||||
err := dao.Ctx(ctx).Where("pid", newLst[i].Id).Order("sort asc,id desc").Scan(&newLst[i].Children)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i2 := 0; i2 < len(newLst[i].Children); i2++ {
|
||||
newLst[i].Children[i2].Key = newLst[i].Children[i2].Id
|
||||
newLst[i].Children[i2].Label = newLst[i].Children[i2].Name
|
||||
}
|
||||
}
|
||||
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
//
|
||||
// @Title 生成树列表
|
||||
// @Description
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @Param ctx
|
||||
// @Param pid
|
||||
// @Param lists
|
||||
// @Return []*model.TreeMenu
|
||||
// @Return error
|
||||
//
|
||||
func (dao *adminMenuDao) GenTreeList(ctx context.Context, pid int64, ids []int64) ([]*model.TreeMenu, error) {
|
||||
|
||||
var (
|
||||
newLst []*model.TreeMenu
|
||||
)
|
||||
if err := dao.Ctx(ctx).Where("id", ids).Where("pid", pid).Order("sort asc,id desc").Scan(&newLst); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(newLst); i++ {
|
||||
err := dao.Ctx(ctx).Where("pid", newLst[i].Id).Order("sort asc,id desc").Scan(&newLst[i].Children)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
//
|
||||
// @Title 获取最上级pid
|
||||
// @Description
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @Param ctx
|
||||
// @Param data
|
||||
// @Return int64
|
||||
// @Return error
|
||||
//
|
||||
|
||||
//
|
||||
// TopPid
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param data
|
||||
// @return int64
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMenuDao) TopPid(ctx context.Context, data *entity.AdminMenu) (int64, error) {
|
||||
var pidData *entity.AdminMenu
|
||||
if data.Pid == 0 {
|
||||
return data.Id, nil
|
||||
}
|
||||
err := dao.Ctx(ctx).Where("id", data.Pid).Scan(&pidData)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return dao.TopPid(ctx, pidData)
|
||||
}
|
||||
27
server/internal/dao/admin_notice.go
Normal file
27
server/internal/dao/admin_notice.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalAdminNoticeDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminNoticeDao = *internal.AdminNoticeDao
|
||||
|
||||
// adminNoticeDao is the data access object for table hg_admin_notice.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminNoticeDao struct {
|
||||
internalAdminNoticeDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminNotice is globally common accessible object for table hg_admin_notice operations.
|
||||
AdminNotice = adminNoticeDao{
|
||||
internal.NewAdminNoticeDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
71
server/internal/dao/admin_post.go
Normal file
71
server/internal/dao/admin_post.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminPostDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminPostDao = *internal.AdminPostDao
|
||||
|
||||
// adminPostDao is the data access object for table hg_admin_post.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminPostDao struct {
|
||||
internalAdminPostDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminPost is globally common accessible object for table hg_admin_post operations.
|
||||
AdminPost = adminPostDao{
|
||||
internal.NewAdminPostDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// IsUniqueName 判断名称是否唯一
|
||||
func (dao *adminPostDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminPost
|
||||
m := dao.Ctx(ctx).Where("name", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueCode 判断编码是否唯一
|
||||
func (dao *adminPostDao) IsUniqueCode(ctx context.Context, id int64, code string) (bool, error) {
|
||||
var data *entity.AdminPost
|
||||
m := dao.Ctx(ctx).Where("code", code)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
71
server/internal/dao/admin_role.go
Normal file
71
server/internal/dao/admin_role.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalAdminRoleDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminRoleDao = *internal.AdminRoleDao
|
||||
|
||||
// adminRoleDao is the data access object for table hg_admin_role.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminRoleDao struct {
|
||||
internalAdminRoleDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminRole is globally common accessible object for table hg_admin_role operations.
|
||||
AdminRole = adminRoleDao{
|
||||
internal.NewAdminRoleDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// IsUniqueName 判断名称是否唯一
|
||||
func (dao *adminRoleDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminRole
|
||||
m := dao.Ctx(ctx).Where("name", name)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsUniqueCode 判断编码是否唯一
|
||||
func (dao *adminRoleDao) IsUniqueCode(ctx context.Context, id int64, code string) (bool, error) {
|
||||
var data *entity.AdminRole
|
||||
m := dao.Ctx(ctx).Where("key", code)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
27
server/internal/dao/admin_role_casbin.go
Normal file
27
server/internal/dao/admin_role_casbin.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalAdminRoleCasbinDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminRoleCasbinDao = *internal.AdminRoleCasbinDao
|
||||
|
||||
// adminRoleCasbinDao is the data access object for table hg_admin_role_casbin.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminRoleCasbinDao struct {
|
||||
internalAdminRoleCasbinDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminRoleCasbin is globally public accessible object for table hg_admin_role_casbin operations.
|
||||
AdminRoleCasbin = adminRoleCasbinDao{
|
||||
internal.NewAdminRoleCasbinDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
27
server/internal/dao/admin_role_dept.go
Normal file
27
server/internal/dao/admin_role_dept.go
Normal 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"
|
||||
)
|
||||
|
||||
// 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.
|
||||
27
server/internal/dao/admin_role_menu.go
Normal file
27
server/internal/dao/admin_role_menu.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalAdminRoleMenuDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminRoleMenuDao = *internal.AdminRoleMenuDao
|
||||
|
||||
// adminRoleMenuDao is the data access object for table hg_admin_role_menu.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminRoleMenuDao struct {
|
||||
internalAdminRoleMenuDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminRoleMenu is globally common accessible object for table hg_admin_role_menu operations.
|
||||
AdminRoleMenu = adminRoleMenuDao{
|
||||
internal.NewAdminRoleMenuDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
95
server/internal/dao/internal/admin_dept.go
Normal file
95
server/internal/dao/internal/admin_dept.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminDeptDao is the data access object for table hg_admin_dept.
|
||||
type AdminDeptDao 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 AdminDeptColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminDeptColumns defines and stores column names for table hg_admin_dept.
|
||||
type AdminDeptColumns struct {
|
||||
Id string // 部门id
|
||||
Pid string // 父部门id
|
||||
Name string // 部门名称
|
||||
Code string // 部门编码
|
||||
Type string // 部门类型
|
||||
Leader string // 负责人
|
||||
Phone string // 联系电话
|
||||
Email string // 邮箱
|
||||
Sort string // 排序
|
||||
Status string // 部门状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// adminDeptColumns holds the columns for table hg_admin_dept.
|
||||
var adminDeptColumns = AdminDeptColumns{
|
||||
Id: "id",
|
||||
Pid: "pid",
|
||||
Name: "name",
|
||||
Code: "code",
|
||||
Type: "type",
|
||||
Leader: "leader",
|
||||
Phone: "phone",
|
||||
Email: "email",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminDeptDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminDeptDao() *AdminDeptDao {
|
||||
return &AdminDeptDao{
|
||||
group: "default",
|
||||
table: "hg_admin_dept",
|
||||
columns: adminDeptColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminDeptDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminDeptDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminDeptDao) Columns() AdminDeptColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminDeptDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminDeptDao) 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 *AdminDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
129
server/internal/dao/internal/admin_member.go
Normal file
129
server/internal/dao/internal/admin_member.go
Normal file
@@ -0,0 +1,129 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AdminMemberDao is the data access object for table hg_admin_member.
|
||||
type AdminMemberDao 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 AdminMemberColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminMemberColumns defines and stores column names for table hg_admin_member.
|
||||
type AdminMemberColumns struct {
|
||||
Id string //
|
||||
DeptId string // 部门ID
|
||||
Username string // 帐号
|
||||
PasswordHash string // 密码
|
||||
Salt string // 密码盐
|
||||
AuthKey string // 授权令牌
|
||||
PasswordResetToken string // 密码重置令牌
|
||||
Type string // 1:普通管理员;10超级管理员
|
||||
Realname string // 真实姓名
|
||||
Avatar string // 头像
|
||||
Sex string // 性别[1:男;2:女;3:未知]
|
||||
Qq string // qq
|
||||
Email string // 邮箱
|
||||
Birthday string // 生日
|
||||
ProvinceId string // 省
|
||||
CityId string // 城市
|
||||
AreaId string // 地区
|
||||
Address string // 默认地址
|
||||
Mobile string // 手机号码
|
||||
HomePhone string // 家庭号码
|
||||
DingtalkRobotToken string // 钉钉机器人token
|
||||
VisitCount string // 访问次数
|
||||
LastTime string // 最后一次登录时间
|
||||
LastIp string // 最后一次登录ip
|
||||
Role string // 权限
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// adminMemberColumns holds the columns for table hg_admin_member.
|
||||
var adminMemberColumns = AdminMemberColumns{
|
||||
Id: "id",
|
||||
DeptId: "dept_id",
|
||||
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",
|
||||
Birthday: "birthday",
|
||||
ProvinceId: "province_id",
|
||||
CityId: "city_id",
|
||||
AreaId: "area_id",
|
||||
Address: "address",
|
||||
Mobile: "mobile",
|
||||
HomePhone: "home_phone",
|
||||
DingtalkRobotToken: "dingtalk_robot_token",
|
||||
VisitCount: "visit_count",
|
||||
LastTime: "last_time",
|
||||
LastIp: "last_ip",
|
||||
Role: "role",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminMemberDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminMemberDao() *AdminMemberDao {
|
||||
return &AdminMemberDao{
|
||||
group: "default",
|
||||
table: "hg_admin_member",
|
||||
columns: adminMemberColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminMemberDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminMemberDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminMemberDao) Columns() AdminMemberColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminMemberDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminMemberDao) 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 *AdminMemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
75
server/internal/dao/internal/admin_member_post.go
Normal file
75
server/internal/dao/internal/admin_member_post.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminMemberPostDao is the data access object for table hg_admin_member_post.
|
||||
type AdminMemberPostDao 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 AdminMemberPostColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminMemberPostColumns defines and stores column names for table hg_admin_member_post.
|
||||
type AdminMemberPostColumns struct {
|
||||
MemberId string // 用户ID
|
||||
PostId string // 岗位ID
|
||||
}
|
||||
|
||||
// adminMemberPostColumns holds the columns for table hg_admin_member_post.
|
||||
var adminMemberPostColumns = AdminMemberPostColumns{
|
||||
MemberId: "member_id",
|
||||
PostId: "post_id",
|
||||
}
|
||||
|
||||
// NewAdminMemberPostDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminMemberPostDao() *AdminMemberPostDao {
|
||||
return &AdminMemberPostDao{
|
||||
group: "default",
|
||||
table: "hg_admin_member_post",
|
||||
columns: adminMemberPostColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminMemberPostDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminMemberPostDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminMemberPostDao) Columns() AdminMemberPostColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminMemberPostDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminMemberPostDao) 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 *AdminMemberPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
75
server/internal/dao/internal/admin_member_role.go
Normal file
75
server/internal/dao/internal/admin_member_role.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminMemberRoleDao is the data access object for table hg_admin_member_role.
|
||||
type AdminMemberRoleDao 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 AdminMemberRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminMemberRoleColumns defines and stores column names for table hg_admin_member_role.
|
||||
type AdminMemberRoleColumns struct {
|
||||
MemberId string // 用户ID
|
||||
RoleId string // 角色ID
|
||||
}
|
||||
|
||||
// adminMemberRoleColumns holds the columns for table hg_admin_member_role.
|
||||
var adminMemberRoleColumns = AdminMemberRoleColumns{
|
||||
MemberId: "member_id",
|
||||
RoleId: "role_id",
|
||||
}
|
||||
|
||||
// NewAdminMemberRoleDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminMemberRoleDao() *AdminMemberRoleDao {
|
||||
return &AdminMemberRoleDao{
|
||||
group: "default",
|
||||
table: "hg_admin_member_role",
|
||||
columns: adminMemberRoleColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminMemberRoleDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminMemberRoleDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminMemberRoleDao) Columns() AdminMemberRoleColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminMemberRoleDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminMemberRoleDao) 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 *AdminMemberRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
123
server/internal/dao/internal/admin_menu.go
Normal file
123
server/internal/dao/internal/admin_menu.go
Normal file
@@ -0,0 +1,123 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AdminMenuDao is the data access object for table hg_admin_menu.
|
||||
type AdminMenuDao 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 AdminMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminMenuColumns defines and stores column names for table hg_admin_menu.
|
||||
type AdminMenuColumns struct {
|
||||
Id string // 菜单ID
|
||||
Pid string // 父菜单ID
|
||||
Title string // 菜单名称
|
||||
Name string // 名称编码
|
||||
Path string // 路由地址
|
||||
Icon string // 菜单图标
|
||||
Type string // 菜单类型(1目录 2菜单 3按钮)
|
||||
Redirect string // 重定向地址
|
||||
Permissions string // 菜单包含权限集合
|
||||
PermissionName string // 权限名称
|
||||
Component string // 组件路径
|
||||
AlwaysShow string // 取消自动计算根路由模式
|
||||
ActiveMenu string // 高亮菜单编码
|
||||
IsRoot string // 是否跟路由
|
||||
IsFrame string // 是否内嵌
|
||||
FrameSrc string // 内联外部地址
|
||||
KeepAlive string // 缓存该路由
|
||||
Hidden string // 是否隐藏
|
||||
Affix string // 是否固定
|
||||
Level string // 级别
|
||||
Tree string // 树
|
||||
Sort string // 排序
|
||||
Remark string // 备注
|
||||
Status string // 菜单状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// adminMenuColumns holds the columns for table hg_admin_menu.
|
||||
var adminMenuColumns = AdminMenuColumns{
|
||||
Id: "id",
|
||||
Pid: "pid",
|
||||
Title: "title",
|
||||
Name: "name",
|
||||
Path: "path",
|
||||
Icon: "icon",
|
||||
Type: "type",
|
||||
Redirect: "redirect",
|
||||
Permissions: "permissions",
|
||||
PermissionName: "permission_name",
|
||||
Component: "component",
|
||||
AlwaysShow: "always_show",
|
||||
ActiveMenu: "active_menu",
|
||||
IsRoot: "is_root",
|
||||
IsFrame: "is_frame",
|
||||
FrameSrc: "frame_src",
|
||||
KeepAlive: "keep_alive",
|
||||
Hidden: "hidden",
|
||||
Affix: "affix",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminMenuDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminMenuDao() *AdminMenuDao {
|
||||
return &AdminMenuDao{
|
||||
group: "default",
|
||||
table: "hg_admin_menu",
|
||||
columns: adminMenuColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminMenuDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminMenuDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminMenuDao) Columns() AdminMenuColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminMenuDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminMenuDao) 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 *AdminMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
93
server/internal/dao/internal/admin_notice.go
Normal file
93
server/internal/dao/internal/admin_notice.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AdminNoticeDao is the data access object for table hg_admin_notice.
|
||||
type AdminNoticeDao 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 AdminNoticeColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminNoticeColumns defines and stores column names for table hg_admin_notice.
|
||||
type AdminNoticeColumns struct {
|
||||
Id string // 公告ID
|
||||
Title string // 公告标题
|
||||
Type string // 公告类型(1通知 2公告)
|
||||
Content string // 公告内容
|
||||
Receiver string // 接收者
|
||||
Reader string // 已读人
|
||||
Remark string // 备注
|
||||
Sort string // 排序
|
||||
Status string // 公告状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// adminNoticeColumns holds the columns for table hg_admin_notice.
|
||||
var adminNoticeColumns = AdminNoticeColumns{
|
||||
Id: "id",
|
||||
Title: "title",
|
||||
Type: "type",
|
||||
Content: "content",
|
||||
Receiver: "receiver",
|
||||
Reader: "reader",
|
||||
Remark: "remark",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminNoticeDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminNoticeDao() *AdminNoticeDao {
|
||||
return &AdminNoticeDao{
|
||||
group: "default",
|
||||
table: "hg_admin_notice",
|
||||
columns: adminNoticeColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminNoticeDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminNoticeDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminNoticeDao) Columns() AdminNoticeColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminNoticeDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminNoticeDao) 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 *AdminNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
87
server/internal/dao/internal/admin_post.go
Normal file
87
server/internal/dao/internal/admin_post.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminPostDao is the data access object for table hg_admin_post.
|
||||
type AdminPostDao 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 AdminPostColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminPostColumns defines and stores column names for table hg_admin_post.
|
||||
type AdminPostColumns struct {
|
||||
Id string // 岗位ID
|
||||
Code string // 岗位编码
|
||||
Name string // 岗位名称
|
||||
Remark string // 备注
|
||||
Sort string // 显示顺序
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// adminPostColumns holds the columns for table hg_admin_post.
|
||||
var adminPostColumns = AdminPostColumns{
|
||||
Id: "id",
|
||||
Code: "code",
|
||||
Name: "name",
|
||||
Remark: "remark",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminPostDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminPostDao() *AdminPostDao {
|
||||
return &AdminPostDao{
|
||||
group: "default",
|
||||
table: "hg_admin_post",
|
||||
columns: adminPostColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminPostDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminPostDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminPostDao) Columns() AdminPostColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminPostDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminPostDao) 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 *AdminPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
93
server/internal/dao/internal/admin_role.go
Normal file
93
server/internal/dao/internal/admin_role.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AdminRoleDao is the data access object for table hg_admin_role.
|
||||
type AdminRoleDao 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 AdminRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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 // 更新时间
|
||||
}
|
||||
|
||||
// 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",
|
||||
}
|
||||
|
||||
// NewAdminRoleDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminRoleDao() *AdminRoleDao {
|
||||
return &AdminRoleDao{
|
||||
group: "default",
|
||||
table: "hg_admin_role",
|
||||
columns: adminRoleColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminRoleDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminRoleDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminRoleDao) Columns() AdminRoleColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminRoleDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminRoleDao) 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 *AdminRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
87
server/internal/dao/internal/admin_role_casbin.go
Normal file
87
server/internal/dao/internal/admin_role_casbin.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminRoleCasbinDao is the data access object for table hg_admin_role_casbin.
|
||||
type AdminRoleCasbinDao 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 AdminRoleCasbinColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminRoleCasbinColumns defines and stores column names for table hg_admin_role_casbin.
|
||||
type AdminRoleCasbinColumns struct {
|
||||
Id string //
|
||||
PType string //
|
||||
V0 string //
|
||||
V1 string //
|
||||
V2 string //
|
||||
V3 string //
|
||||
V4 string //
|
||||
V5 string //
|
||||
}
|
||||
|
||||
// adminRoleCasbinColumns holds the columns for table hg_admin_role_casbin.
|
||||
var adminRoleCasbinColumns = AdminRoleCasbinColumns{
|
||||
Id: "id",
|
||||
PType: "p_type",
|
||||
V0: "v0",
|
||||
V1: "v1",
|
||||
V2: "v2",
|
||||
V3: "v3",
|
||||
V4: "v4",
|
||||
V5: "v5",
|
||||
}
|
||||
|
||||
// NewAdminRoleCasbinDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminRoleCasbinDao() *AdminRoleCasbinDao {
|
||||
return &AdminRoleCasbinDao{
|
||||
group: "default",
|
||||
table: "hg_admin_role_casbin",
|
||||
columns: adminRoleCasbinColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminRoleCasbinDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminRoleCasbinDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminRoleCasbinDao) Columns() AdminRoleCasbinColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminRoleCasbinDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminRoleCasbinDao) 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 *AdminRoleCasbinDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
75
server/internal/dao/internal/admin_role_dept.go
Normal file
75
server/internal/dao/internal/admin_role_dept.go
Normal 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"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
75
server/internal/dao/internal/admin_role_menu.go
Normal file
75
server/internal/dao/internal/admin_role_menu.go
Normal 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"
|
||||
)
|
||||
|
||||
// AdminRoleMenuDao is the data access object for table hg_admin_role_menu.
|
||||
type AdminRoleMenuDao 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 AdminRoleMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminRoleMenuColumns defines and stores column names for table hg_admin_role_menu.
|
||||
type AdminRoleMenuColumns struct {
|
||||
RoleId string // 角色ID
|
||||
MenuId string // 菜单ID
|
||||
}
|
||||
|
||||
// adminRoleMenuColumns holds the columns for table hg_admin_role_menu.
|
||||
var adminRoleMenuColumns = AdminRoleMenuColumns{
|
||||
RoleId: "role_id",
|
||||
MenuId: "menu_id",
|
||||
}
|
||||
|
||||
// NewAdminRoleMenuDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminRoleMenuDao() *AdminRoleMenuDao {
|
||||
return &AdminRoleMenuDao{
|
||||
group: "default",
|
||||
table: "hg_admin_role_menu",
|
||||
columns: adminRoleMenuColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminRoleMenuDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminRoleMenuDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminRoleMenuDao) Columns() AdminRoleMenuColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminRoleMenuDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminRoleMenuDao) 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 *AdminRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
105
server/internal/dao/internal/sys_attachment.go
Normal file
105
server/internal/dao/internal/sys_attachment.go
Normal file
@@ -0,0 +1,105 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SysAttachmentDao is the data access object for table hg_sys_attachment.
|
||||
type SysAttachmentDao 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 SysAttachmentColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysAttachmentColumns defines and stores column names for table hg_sys_attachment.
|
||||
type SysAttachmentColumns struct {
|
||||
Id string //
|
||||
AppId string // 应用ID
|
||||
MemberId string // 用户
|
||||
CateId string // 分类
|
||||
Drive string // 驱动
|
||||
Name string // 文件原始名
|
||||
Kind string // 上传类型
|
||||
MetaType string // 类别
|
||||
NaiveType string // NaiveUI类型
|
||||
Path string // 本地路径
|
||||
FileUrl string // url
|
||||
Size string // 长度
|
||||
Ext string // 扩展名
|
||||
Md5 string // md5校验码
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysAttachmentColumns holds the columns for table hg_sys_attachment.
|
||||
var sysAttachmentColumns = SysAttachmentColumns{
|
||||
Id: "id",
|
||||
AppId: "app_id",
|
||||
MemberId: "member_id",
|
||||
CateId: "cate_id",
|
||||
Drive: "drive",
|
||||
Name: "name",
|
||||
Kind: "kind",
|
||||
MetaType: "meta_type",
|
||||
NaiveType: "naive_type",
|
||||
Path: "path",
|
||||
FileUrl: "file_url",
|
||||
Size: "size",
|
||||
Ext: "ext",
|
||||
Md5: "md5",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysAttachmentDao creates and returns a new DAO object for table data access.
|
||||
func NewSysAttachmentDao() *SysAttachmentDao {
|
||||
return &SysAttachmentDao{
|
||||
group: "default",
|
||||
table: "hg_sys_attachment",
|
||||
columns: sysAttachmentColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysAttachmentDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysAttachmentDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysAttachmentDao) Columns() SysAttachmentColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysAttachmentDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysAttachmentDao) 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 *SysAttachmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
83
server/internal/dao/internal/sys_blacklist.go
Normal file
83
server/internal/dao/internal/sys_blacklist.go
Normal file
@@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SysBlacklistDao is the data access object for table hg_sys_blacklist.
|
||||
type SysBlacklistDao 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 SysBlacklistColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysBlacklistColumns defines and stores column names for table hg_sys_blacklist.
|
||||
type SysBlacklistColumns struct {
|
||||
Id string // 主键
|
||||
Ip string // ip地址
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysBlacklistColumns holds the columns for table hg_sys_blacklist.
|
||||
var sysBlacklistColumns = SysBlacklistColumns{
|
||||
Id: "id",
|
||||
Ip: "ip",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysBlacklistDao creates and returns a new DAO object for table data access.
|
||||
func NewSysBlacklistDao() *SysBlacklistDao {
|
||||
return &SysBlacklistDao{
|
||||
group: "default",
|
||||
table: "hg_sys_blacklist",
|
||||
columns: sysBlacklistColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysBlacklistDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysBlacklistDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysBlacklistDao) Columns() SysBlacklistColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysBlacklistDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysBlacklistDao) 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 *SysBlacklistDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
97
server/internal/dao/internal/sys_config.go
Normal file
97
server/internal/dao/internal/sys_config.go
Normal file
@@ -0,0 +1,97 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysConfigDao is the data access object for table hg_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 hg_sys_config.
|
||||
type SysConfigColumns struct {
|
||||
Id string // 配置ID
|
||||
Group string // 分组
|
||||
Name string // 参数名称
|
||||
Type string // 类型:string,text,int,bool,array,datetime,date,file
|
||||
Key string // 参数键名
|
||||
Value string // 参数键值
|
||||
DefaultValue string // 默认值
|
||||
Sort string // 排序
|
||||
Tip string // 变量描述
|
||||
IsDefault string // 是否默认
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysConfigColumns holds the columns for table hg_sys_config.
|
||||
var sysConfigColumns = SysConfigColumns{
|
||||
Id: "id",
|
||||
Group: "group",
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
Key: "key",
|
||||
Value: "value",
|
||||
DefaultValue: "default_value",
|
||||
Sort: "sort",
|
||||
Tip: "tip",
|
||||
IsDefault: "is_default",
|
||||
Status: "status",
|
||||
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: "hg_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)
|
||||
}
|
||||
95
server/internal/dao/internal/sys_cron.go
Normal file
95
server/internal/dao/internal/sys_cron.go
Normal 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"
|
||||
)
|
||||
|
||||
// SysCronDao is the data access object for table hg_sys_cron.
|
||||
type SysCronDao 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 SysCronColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysCronColumns defines and stores column names for table hg_sys_cron.
|
||||
type SysCronColumns struct {
|
||||
Id string // 主键
|
||||
GroupId string // 分组ID
|
||||
Name string // 任务名称
|
||||
Params string // 函数参数
|
||||
Pattern string // 定时表达式
|
||||
Policy string // 策略
|
||||
Count string // 执行次数
|
||||
Sort string // 排序
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysCronColumns holds the columns for table hg_sys_cron.
|
||||
var sysCronColumns = SysCronColumns{
|
||||
Id: "id",
|
||||
GroupId: "group_id",
|
||||
Name: "name",
|
||||
Params: "params",
|
||||
Pattern: "pattern",
|
||||
Policy: "policy",
|
||||
Count: "count",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysCronDao creates and returns a new DAO object for table data access.
|
||||
func NewSysCronDao() *SysCronDao {
|
||||
return &SysCronDao{
|
||||
group: "default",
|
||||
table: "hg_sys_cron",
|
||||
columns: sysCronColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysCronDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysCronDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysCronDao) Columns() SysCronColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysCronDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysCronDao) 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 *SysCronDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
89
server/internal/dao/internal/sys_cron_group.go
Normal file
89
server/internal/dao/internal/sys_cron_group.go
Normal 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"
|
||||
)
|
||||
|
||||
// SysCronGroupDao is the data access object for table hg_sys_cron_group.
|
||||
type SysCronGroupDao 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 SysCronGroupColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysCronGroupColumns defines and stores column names for table hg_sys_cron_group.
|
||||
type SysCronGroupColumns struct {
|
||||
Id string // 主键
|
||||
Pid string // 父类ID
|
||||
Name string // 分组名称
|
||||
IsDefault string // 是否默认
|
||||
Sort string // 排序
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysCronGroupColumns holds the columns for table hg_sys_cron_group.
|
||||
var sysCronGroupColumns = SysCronGroupColumns{
|
||||
Id: "id",
|
||||
Pid: "pid",
|
||||
Name: "name",
|
||||
IsDefault: "is_default",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysCronGroupDao creates and returns a new DAO object for table data access.
|
||||
func NewSysCronGroupDao() *SysCronGroupDao {
|
||||
return &SysCronGroupDao{
|
||||
group: "default",
|
||||
table: "hg_sys_cron_group",
|
||||
columns: sysCronGroupColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysCronGroupDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysCronGroupDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysCronGroupDao) Columns() SysCronGroupColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysCronGroupDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysCronGroupDao) 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 *SysCronGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
93
server/internal/dao/internal/sys_dict_data.go
Normal file
93
server/internal/dao/internal/sys_dict_data.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysDictDataDao is the data access object for table hg_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 hg_sys_dict_data.
|
||||
type SysDictDataColumns struct {
|
||||
Id string // 字典编码
|
||||
Label string // 字典标签
|
||||
Value string // 字典键值
|
||||
Type string // 字典类型
|
||||
ListClass string // 表格回显样式
|
||||
IsDefault string // 是否默认
|
||||
Sort string // 字典排序
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysDictDataColumns holds the columns for table hg_sys_dict_data.
|
||||
var sysDictDataColumns = SysDictDataColumns{
|
||||
Id: "id",
|
||||
Label: "label",
|
||||
Value: "value",
|
||||
Type: "type",
|
||||
ListClass: "list_class",
|
||||
IsDefault: "is_default",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
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: "hg_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)
|
||||
}
|
||||
89
server/internal/dao/internal/sys_dict_type.go
Normal file
89
server/internal/dao/internal/sys_dict_type.go
Normal 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"
|
||||
)
|
||||
|
||||
// SysDictTypeDao is the data access object for table hg_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 hg_sys_dict_type.
|
||||
type SysDictTypeColumns struct {
|
||||
Id string // 字典主键
|
||||
Pid string // 父类ID
|
||||
Name string // 字典名称
|
||||
Type string // 字典类型
|
||||
Sort string // 排序
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysDictTypeColumns holds the columns for table hg_sys_dict_type.
|
||||
var sysDictTypeColumns = SysDictTypeColumns{
|
||||
Id: "id",
|
||||
Pid: "pid",
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
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: "hg_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)
|
||||
}
|
||||
117
server/internal/dao/internal/sys_log.go
Normal file
117
server/internal/dao/internal/sys_log.go
Normal file
@@ -0,0 +1,117 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SysLogDao is the data access object for table hg_sys_log.
|
||||
type SysLogDao 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 SysLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// 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
|
||||
Method string // 提交类型
|
||||
Module string // 模块
|
||||
Url string // 提交url
|
||||
GetData string // get数据
|
||||
PostData string // post数据
|
||||
HeaderData string // header数据
|
||||
Ip string // ip地址
|
||||
ProvinceId string // 省编码
|
||||
CityId string // 市编码
|
||||
ErrorCode string // 报错code
|
||||
ErrorMsg string // 报错信息
|
||||
ErrorData string // 报错日志
|
||||
ReqId string // 对外id
|
||||
Timestamp string // 响应时间
|
||||
UserAgent string // UA信息
|
||||
TakeUpTime string // 请求耗时
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysLogColumns holds the columns for table hg_sys_log.
|
||||
var sysLogColumns = SysLogColumns{
|
||||
Id: "id",
|
||||
AppId: "app_id",
|
||||
MerchantId: "merchant_id",
|
||||
MemberId: "member_id",
|
||||
Method: "method",
|
||||
Module: "module",
|
||||
Url: "url",
|
||||
GetData: "get_data",
|
||||
PostData: "post_data",
|
||||
HeaderData: "header_data",
|
||||
Ip: "ip",
|
||||
ProvinceId: "province_id",
|
||||
CityId: "city_id",
|
||||
ErrorCode: "error_code",
|
||||
ErrorMsg: "error_msg",
|
||||
ErrorData: "error_data",
|
||||
ReqId: "req_id",
|
||||
Timestamp: "timestamp",
|
||||
UserAgent: "user_agent",
|
||||
TakeUpTime: "take_up_time",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysLogDao creates and returns a new DAO object for table data access.
|
||||
func NewSysLogDao() *SysLogDao {
|
||||
return &SysLogDao{
|
||||
group: "default",
|
||||
table: "hg_sys_log",
|
||||
columns: sysLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysLogDao) Columns() SysLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysLogDao) 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 *SysLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
101
server/internal/dao/internal/sys_provinces.go
Normal file
101
server/internal/dao/internal/sys_provinces.go
Normal 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"
|
||||
)
|
||||
|
||||
// SysProvincesDao is the data access object for table hg_sys_provinces.
|
||||
type SysProvincesDao 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 SysProvincesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysProvincesColumns defines and stores column names for table hg_sys_provinces.
|
||||
type SysProvincesColumns struct {
|
||||
Id string // ID
|
||||
Title string // 栏目名
|
||||
Pid string // 父栏目
|
||||
ShortTitle string // 缩写
|
||||
Areacode string // 区域编码
|
||||
Zipcode string // 邮政编码
|
||||
Pinyin string // 拼音
|
||||
Lng string // 经度
|
||||
Lat string // 纬度
|
||||
Level string // 级别
|
||||
Tree string //
|
||||
Sort string // 排序
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// 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",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysProvincesDao creates and returns a new DAO object for table data access.
|
||||
func NewSysProvincesDao() *SysProvincesDao {
|
||||
return &SysProvincesDao{
|
||||
group: "default",
|
||||
table: "hg_sys_provinces",
|
||||
columns: sysProvincesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysProvincesDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysProvincesDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysProvincesDao) Columns() SysProvincesColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysProvincesDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysProvincesDao) 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 *SysProvincesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
51
server/internal/dao/sys_attachment.go
Normal file
51
server/internal/dao/sys_attachment.go
Normal file
@@ -0,0 +1,51 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/format"
|
||||
)
|
||||
|
||||
// internalSysAttachmentDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysAttachmentDao = *internal.SysAttachmentDao
|
||||
|
||||
// sysAttachmentDao is the data access object for table hg_sys_attachment.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysAttachmentDao struct {
|
||||
internalSysAttachmentDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysAttachment is globally public accessible object for table hg_sys_attachment operations.
|
||||
SysAttachment = sysAttachmentDao{
|
||||
internal.NewSysAttachmentDao(),
|
||||
}
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
data.SizeFormat = format.FileSize(data.Size)
|
||||
data.FileUrl = service.CommonUpload().LastUrl(ctx, data.FileUrl, data.Drive)
|
||||
|
||||
return data, nil
|
||||
}
|
||||
27
server/internal/dao/sys_blacklist.go
Normal file
27
server/internal/dao/sys_blacklist.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalSysBlacklistDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysBlacklistDao = *internal.SysBlacklistDao
|
||||
|
||||
// sysBlacklistDao is the data access object for table hg_sys_blacklist.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysBlacklistDao struct {
|
||||
internalSysBlacklistDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysBlacklist is globally public accessible object for table hg_sys_blacklist operations.
|
||||
SysBlacklist = sysBlacklistDao{
|
||||
internal.NewSysBlacklistDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
27
server/internal/dao/sys_config.go
Normal file
27
server/internal/dao/sys_config.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalSysConfigDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysConfigDao = *internal.SysConfigDao
|
||||
|
||||
// sysConfigDao is the data access object for table hg_sys_config.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysConfigDao struct {
|
||||
internalSysConfigDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysConfig is globally common accessible object for table hg_sys_config operations.
|
||||
SysConfig = sysConfigDao{
|
||||
internal.NewSysConfigDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
27
server/internal/dao/sys_cron.go
Normal file
27
server/internal/dao/sys_cron.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalSysCronDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysCronDao = *internal.SysCronDao
|
||||
|
||||
// sysCronDao is the data access object for table hg_sys_cron.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysCronDao struct {
|
||||
internalSysCronDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysCron is globally public accessible object for table hg_sys_cron operations.
|
||||
SysCron = sysCronDao{
|
||||
internal.NewSysCronDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
40
server/internal/dao/sys_cron_group.go
Normal file
40
server/internal/dao/sys_cron_group.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalSysCronGroupDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysCronGroupDao = *internal.SysCronGroupDao
|
||||
|
||||
// sysCronGroupDao is the data access object for table hg_sys_cron_group.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysCronGroupDao struct {
|
||||
internalSysCronGroupDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysCronGroup is globally public accessible object for table hg_sys_cron_group operations.
|
||||
SysCronGroup = sysCronGroupDao{
|
||||
internal.NewSysCronGroupDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// GetName 获取分组名称
|
||||
func (dao *sysCronGroupDao) GetName(ctx context.Context, id int64) (name string, err error) {
|
||||
m := dao.Ctx(ctx).Fields("name").Where("id", id)
|
||||
list, err := m.Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return name, err
|
||||
}
|
||||
|
||||
return list.String(), nil
|
||||
}
|
||||
27
server/internal/dao/sys_dict_data.go
Normal file
27
server/internal/dao/sys_dict_data.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalSysDictDataDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysDictDataDao = *internal.SysDictDataDao
|
||||
|
||||
// sysDictDataDao is the data access object for table hg_sys_dict_data.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysDictDataDao struct {
|
||||
internalSysDictDataDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysDictData is globally common accessible object for table hg_sys_dict_data operations.
|
||||
SysDictData = sysDictDataDao{
|
||||
internal.NewSysDictDataDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
99
server/internal/dao/sys_dict_type.go
Normal file
99
server/internal/dao/sys_dict_type.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// internalSysDictTypeDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysDictTypeDao = *internal.SysDictTypeDao
|
||||
|
||||
// sysDictTypeDao is the data access object for table hg_sys_dict_type.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysDictTypeDao struct {
|
||||
internalSysDictTypeDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysDictType is globally common accessible object for table hg_sys_dict_type operations.
|
||||
SysDictType = sysDictTypeDao{
|
||||
internal.NewSysDictTypeDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
|
||||
// IsUniqueType 判断类型是否唯一
|
||||
func (dao *sysDictTypeDao) IsUniqueType(ctx context.Context, id int64, typeName string) (bool, error) {
|
||||
var data *entity.SysDictType
|
||||
m := dao.Ctx(ctx).Where("type", typeName)
|
||||
|
||||
if id > 0 {
|
||||
m = m.WhereNot("id", id)
|
||||
}
|
||||
|
||||
if err := m.Scan(&data); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetTypes 获取指定ID的所有类型标识,包含下级
|
||||
func (dao *sysDictTypeDao) GetTypes(ctx context.Context, id int64) (types []string, err error) {
|
||||
m := dao.Ctx(ctx).Fields("type").Where("id", id).
|
||||
WhereOr("pid", id).
|
||||
Where("status", consts.StatusEnabled)
|
||||
list, err := m.Array()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return types, err
|
||||
}
|
||||
|
||||
for _, v := range list {
|
||||
types = append(types, v.String())
|
||||
}
|
||||
|
||||
g.Log().Warningf(ctx, "types:%+v", types)
|
||||
return types, nil
|
||||
}
|
||||
|
||||
// GetType 获取指定ID的类型标识
|
||||
func (dao *sysDictTypeDao) GetType(ctx context.Context, id int64) (types string, err error) {
|
||||
m := dao.Ctx(ctx).Fields("type").Where("id", id).
|
||||
Where("status", consts.StatusEnabled)
|
||||
list, err := m.Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return types, err
|
||||
}
|
||||
|
||||
g.Log().Warningf(ctx, "GetType types:%+v", list.String())
|
||||
return list.String(), nil
|
||||
}
|
||||
|
||||
// GetId 获取指定类型的ID
|
||||
func (dao *sysDictTypeDao) GetId(ctx context.Context, t string) (id int64, err error) {
|
||||
m := dao.Ctx(ctx).Fields("id").Where("type", t).
|
||||
Where("status", consts.StatusEnabled)
|
||||
list, err := m.Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return list.Int64(), nil
|
||||
}
|
||||
27
server/internal/dao/sys_log.go
Normal file
27
server/internal/dao/sys_log.go
Normal 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"
|
||||
)
|
||||
|
||||
// internalSysLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysLogDao = *internal.SysLogDao
|
||||
|
||||
// sysLogDao is the data access object for table hg_sys_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysLogDao struct {
|
||||
internalSysLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysLog is globally common accessible object for table hg_sys_log operations.
|
||||
SysLog = sysLogDao{
|
||||
internal.NewSysLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
66
server/internal/dao/sys_provinces.go
Normal file
66
server/internal/dao/sys_provinces.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/container/gvar"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalSysProvincesDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysProvincesDao = *internal.SysProvincesDao
|
||||
|
||||
// sysProvincesDao is the data access object for table hg_sys_provinces.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysProvincesDao struct {
|
||||
internalSysProvincesDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysProvinces is globally common accessible object for table hg_sys_provinces operations.
|
||||
SysProvinces = sysProvincesDao{
|
||||
internal.NewSysProvincesDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
|
||||
// GetRegion 获取省市编码对应的地区名称
|
||||
func (dao *sysProvincesDao) GetRegion(ctx context.Context, province int, city int, spilt ...string) (string, error) {
|
||||
|
||||
var (
|
||||
provinceName *gvar.Var
|
||||
cityName *gvar.Var
|
||||
err error
|
||||
)
|
||||
// TODO 默认分隔符
|
||||
spiltSymbol := "-"
|
||||
if len(spilt) > 0 {
|
||||
spiltSymbol = spilt[0]
|
||||
}
|
||||
|
||||
if province > 0 {
|
||||
provinceName, err = dao.Ctx(ctx).Where("id", province).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return "", err
|
||||
}
|
||||
|
||||
if city > 0 {
|
||||
cityName, err = dao.Ctx(ctx).Where("id", city).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "内网IP", nil
|
||||
}
|
||||
|
||||
return provinceName.String() + spiltSymbol + cityName.String(), nil
|
||||
}
|
||||
Reference in New Issue
Block a user