This commit is contained in:
孟帅
2024-04-22 23:08:40 +08:00
parent 82483bd7b9
commit e144b12580
445 changed files with 17457 additions and 6708 deletions

View File

@@ -12,6 +12,7 @@ import (
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"hotgo/utility/validate"
)
@@ -21,7 +22,7 @@ type DeptMaxSortInp struct {
}
type DeptMaxSortModel struct {
Sort int
Sort int `json:"sort"`
}
// DeptEditInp 修改/新增部门数据
@@ -112,7 +113,8 @@ type DeptTree struct {
}
type DeptListModel struct {
List []*DeptTree `json:"list"`
List []*entity.AdminDept `json:"list"`
Ids []int64 `json:"ids"`
}
// DeptStatusInp 更新部门状态
@@ -148,3 +150,26 @@ type DeptOptionInp struct {
type DeptOptionModel struct {
List []*DeptTree `json:"list"`
}
// DeptTreeOption 关系树选项
type DeptTreeOption struct {
Id int64 `json:"id" dc:"部门ID"`
Pid int64 `json:"pid" dc:"父部门ID"`
Name string `json:"name" dc:"部门名称"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *DeptTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *DeptTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *DeptTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}

View File

@@ -90,6 +90,7 @@ type LoginMemberInfoModel struct {
DeptName string `json:"deptName" dc:"所属部门"`
RoleName string `json:"roleName" dc:"所属角色"`
Permissions []string `json:"permissions" dc:"角色信息"`
DeptType string `json:"deptType" dc:"部门类型"`
DeptId int64 `json:"-" dc:"部门ID"`
RoleId int64 `json:"-" dc:"角色ID"`
Username string `json:"username" dc:"用户名"`
@@ -115,7 +116,7 @@ type LoginMemberInfoModel struct {
type MemberEditInp struct {
Id int64 `json:"id" dc:"管理员ID"`
RoleId int64 `json:"roleId" v:"required#角色不能为空" dc:"角色ID"`
PostIds []int64 `json:"postIds" v:"required#岗位不能为空" dc:"岗位ID"`
PostIds []int64 `json:"postIds" dc:"岗位ID"`
DeptId int64 `json:"deptId" v:"required#部门不能为空" dc:"部门ID"`
Username string `json:"username" v:"required#账号不能为空" dc:"帐号"`
PasswordHash string `json:"passwordHash" dc:"密码hash"`
@@ -149,7 +150,7 @@ func (in *MemberEditInp) Filter(ctx context.Context) (err error) {
if in.Password != "" {
if err := g.Validator().
Rules("length:6,16").
Messages("#新密码不能为空#新密码需在6~16之间").
Messages("新密码不能为空#新密码需在6~16之间").
Data(in.Password).Run(ctx); err != nil {
return err.Current()
}

View File

@@ -28,7 +28,7 @@ func (in *MenuEditInp) Filter(ctx context.Context) (err error) {
return
}
if in.Name == "" {
err = gerror.New("路由名不能为空")
err = gerror.New("路由名不能为空")
return
}
return

View File

@@ -16,8 +16,9 @@ type ReqPageFunc interface {
// PageReq 分页请求
type PageReq struct {
Page int `json:"page" example:"10" d:"1" v:"min:1#页码最小值不能低于1" dc:"当前页码"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:200#每页数量最小值不能低于1|最大值不能大于200" dc:"每页数量"`
Page int `json:"page" example:"10" d:"1" v:"min:1#页码最小值不能低于1" dc:"当前页码"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:200#每页数量最小值不能低于1|最大值不能大于200" dc:"每页数量"`
Pagination bool `json:"pagination" d:"true" dc:"是否需要进行分页"`
}
// GetPage 获取当前页码

View File

@@ -3,62 +3,55 @@
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.12.10
// @AutoGenerate Version 2.13.1
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// CurdDemoUpdateFields 修改生成演示字段过滤
// CurdDemoUpdateFields 修改CURD列表字段过滤
type CurdDemoUpdateFields struct {
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Content string `json:"content" dc:"内容"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
Switch int `json:"switch" dc:"显示开关"`
Status int `json:"status" dc:"状态"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
}
// CurdDemoInsertFields 新增生成演示字段过滤
// CurdDemoInsertFields 新增CURD列表字段过滤
type CurdDemoInsertFields struct {
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Content string `json:"content" dc:"内容"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
Switch int `json:"switch" dc:"显示开关"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
}
// CurdDemoEditInp 修改/新增生成演示
// CurdDemoEditInp 修改/新增CURD列表
type CurdDemoEditInp struct {
entity.SysGenCurdDemo
}
func (in *CurdDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证分类ID
if err := g.Validator().Rules("required").Data(in.CategoryId).Messages("分类ID不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
@@ -79,12 +72,17 @@ func (in *CurdDemoEditInp) Filter(ctx context.Context) (err error) {
return err.Current()
}
// 验证测试分类
if err := g.Validator().Rules("required").Data(in.CategoryId).Messages("测试分类不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type CurdDemoEditModel struct{}
// CurdDemoDeleteInp 删除生成演示
// CurdDemoDeleteInp 删除CURD列表
type CurdDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
@@ -95,7 +93,7 @@ func (in *CurdDemoDeleteInp) Filter(ctx context.Context) (err error) {
type CurdDemoDeleteModel struct{}
// CurdDemoViewInp 获取指定生成演示信息
// CurdDemoViewInp 获取指定CURD列表信息
type CurdDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
@@ -106,15 +104,21 @@ func (in *CurdDemoViewInp) Filter(ctx context.Context) (err error) {
type CurdDemoViewModel struct {
entity.SysGenCurdDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"`
}
// CurdDemoListInp 获取生成演示列表
// CurdDemoListInp 获取CURD列表列表
type CurdDemoListInp struct {
form.PageReq
Id int64 `json:"id" dc:"ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Status int `json:"status" dc:"状态"`
CreatedBy string `json:"createdBy" dc:"创建者"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
TestCategoryName string `json:"testCategoryName" dc:"分类名称"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
func (in *CurdDemoListInp) Filter(ctx context.Context) (err error) {
@@ -122,43 +126,43 @@ func (in *CurdDemoListInp) Filter(ctx context.Context) (err error) {
}
type CurdDemoListModel struct {
Id int64 `json:"id" dc:"ID"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
TestCategoryName string `json:"testCategoryName" dc:"分类名称"`
Id int64 `json:"id" dc:"ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
Sort int `json:"sort" dc:"排序"`
Switch int `json:"switch" dc:"显示开关"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
// CurdDemoExportModel 导出生成演示
// CurdDemoExportModel 导出CURD列表
type CurdDemoExportModel struct {
Id int64 `json:"id" dc:"ID"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
Switch int `json:"switch" dc:"显示开关"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
TestCategoryName string `json:"testCategoryName" dc:"分类名称"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
// CurdDemoMaxSortInp 获取生成演示最大排序
// CurdDemoMaxSortInp 获取CURD列表最大排序
type CurdDemoMaxSortInp struct{}
func (in *CurdDemoMaxSortInp) Filter(ctx context.Context) (err error) {
@@ -169,33 +173,7 @@ type CurdDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// CurdDemoStatusInp 更新生成演示状态
type CurdDemoStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *CurdDemoStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type CurdDemoStatusModel struct{}
// CurdDemoSwitchInp 更新生成演示开关状态
// CurdDemoSwitchInp 更新CURD列表开关状态
type CurdDemoSwitchInp struct {
form.SwitchReq
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`

View File

@@ -71,11 +71,11 @@ type DictDataDeleteModel struct{}
// DictDataListInp 获取列表
type DictDataListInp struct {
form.PageReq
form.StatusReq
TypeID int64 `json:"typeId" v:"required#字典类型ID不能为空" dc:"字典类型ID"`
Type string `json:"type"`
Label string `json:"label"`
Type string `json:"type" dc:"字典类型"`
Label string `json:"label" dc:"字典标签"`
Value string `json:"value" dc:"字典键值"`
}
type DictDataListModel struct {

View File

@@ -85,11 +85,13 @@ type GenCodesSelectsModel struct {
LinkMode form.Selects `json:"linkMode" dc:"关联表方式"`
BuildMeth form.Selects `json:"buildMeth" dc:"生成方式"`
// 字段表格选项
FormMode form.Selects `json:"formMode" dc:"表单组件"`
FormRole form.Selects `json:"formRole" dc:"表单验证"`
DictMode []*DictTypeTree `json:"dictMode" dc:"字典类型"`
WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
Addons form.Selects `json:"addons" dc:"插件选项"`
FormMode form.Selects `json:"formMode" dc:"表单组件"`
FormRole form.Selects `json:"formRole" dc:"表单验证"`
DictMode []*DictTypeTree `json:"dictMode" dc:"字典类型"`
WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
Addons form.Selects `json:"addons" dc:"插件选项"`
TableAlign form.Selects `json:"tableAlign" dc:"表格排列方式"`
TreeStyleType []*model.Option `json:"treeStyleType" dc:"树表样式选项"`
}
type GenTypeSelects []*GenTypeSelect
@@ -229,6 +231,5 @@ func genFilter(ctx context.Context, in entity.SysGenCodes) (err error) {
return
}
}
return
}

View File

@@ -7,6 +7,8 @@ package sysin
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin"
@@ -34,29 +36,16 @@ type LoginLogListInp struct {
form.PageReq
Username string `json:"username" dc:"用户名"`
Status int `json:"status" dc:"状态"`
LoginAt []*gtime.Time `json:"loginAt" dc:"登录时间"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
LoginAt []*gtime.Time `json:"loginAt" dc:"登录时间"`
LoginIp string `json:"loginIp" dc:"登录IP"`
}
type LoginLogListModel struct {
Id int64 `json:"id" dc:"日志ID"`
ReqId string `json:"reqId" dc:"请求ID"`
MemberId int64 `json:"memberId" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
LoginAt *gtime.Time `json:"loginAt" dc:"登录时间"`
ErrMsg string `json:"errMsg" dc:"错误提示"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogId int64 `json:"sysLogId" dc:"日志ID"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
SysLogProvinceId int64 `json:"sysLogProvinceId" dc:"省编码"`
SysLogCityId int64 `json:"sysLogCityId" dc:"市编码"`
SysLogErrorCode int `json:"sysLogErrorCode" dc:"报错code"`
SysLogUserAgent string `json:"sysLogUserAgent" dc:"UA信息"`
CityLabel string `json:"cityLabel" dc:"城市标签"`
Os string `json:"os" dc:"系统信息"`
Browser string `json:"browser" dc:"浏览器信息"`
entity.SysLoginLog
Os string `json:"os"`
Browser string `json:"browser"`
CityLabel string `json:"cityLabel"`
SysLogId gdb.Value `json:"sysLogId"`
}
func (in *LoginLogListInp) Filter(ctx context.Context) (err error) {
@@ -65,20 +54,22 @@ func (in *LoginLogListInp) Filter(ctx context.Context) (err error) {
// LoginLogExportModel 导出登录日志
type LoginLogExportModel struct {
Id int64 `json:"id" dc:"日志ID"`
ReqId string `json:"reqId" dc:"请求ID"`
MemberId int64 `json:"memberId" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
LoginAt int64 `json:"loginAt" dc:"登录时间"`
ErrMsg string `json:"errMsg" dc:"错误提示"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
SysLogProvinceId int64 `json:"sysLogProvinceId" dc:"省编码"`
SysLogCityId int64 `json:"sysLogCityId" dc:"市编码"`
SysLogErrorCode int `json:"sysLogErrorCode" dc:"报错code"`
SysLogUserAgent string `json:"sysLogUserAgent" dc:"UA信息"`
Id int64 `json:"id" orm:"id" description:"日志ID"`
ReqId string `json:"reqId" orm:"req_id" description:"请求ID"`
MemberId int64 `json:"memberId" orm:"member_id" description:"用户ID"`
Username string `json:"username" orm:"username" description:"用户名"`
Response *gjson.Json `json:"response" orm:"response" description:"响应数据"`
LoginAt *gtime.Time `json:"loginAt" orm:"login_at" description:"登录时间"`
LoginIp string `json:"loginIp" orm:"login_ip" description:"登录IP"`
ProvinceId int64 `json:"provinceId" orm:"province_id" description:"省编码"`
CityId int64 `json:"cityId" orm:"city_id" description:"市编码"`
UserAgent string `json:"userAgent" orm:"user_agent" description:"UA信息"`
ErrMsg string `json:"errMsg" orm:"err_msg" description:"错误提示"`
Status int `json:"status" orm:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"修改时间"`
Os string `json:"os"`
Browser string `json:"browser"`
}
// LoginLogPushInp 解推送登录日志

View File

@@ -0,0 +1,141 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin
import (
"context"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// NormalTreeDemoUpdateFields 修改普通树表字段过滤
type NormalTreeDemoUpdateFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
}
// NormalTreeDemoInsertFields 新增普通树表字段过滤
type NormalTreeDemoInsertFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
}
// NormalTreeDemoEditInp 修改/新增普通树表
type NormalTreeDemoEditInp struct {
entity.SysGenTreeDemo
}
func (in *NormalTreeDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type NormalTreeDemoEditModel struct{}
// NormalTreeDemoDeleteInp 删除普通树表
type NormalTreeDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *NormalTreeDemoDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoDeleteModel struct{}
// NormalTreeDemoViewInp 获取指定普通树表信息
type NormalTreeDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *NormalTreeDemoViewInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoViewModel struct {
entity.SysGenTreeDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
}
// NormalTreeDemoListInp 获取普通树表列表
type NormalTreeDemoListInp struct {
form.PageReq
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *NormalTreeDemoListInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoListModel struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// NormalTreeDemoMaxSortInp 获取普通树表最大排序
type NormalTreeDemoMaxSortInp struct{}
func (in *NormalTreeDemoMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// NormalTreeDemoTreeOption 关系树选项
type NormalTreeDemoTreeOption struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *NormalTreeDemoTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *NormalTreeDemoTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *NormalTreeDemoTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}

View File

@@ -0,0 +1,140 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin
import (
"context"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// OptionTreeDemoUpdateFields 修改选项树表字段过滤
type OptionTreeDemoUpdateFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
}
// OptionTreeDemoInsertFields 新增选项树表字段过滤
type OptionTreeDemoInsertFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
}
// OptionTreeDemoEditInp 修改/新增选项树表
type OptionTreeDemoEditInp struct {
entity.SysGenTreeDemo
}
func (in *OptionTreeDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type OptionTreeDemoEditModel struct{}
// OptionTreeDemoDeleteInp 删除选项树表
type OptionTreeDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OptionTreeDemoDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoDeleteModel struct{}
// OptionTreeDemoViewInp 获取指定选项树表信息
type OptionTreeDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OptionTreeDemoViewInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoViewModel struct {
entity.SysGenTreeDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
}
// OptionTreeDemoListInp 获取选项树表列表
type OptionTreeDemoListInp struct {
form.PageReq
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *OptionTreeDemoListInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoListModel struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// OptionTreeDemoMaxSortInp 获取选项树表最大排序
type OptionTreeDemoMaxSortInp struct{}
func (in *OptionTreeDemoMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// OptionTreeDemoTreeOption 关系树选项
type OptionTreeDemoTreeOption struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *OptionTreeDemoTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *OptionTreeDemoTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *OptionTreeDemoTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}

View File

@@ -0,0 +1,143 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// TestCategoryUpdateFields 修改测试分类字段过滤
type TestCategoryUpdateFields struct {
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"备注"`
}
// TestCategoryInsertFields 新增测试分类字段过滤
type TestCategoryInsertFields struct {
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"备注"`
}
// TestCategoryEditInp 修改/新增测试分类
type TestCategoryEditInp struct {
entity.TestCategory
}
func (in *TestCategoryEditInp) Filter(ctx context.Context) (err error) {
// 验证分类名称
if err := g.Validator().Rules("required").Data(in.Name).Messages("分类名称不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证排序
if err := g.Validator().Rules("required").Data(in.Sort).Messages("排序不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type TestCategoryEditModel struct{}
// TestCategoryDeleteInp 删除测试分类
type TestCategoryDeleteInp struct {
Id interface{} `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
}
func (in *TestCategoryDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryDeleteModel struct{}
// TestCategoryViewInp 获取指定测试分类信息
type TestCategoryViewInp struct {
Id int64 `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
}
func (in *TestCategoryViewInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryViewModel struct {
entity.TestCategory
}
// TestCategoryListInp 获取测试分类列表
type TestCategoryListInp struct {
form.PageReq
Id int64 `json:"id" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *TestCategoryListInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryListModel struct {
Id int64 `json:"id" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// TestCategoryMaxSortInp 获取测试分类最大排序
type TestCategoryMaxSortInp struct{}
func (in *TestCategoryMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// TestCategoryStatusInp 更新测试分类状态
type TestCategoryStatusInp struct {
Id int64 `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
Status int `json:"status" dc:"状态"`
}
func (in *TestCategoryStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("分类ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type TestCategoryStatusModel struct{}