chore: 初始开源发布
iotlcm-admin-svr:管理后台服务。 - Go module:iotlcm → git.5iot.com/iotlcm-public/iotlcm-admin-svr(729 文件) - 凭据与地址脱敏:JWT signingKey(含代码里的 MustGet 默认值)、 MySQL DSN、Redis 口令、告警邮件发件人邮箱全部改为占位; 私网 IP → 文档地址段;库名 xiujie_admin → iotlcm - 真实手机号/邮箱 → 合法 11 位编造号 / example.com - 移除内部资产:CI 触发器、过时 DDL(sql/db_iotlcm.sql)、 私有依赖 go get 行、明文 registry 登录口令 - 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名 - Dockerfile 改用公共基础镜像 - 拼错的 RADEME.md → README.md,README 重写 - 需要真实数据库的用例改为可用 IOTLCM_TEST_WITH_DB=1 显式启用 - 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes 数据库 schema 不随本仓发布(生产 DDL 已过时),README 已说明。
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
// Package @{.templateGroup}in
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) @{NowYear} LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
// @AutoGenerate Version @{.xiuVersion}
|
||||
//
|
||||
package @{.templateGroup}in
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"slices"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"iotlcm/internal/consts"
|
||||
"iotlcm/internal/model/entity"
|
||||
"iotlcm/internal/model/request"
|
||||
"iotlcm/utility/validate"
|
||||
@{ if eq .options.Step.HasHookMemberSummary true }"iotlcm/internal/library/xgorm/hook"@{end}
|
||||
@{ if eq .options.Step.IsTreeTable true }"iotlcm/utility/tree"@{end}
|
||||
)
|
||||
@{ if eq .options.Step.HasEdit true }
|
||||
// @{.varName}UpdateFields 修改@{.tableComment}字段过滤
|
||||
type @{.varName}UpdateFields struct {
|
||||
@{.updateFieldsColumns}
|
||||
}
|
||||
|
||||
// @{.varName}InsertFields 新增@{.tableComment}字段过滤
|
||||
type @{.varName}InsertFields struct {
|
||||
@{.insertFieldsColumns}
|
||||
}
|
||||
|
||||
// @{.varName}EditParam 修改/新增@{.tableComment}
|
||||
type @{.varName}EditParam struct {
|
||||
//entity.@{.daoName}
|
||||
@{.editParamFieldsColumns}
|
||||
}
|
||||
|
||||
func (in *@{.varName}EditParam) Filter(ctx context.Context) (err error) {
|
||||
@{.editParamValidator}
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}EditModel struct{}
|
||||
@{end}
|
||||
@{ if eq .options.Step.HasDel true }
|
||||
// @{.varName}DeleteParam 删除@{.tableComment}
|
||||
type @{.varName}DeleteParam struct {
|
||||
@{.pk.GoName} interface{} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
||||
}
|
||||
|
||||
func (in *@{.varName}DeleteParam) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}DeleteModel struct{}
|
||||
@{end}
|
||||
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
|
||||
// @{.varName}ViewParam 获取指定@{.tableComment}信息
|
||||
type @{.varName}ViewParam struct {
|
||||
@{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
||||
}
|
||||
|
||||
func (in *@{.varName}ViewParam) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}ViewModel struct {
|
||||
@{.viewModelColumns}
|
||||
}@{end}
|
||||
|
||||
// @{.varName}ListParam 获取@{.tableComment}列表
|
||||
type @{.varName}ListParam struct {
|
||||
request.PageInfo
|
||||
@{.listInpColumns}
|
||||
}
|
||||
|
||||
func (in *@{.varName}ListParam) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}ListModel struct {
|
||||
@{.listModelColumns}
|
||||
}
|
||||
|
||||
@{ if eq .options.Step.HasExport true }
|
||||
// @{.varName}ExportModel 导出@{.tableComment}
|
||||
type @{.varName}ExportModel struct {
|
||||
@{.exportModelColumns}
|
||||
}@{end}
|
||||
@{ if and (eq .options.Step.HasEdit true) (eq .options.Step.HasMaxSort true) }
|
||||
// @{.varName}MaxSortParam 获取@{.tableComment}最大排序
|
||||
type @{.varName}MaxSortParam struct{}
|
||||
|
||||
func (in *@{.varName}MaxSortParam) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}MaxSortModel struct {
|
||||
Sort int `json:"sort" description:"排序"`
|
||||
}
|
||||
@{end}
|
||||
@{ if eq .options.Step.HasStatus true }
|
||||
// @{.varName}StatusParam 更新@{.tableComment}状态
|
||||
type @{.varName}StatusParam struct {
|
||||
@{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
func (in *@{.varName}StatusParam) Filter(ctx context.Context) (err error) {
|
||||
if in.@{.pk.GoName} <= 0 {
|
||||
err = gerror.New("@{.pk.Dc}不能为空")
|
||||
return
|
||||
}
|
||||
|
||||
if in.Status <= 0 {
|
||||
err = gerror.New("状态不能为空")
|
||||
return
|
||||
}
|
||||
|
||||
if (!slices.Contains(consts.StatusSlice, in.Status)) {
|
||||
err = gerror.New("状态不正确")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}StatusModel struct{}
|
||||
@{end}
|
||||
@{ if eq .options.Step.HasSwitch true }
|
||||
// @{.varName}SwitchParam 更新@{.tableComment}开关状态
|
||||
type @{.varName}SwitchParam struct {
|
||||
request.SwitchReq
|
||||
@{.pk.GoName} @{.pk.GoType} `json:"@{.pk.TsName}" v:"required#@{.pk.Dc}不能为空" dc:"@{.pk.Dc}"`
|
||||
}
|
||||
|
||||
func (in *@{.varName}SwitchParam) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type @{.varName}SwitchModel struct{}
|
||||
@{end}
|
||||
|
||||
@{ if eq .options.Step.IsTreeTable true }
|
||||
// @{.varName}TreeOption 关系树选项
|
||||
type @{.varName}TreeOption struct {
|
||||
@{.treeOptionFields}
|
||||
Children []tree.Node `json:"children" dc:"子节点"`
|
||||
}
|
||||
|
||||
// ID 获取节点ID
|
||||
func (t *@{.varName}TreeOption) ID() int64 {
|
||||
return t.@{.pk.GoName}
|
||||
}
|
||||
|
||||
// PID 获取父级节点ID
|
||||
func (t *@{.varName}TreeOption) PID() int64 {
|
||||
return t.Pid
|
||||
}
|
||||
|
||||
// SetChildren 设置子节点数据
|
||||
func (t *@{.varName}TreeOption) SetChildren(children []tree.Node) {
|
||||
t.Children = children
|
||||
}
|
||||
@{end}
|
||||
|
||||
Reference in New Issue
Block a user