调整模版

This commit is contained in:
xh
2025-12-29 02:22:39 +08:00
parent 4489b1e195
commit 3144bea308
26 changed files with 246 additions and 294 deletions
+3 -1
View File
@@ -23,12 +23,14 @@ export type type_system_corn_query = {
TaskName?: string
TaskCode?: string
CornExpr?: string
Status?: number
Status?: any
CreatedBy?: string
CreateTimeStart?: string
CreateTimeEnd?: string
UpdateTimeStart?: string
UpdateTimeEnd?: string
CreatedByNickname?: string
CreatedByUsername?: string
}
// 添加编辑
export type type_system_corn_edit = {
+2 -2
View File
@@ -112,7 +112,7 @@
</el-button>
</template>
</el-input>
<upload
<Upload
class="ml-3"
:data="{ cid: cateId }"
:ext="ext"
@@ -120,7 +120,7 @@
@change="refresh"
>
<el-button type="primary">本地上传</el-button>
</upload>
</Upload>
</div>
</div>
+2 -2
View File
@@ -75,7 +75,7 @@
</template>
新增
</el-button>
<upload
<Upload
v-perms="['admin:monitor_project:ImportFile']"
class="ml-3 mr-3"
:url="monitor_project_import_file"
@@ -89,7 +89,7 @@
</template>
导入
</el-button>
</upload>
</Upload>
<el-button
v-perms="['admin:monitor_project:ExportFile']"
type="primary"
+2 -2
View File
@@ -34,7 +34,7 @@
新增
</el-button>
<upload
<Upload
class="ml-3 mr-3"
:url="adminImportFile"
:ext="['xlsx']"
@@ -47,7 +47,7 @@
</template>
导入
</el-button>
</upload>
</Upload>
<el-button type="primary" @click="exportFile">
<template #icon>
+6 -5
View File
@@ -21,8 +21,8 @@
<el-form-item label="创建人" prop="CreatedBy" class="w-[280px]">
<el-input v-model="queryParams.CreatedBy" />
</el-form-item>
<el-form-item label="创建人名称" prop="Nickname" class="w-[280px]">
<el-input v-model="queryParams.Nickname" />
<el-form-item label="创建人名称" prop="CreatedByNickname" class="w-[280px]">
<el-input v-model="queryParams.CreatedByNickname" />
</el-form-item>
<el-form-item label="创建时间" prop="CreateTime" class="w-[280px]">
@@ -51,7 +51,7 @@
</template>
新增
</el-button>
<upload
<Upload
v-perms="['admin:system_corn:ImportFile']"
class="ml-3 mr-3"
:url="system_corn_import_file"
@@ -65,7 +65,7 @@
</template>
导入
</el-button>
</upload>
</Upload>
<el-button
v-perms="['admin:system_corn:ExportFile']"
type="primary"
@@ -101,7 +101,7 @@
<dict-value :options="dictData.status" :value="row.Status" />
</template>
</el-table-column>
<el-table-column label="创建人" prop="CreatedUser.nickname" min-width="130" />
<el-table-column label="创建人" prop="CreatedByUser.nickname" min-width="130" />
<el-table-column label="创建时间" prop="CreateTime" min-width="130" />
<el-table-column label="更新时间" prop="UpdateTime" min-width="130" />
<el-table-column label="操作" width="160" fixed="right">
@@ -173,6 +173,7 @@ const queryParams = reactive<type_system_corn_query>({
CornExpr: null,
Status: null,
CreatedBy: null,
CreatedByNickname: null,
CreateTimeStart: null,
CreateTimeEnd: null,
UpdateTimeStart: null,
+3 -3
View File
@@ -46,7 +46,7 @@
</template>
新增
</el-button>
<upload
<Upload
v-perms="['admin:user_protocol:ImportFile']"
class="ml-3 mr-3"
:url="user_protocol_import_file"
@@ -60,7 +60,7 @@
</template>
导入
</el-button>
</upload>
</Upload>
<el-button
v-perms="['admin:user_protocol:ExportFile']"
type="primary"
@@ -94,7 +94,7 @@
<vxe-column field="Title" title="标题" min-width="130"></vxe-column>
<vxe-column field="Tag" title="标识" min-width="130"></vxe-column>
<vxe-column field="Version" title="版本" width="100"></vxe-column>
<vxe-column field="CreatedUser.nickname" title="创建人" width="120"></vxe-column>
<vxe-column field="CreatedByUser.nickname" title="创建人" width="120"></vxe-column>
<vxe-column field="CreateTime" title="创建时间" width="180"></vxe-column>
<vxe-column field="UpdateTime" title="更新时间" width="180"></vxe-column>
+9 -9
View File
@@ -47,13 +47,13 @@ type SystemCornDelBatchReq struct {
// SystemCornResp 定时任务返回信息
type SystemCornResp struct {
Id string `swaggertype:"string"` //
TaskName core.NullString `swaggertype:"string"` // 任务名称
TaskCode core.NullString `swaggertype:"string"` // 任务编码
CornExpr core.NullString `swaggertype:"string"` // corn表达式
Status core.NullInt `swaggertype:"number"` // 状态
CreatedBy core.NullString `swaggertype:"string"` // 创建人
CreatedUser systemSchema.SystemAuthAdminSimpleInfo `swaggertype:"string"` // 创建人
CreateTime core.NullTime `swaggertype:"string"` // 创建时间
UpdateTime core.NullTime `swaggertype:"string"` // 更新时间
Id string `swaggertype:"string"` //
TaskName core.NullString `swaggertype:"string"` // 任务名称
TaskCode core.NullString `swaggertype:"string"` // 任务编码
CornExpr core.NullString `swaggertype:"string"` // corn表达式
Status core.NullInt `swaggertype:"number"` // 状态
CreatedBy core.NullString `swaggertype:"string"` // 创建人
CreatedByUser systemSchema.SystemAuthAdminSimpleInfo `swaggertype:"string"` // 创建人
CreateTime core.NullTime `swaggertype:"string"` // 创建时间
UpdateTime core.NullTime `swaggertype:"string"` // 更新时间
}
+8 -8
View File
@@ -57,12 +57,12 @@ type UserProtocolDelBatchReq struct {
// UserProtocolResp 用户协议返回信息
type UserProtocolResp struct {
UserProtocolPrimarykey
Tag core.NullString `swaggertype:"string"` // 标识
Version core.NullInt `swaggertype:"number"` // 版本
Title core.NullString `swaggertype:"string"` // 标题
Content core.NullString `swaggertype:"string"` // 协议内容
CreateTime core.NullTime `swaggertype:"string"` // 创建时间
UpdateTime core.NullTime `swaggertype:"string"` // 更新时间
CreatedBy string `swaggertype:"string"` // 创建人id
CreatedUser systemSchema.SystemAuthAdminSimpleInfo `swaggertype:"string"` // 创建人
Tag core.NullString `swaggertype:"string"` // 标识
Version core.NullInt `swaggertype:"number"` // 版本
Title core.NullString `swaggertype:"string"` // 标题
Content core.NullString `swaggertype:"string"` // 协议内容
CreateTime core.NullTime `swaggertype:"string"` // 创建时间
UpdateTime core.NullTime `swaggertype:"string"` // 更新时间
CreatedBy string `swaggertype:"string"` // 创建人id
CreatedByUser systemSchema.SystemAuthAdminSimpleInfo `swaggertype:"string"` // 创建人
}
@@ -69,6 +69,9 @@ var SqlConstants = sqlConstants{
ColumnNameNotList: []string{"id", "is_delete", "delete_time"},
//页面不需要查询字段
ColumnNameNotQuery: []string{"is_delete", "delete_time"}, //"create_time", "update_time",
// 常用user id字段
ColumnNameUserFiled: []string{"created_by", "updated_by", "deleted_by"},
}
// HtmlConstants HTML相关常量
@@ -109,11 +112,12 @@ type sqlConstants struct {
ColumnTypeInt []string
ColumnTypeFloat []string
ColumnTimeName []string
ColumnNameNotAdd []string
ColumnNameNotEdit []string
ColumnNameNotList []string
ColumnNameNotQuery []string
ColumnTimeName []string
ColumnNameNotAdd []string
ColumnNameNotEdit []string
ColumnNameNotList []string
ColumnNameNotQuery []string
ColumnNameUserFiled []string
}
type htmlConstants struct {
@@ -10,9 +10,9 @@ import (
type {{{ toUpperCamelCase .EntityName }}} struct {
{{{- range .Columns }}}
{{{- if ne .ID "" }}}
{{{- if eq .ColumnName "created_by" }}}
CreatedBy {{{.GoNullType }}} `gorm:"column:created_by;type:{{{toSqlType .ColumnType .ColumnLength}}};comment:'{{{ .ColumnComment }}}'"`
CreatedUser system_model.SystemAuthAdminSimple `gorm:"foreignKey:CreatedBy"`
{{{- if .IsUid }}}
{{{.GoField}}} {{{.GoNullType }}} `gorm:"column:{{{.ColumnName}}};type:{{{toSqlType .ColumnType .ColumnLength}}};comment:'{{{ .ColumnComment }}}'"`
{{{.GoField}}}User system_model.SystemAuthAdminSimple `gorm:"foreignKey:{{{.GoField}}}"`
{{{- else if eq .ColumnName "is_delete" }}}
IsDelete soft_delete.DeletedAt `gorm:"column:{{{.ColumnName}}};type:{{{toSqlType .ColumnType .ColumnLength}}};not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
{{{- else if eq .GoType "time.Time" }}}
@@ -28,11 +28,13 @@ type {{{ toUpperCamelCase .EntityName }}} struct {
{{{- if eq .PrimaryKeyGoType "string" }}}
// 自动在创建时设置 UUIDv7
func (u *{{{ toUpperCamelCase .EntityName }}}) BeforeCreate(tx *gorm.DB) error {
id, err := uuid.NewV7()
if err != nil {
return err
}
u.Id = id.String()
if u.{{{toUpperCamelCase .PrimaryKey }}} == "" {
id, err := uuid.NewV7()
if err != nil {
return err
}
u.{{{toUpperCamelCase .PrimaryKey }}} = id.String()
}
return nil
}
{{{- end }}}
@@ -37,7 +37,7 @@ type {{{ .EntityName }}}Service struct {
// List {{{ .FunctionName }}}列表
func (service {{{ .EntityName }}}Service) GetModel(listReq schema.{{{ toUpperCamelCase .EntityName }}}ListReq) *gorm.DB {
//
dbModel := service.db.Model(&model.{{{ toUpperCamelCase .EntityName }}}{}).Joins("CreatedUser")
dbModel := service.db.Model(&model.{{{ toUpperCamelCase .EntityName }}}{}).Joins("CreatedByUser")
tableName := core.DBTableName(&model.{{{ toUpperCamelCase .EntityName }}}{})
{{{- range .Columns }}}
{{{- if .IsQuery }}}
@@ -47,10 +47,10 @@ func (service {{{ .EntityName }}}Service) GetModel(listReq schema.{{{ toUpperCam
dbModel = dbModel.Where(tableName+".created_by = ?", *listReq.CreatedBy.GetValue())
}
if listReq.Nickname.GetValue() != nil {
dbModel = dbModel.Where("CreatedUser.nickname like ?", "%"+*listReq.Nickname.GetValue()+"%")
dbModel = dbModel.Where("CreatedByUser.nickname like ?", "%"+*listReq.Nickname.GetValue()+"%")
}
if listReq.Username.GetValue() != nil {
dbModel = dbModel.Where("CreatedUser.nickname like ?", "%"+*listReq.Username.GetValue()+"%")
dbModel = dbModel.Where("CreatedByUser.nickname like ?", "%"+*listReq.Username.GetValue()+"%")
}
{{{- else if eq .HtmlType "datetime" }}}
if listReq.{{{ toUpperCamelCase .ColumnName }}}Start.GetValue() != nil {
@@ -141,7 +141,7 @@ func (service {{{ .EntityName }}}Service) Detail({{{ toUpperCamelCase .PrimaryKe
var obj = model.{{{ toUpperCamelCase .EntityName }}}{}
err := service.CacheUtil.GetCache({{{ toUpperCamelCase .PrimaryKey }}}, &obj)
if err != nil {
err := service.db.Where("{{{ $.PrimaryKey }}} = ?{{{ if contains .AllFields "is_delete" }}} AND is_delete = ?{{{ end }}}", {{{ toUpperCamelCase .PrimaryKey }}}{{{ if contains .AllFields "is_delete" }}}, 0{{{ end }}}).Preload("CreatedUser").Limit(1).First(&obj).Error
err := service.db.Where("{{{ $.PrimaryKey }}} = ?{{{ if contains .AllFields "is_delete" }}} AND is_delete = ?{{{ end }}}", {{{ toUpperCamelCase .PrimaryKey }}}{{{ if contains .AllFields "is_delete" }}}, 0{{{ end }}}).Preload("CreatedByUser").Limit(1).First(&obj).Error
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
return
}
@@ -201,8 +201,8 @@ func (service {{{ .EntityName }}}Service) Edit(editReq schema.{{{ toUpperCamelCa
if e = response.CheckErr(err, "编辑失败"); e != nil {
return
}
service.CacheUtil.RemoveCache(obj.Id)
// service.Detail(obj.Id)
service.CacheUtil.RemoveCache(obj.{{{toUpperCamelCase .PrimaryKey }}})
return
}
@@ -16,7 +16,7 @@
{{{- if ne .DictType "" }}}
<x-picker v-model="form.{{{ .TsField }}}" valueKey="value" labelKey="name" :columns="dictData.{{{ .DictType }}}"></x-picker>
{{{- else if ne .ListAllApi "" }}}
<x-picker v-model="form.{{{ .TsField }}}" valueKey="Id" labelKey="Id" :columns="listAllData.{{{pathToName .ListAllApi}}}"></x-picker>
<x-picker v-model="form.{{{ .TsField }}}" valueKey="{{{toUpperCamelCase .PrimaryKey }}}" labelKey="{{{toUpperCamelCase .PrimaryKey }}}" :columns="listAllData.{{{pathToName .ListAllApi}}}"></x-picker>
{{{- else }}}
请选择字典生成代码
{{{- end }}}
@@ -11,7 +11,7 @@
{{{- if ne .DictType "" }}}
<x-picker v-model="form.{{{ .GoField }}}" valueKey="value" labelKey="name" :columns="dictData.{{{ .DictType }}}"></x-picker>
{{{- else if ne .ListAllApi "" }}}
<x-picker v-model="form.{{{ .GoField }}}" valueKey="Id" labelKey="Id" :columns="listAllData.{{{pathToName .ListAllApi}}}"></x-picker>
<x-picker v-model="form.{{{ .GoField }}}" valueKey="{{{toUpperCamelCase .PrimaryKey }}}" labelKey="{{{toUpperCamelCase .PrimaryKey }}}" :columns="listAllData.{{{pathToName .ListAllApi}}}"></x-picker>
{{{- end }}}
{{{- else if eq .HtmlType "input" }}}
<uv-input v-model="form.{{{ .GoField }}}"> </uv-input>
@@ -8,7 +8,7 @@ import { clearEmpty } from '@/utils/util'
export type type_{{{.ModuleName}}} = {
{{{- range .Columns }}}
{{{- if .IsList }}}
{{{- if or .IsList .IsPk }}}
{{{.TsField }}}?: {{{.TsType}}}
{{{- end }}}
{{{- end }}}
@@ -28,7 +28,7 @@
{{{- end }}}
{{{- range .Columns }}}
{{{- if .IsEdit }}}
{{{- if ne .TsField "Id" }}}
{{{- if not .IsPk }}}
{{{- if eq .HtmlType "input" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
<span v-text="formData.{{{ .TsField }}}"></span>
@@ -43,109 +43,34 @@
</el-form-item>
{{{- else if eq .HtmlType "checkbox" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
{{{- if ne .DictType "" }}}
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-checkbox
v-for="(item, index) in dictData.{{{ .DictType }}}"
:key="index"
:label="item.name"
:value="item.value"
:disabled="!item.status"
></el-checkbox> --}}
{{{- else if ne .ListAllApi "" }}}
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-checkbox
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
:key="index"
:label="item.Id"
:value="item.Id"
></el-checkbox> --}}
{{!-- <el-checkbox></el-checkbox> --}}
{{{- end }}}
</el-form-item>
{{{- else if eq .HtmlType "select" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
{{!-- <el-select class="flex-1" v-model="formData.{{{ .TsField }}}" placeholder="请选择{{{ .ColumnComment }}}"> --}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
{{{- if ne .DictType "" }}}
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-option
v-for="(item, index) in dictData.{{{ .DictType }}}"
:key="index"
:label="item.name"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.value)"
{{{- else }}}
:value="item.value"
{{{- end }}}
clearable
:disabled="!item.status"
/> --}}
{{{- else if ne .ListAllApi "" }}}
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-option
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
:key="index"
:label="item.Id"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.Id)"
{{{- else }}}
:value="String(item.Id)"
{{{- end }}}
clearable
/> --}}
{{!-- <el-option label="请选择字典生成" value="" /> --}}
{{{- end }}}
{{!-- </el-select> --}}
{{{- end }}}
</el-form-item>
{{{- else if eq .HtmlType "radio" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
{{{- if ne .DictType "" }}}
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-radio
v-for="(item, index) in dictData.{{{ .DictType }}}"
:key="index"
:label="item.name"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.value)"
{{{- else }}}
:value="item.value"
{{{- end }}}
:disabled="!item.status"
></el-radio> --}}
{{{- else if ne .ListAllApi "" }}}
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ .TsField }}}" />
{{!-- <el-radio
v-for="(item, index) in listAllData.{{{ pathToName .ListAllApi }}}"
:key="index"
:label="item.name"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.Id)"
{{{- else }}}
:value="item.Id"
{{{- end }}}
>
{{ item.Id }}
</el-radio> --}}
{{!-- <el-radio label="0"></el-radio> --}}
{{{- end }}}
</el-form-item>
{{{- else if eq .HtmlType "datetime" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
<span v-text="formData.{{{ .TsField }}}"></span>
{{!-- <el-date-picker
class="flex-1 !flex"
v-model="formData.{{{ .TsField }}}"
type="datetime"
clearable
value-format="YYYY-MM-DD hh:mm:ss"
placeholder="请选择{{{ .ColumnComment }}}"
/> --}}
</el-form-item>
{{{- else if eq .HtmlType "editor" }}}
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}">
@@ -60,8 +60,8 @@
<el-checkbox
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
:key="index"
:label="item.Id"
:value="item.Id"
:label="item.ID"
:value="item.ID"
></el-checkbox>
{{{- else }}}
<el-checkbox>请选择字典生成</el-checkbox>
@@ -88,11 +88,11 @@
<el-option
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
:key="index"
:label="item.Id"
:label="item.ID"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.Id)"
:value="parseInt(item.ID)"
{{{- else }}}
:value="String(item.Id)"
:value="String(item.ID)"
{{{- end }}}
clearable
/>
@@ -122,12 +122,12 @@
:key="index"
:label="item.name"
{{{- if eq .GoType "int" }}}
:value="parseInt(item.Id)"
:value="parseInt(item.ID)"
{{{- else }}}
:value="item.Id"
:value="item.ID"
{{{- end }}}
>
{{ item.Id }}
{{ item.ID }}
</el-radio>
{{{- else }}}
<el-radio label="0">请选择字典生成</el-radio>
@@ -33,8 +33,8 @@
<el-option
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi}}}"
:key="index"
:label="item.Id"
:value="item.Id"
:label="item.ID"
:value="item.ID"
/>
{{{- else }}}
<el-option label="请选择字典生成" value="" />
@@ -62,7 +62,7 @@
</template>
新增
</el-button>
<upload
<Upload
v-perms="['admin:{{{ .ModuleName }}}:ImportFile']"
class="ml-3 mr-3"
:url="{{{.ModuleName}}}_import_file"
@@ -76,7 +76,7 @@
</template>
导入
</el-button>
</upload>
</Upload>
<el-button v-perms="['admin:{{{ .ModuleName }}}:ExportFile']" type="primary" @click="exportFile">
<template #icon>
<icon name="el-icon-Download" />
@@ -102,38 +102,35 @@
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" :index="handleIndex" min-width="60" />
{{{- range .Columns }}}
{{{- if .IsList }}}
{{{- if eq .ColumnName "created_by" }}}
{{{- else if eq .ColumnName "created_user" }}}
<el-table-column label="创建人" prop="CreatedUser.Nickname" min-width="130" />
{{{- else if and (ne .DictType "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}" min-width="100">
{{{- if and .IsList .IsListShow }}}
{{{- if and (ne .DictType "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{.TableColumnProp}}}" min-width="100">
<template #default="{ row }">
<dict-value :options="dictData.{{{ .DictType }}}" :value="row.{{{ .TsField }}}" />
<dict-value :options="dictData.{{{ .DictType }}}" :value="row.{{{.TableColumnProp}}}" />
</template>
</el-table-column>
{{{- else if and (ne .ListAllApi "") (or (eq .HtmlType "select") (eq .HtmlType "radio") (eq .HtmlType "checkbox")) }}}
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}" min-width="100">
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{.TableColumnProp}}}" min-width="100">
<template #default="{ row }">
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="row.{{{ .TsField }}}" labelKey='Id' valueKey='Id' />
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="row.{{{.TableColumnProp}}}" labelKey='ID' valueKey='ID' />
</template>
</el-table-column>
{{{- else if eq .HtmlType "imageUpload" }}}
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}" min-width="100">
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{.TableColumnProp}}}" min-width="100">
<template #default="{ row }">
<image-contain
:width="40"
:height="40"
:src="row.{{{ .TsField }}}"
:preview-src-list="[row.{{{ .TsField }}}]"
:src="row.{{{.TableColumnProp}}}"
:preview-src-list="[row.{{{.TableColumnProp}}}]"
preview-teleported
hide-on-click-modal
/>
</template>
</el-table-column>
{{{- else }}}
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{ .TsField }}}" min-width="130" />
<el-table-column label="{{{ .ColumnComment }}}" prop="{{{.TableColumnProp}}}" min-width="130" />
{{{- end }}}
{{{- end }}}
{{{- end }}}
@@ -217,7 +214,10 @@ const showDetails = ref(false)
const queryParams = reactive<type_{{{.ModuleName}}}_query>({
{{{- range .Columns }}}
{{{- if .IsQuery }}}
{{{- if eq .HtmlType "datetime" }}}
{{{- if eq .ColumnName "created_by" }}}
CreatedBy: null,
CreatedByNickname: null,
{{{- else if eq .HtmlType "datetime" }}}
{{{ .TsField }}}Start: null,
{{{ .TsField }}}End: null,
{{{- else }}}
@@ -67,6 +67,8 @@ type ExtentGenTableColumn struct {
IsInsert uint8 //是否为插入字段: [1=是, 0=否]
IsEdit uint8 //是否编辑字段: [1=是, 0=否]
IsList uint8 //是否列表字段: [1=是, 0=否]
IsListShow uint8 //表格列表是否显示字段: [1=是, 0=否]
IsUid uint8 //是否用户ID: [1=是, 0=否]
IsQuery uint8 //是否查询字段: [1=是, 0=否]
QueryType string //查询方式: [等于、不等于、大于、小于、范围]
HtmlType string //显示类型: [文本框、文本域、下拉框、复选框、单选框、日期控件]
@@ -82,6 +84,8 @@ type ExtentGenTableColumn struct {
TsField string //TS字段名
SwagType string //swagger类型
TableColumnProp string //表格列表prop属性,默认赋值TsField,用户名称赋值xxxUser.nickname、xxxUser.username
}
// TplVars 模板变量
@@ -159,109 +163,124 @@ func (tu templateUtil) PrepareVars(table gen_model.GenTable, columns []gen_model
// convert_util.Copy(&subColumns, oriSubPriCol)
// }
var haveCreatedBy bool = false
var userFiled = []ExtentGenTableColumn{}
for i, column := range newColumns {
// 判断ColumnName=created_by
if column.ColumnName == "created_by" {
haveCreatedBy = true
newColumns[i].IsListShow = 1
// 获取用户字段
for _, columnName := range SqlConstants.ColumnNameUserFiled {
if column.ColumnName == columnName {
userFiled = append(userFiled, column)
// 列表不显示用户id
newColumns[i].IsListShow = 0
// 是用户ID
newColumns[i].IsUid = 1
}
}
newColumns[i].GoNullType = GenUtil.GoTypeToNullType(column.GoType)
newColumns[i].TsType = GenUtil.GoToTsType(column.GoType)
// newColumns[i].TsField = column.ColumnName
newColumns[i].TsField = column.GoField
newColumns[i].TableColumnProp = newColumns[i].TsField
newColumns[i].SwagType = GenUtil.GoTypeToSwagType(column.GoType)
}
if haveCreatedBy {
if len(userFiled) > 0 {
// 添加可查询字段
CreatedByColumns := []ExtentGenTableColumn{
{
for _, column := range userFiled {
CreatedByColumns := []ExtentGenTableColumn{
ColumnName: "nickname",
ColumnComment: "创建人姓名",
ColumnLength: 32,
ColumnType: "char",
GoType: GoConstants.TypeString,
GoNullType: GoConstants.TypeString,
{
// 查询用户名称
ColumnName: column.ColumnName + "_nickname",
ColumnComment: column.ColumnComment + "名称",
ColumnLength: 32,
ColumnType: "char",
GoType: GoConstants.TypeString,
GoNullType: GenUtil.GoTypeToNullType(column.GoType),
GoField: "Nickname",
TsType: "string",
TsField: "Nickname",
GoField: column.GoField + "Nickname",
TsType: "string",
TsField: column.GoField + "Nickname",
TableColumnProp: "",
SwagType: SwagTypeConstants.String,
SwagType: SwagTypeConstants.String,
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsList: 0,
IsListShow: 0,
IsQuery: 1,
QueryType: "LIKE",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
}, {
// 查询用户账号(一般不用)
ColumnName: column.ColumnName + "_username",
ColumnComment: column.ColumnComment + "账号",
ColumnLength: 32,
ColumnType: "char",
GoType: GoConstants.TypeString,
GoNullType: GenUtil.GoTypeToNullType(column.GoType),
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsList: 0,
IsQuery: 1,
QueryType: "LIKE",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
}, {
GoField: column.GoField + "Username",
ColumnName: "username",
ColumnComment: "创建人账号",
ColumnLength: 32,
ColumnType: "char",
GoType: GoConstants.TypeString,
GoNullType: GoConstants.TypeString,
TsType: "string",
TsField: column.GoField + "Username",
SwagType: SwagTypeConstants.String,
GoField: "Username",
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsList: 0,
IsListShow: 0,
IsQuery: 1,
QueryType: "=",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
}, {
// 列表用户名称
ColumnName: column.ColumnName + "_user",
ColumnComment: column.ColumnComment,
ColumnLength: 32,
ColumnType: "char",
GoType: "systemSchema.SystemAuthAdminSimpleInfo",
TsType: "string",
TsField: "Username",
SwagType: SwagTypeConstants.String,
GoNullType: "systemSchema.SystemAuthAdminSimpleInfo",
GoField: column.GoField + "User",
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsList: 0,
IsQuery: 1,
QueryType: "=",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
}, {
ColumnName: "created_user",
ColumnComment: "创建人",
ColumnLength: 32,
ColumnType: "char",
GoType: "systemSchema.SystemAuthAdminSimpleInfo",
GoNullType: "systemSchema.SystemAuthAdminSimpleInfo",
GoField: "CreatedUser",
TsType: "object",
TsField: "CreatedUser",
SwagType: SwagTypeConstants.Object,
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsList: 1,
IsQuery: 0,
QueryType: "=",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
},
TsType: "object",
TsField: column.GoField + "User",
TableColumnProp: column.GoField + "User" + ".nickname",
SwagType: SwagTypeConstants.Object,
IsPk: 0,
IsIncrement: 0,
IsRequired: 0,
IsInsert: 0,
IsEdit: 0,
IsListShow: 1,
IsList: 1,
IsQuery: 0,
QueryType: "=",
HtmlType: "input",
DictType: "",
ListAllApi: "",
Sort: 6,
},
}
newColumns = append(newColumns, CreatedByColumns...)
}
newColumns = append(newColumns, CreatedByColumns...)
}
for _, column := range newColumns {
+3 -3
View File
@@ -35,7 +35,7 @@ type systemCornService struct {
// List 定时任务列表
func (service systemCornService) GetModel(listReq schema.SystemCornListReq) *gorm.DB {
// 查询
dbModel := service.db.Model(&model.SystemCorn{}).Joins("CreatedUser")
dbModel := service.db.Model(&model.SystemCorn{}).Joins("CreatedByUser")
tableName := core.DBTableName(&model.SystemCorn{})
if listReq.TaskName.GetValue() != nil {
dbModel = dbModel.Where(tableName+".task_name like ?", "%"+*listReq.TaskName.GetValue()+"%")
@@ -54,7 +54,7 @@ func (service systemCornService) GetModel(listReq schema.SystemCornListReq) *gor
dbModel = dbModel.Where(tableName+".created_by = ?", *listReq.CreatedBy.GetValue())
}
if listReq.Nickname.GetValue() != nil {
dbModel = dbModel.Where("CreatedUser.nickname like ?", "%"+*listReq.Nickname.GetValue()+"%")
dbModel = dbModel.Where("CreatedByUser.nickname like ?", "%"+*listReq.Nickname.GetValue()+"%")
}
if listReq.CreateTimeStart.GetValue() != nil {
@@ -141,7 +141,7 @@ func (service systemCornService) Detail(Id string) (res schema.SystemCornResp, e
var obj = model.SystemCorn{}
err := service.CacheUtil.GetCache(Id, &obj)
if err != nil {
err := service.db.Where("id = ? AND is_delete = ?", Id, 0).Preload("CreatedUser").Limit(1).First(&obj).Error
err := service.db.Where("id = ? AND is_delete = ?", Id, 0).Preload("CreatedByUser").Limit(1).First(&obj).Error
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
return
}
+2 -2
View File
@@ -36,7 +36,7 @@ type userProtocolService struct {
// List 用户协议列表
func (service userProtocolService) GetModel(listReq schema.UserProtocolListReq) *gorm.DB {
// 查询
dbModel := service.db.Model(&model.UserProtocol{}).Preload("CreatedUser")
dbModel := service.db.Model(&model.UserProtocol{}).Preload("CreatedByUser")
if listReq.Title.GetValue() != nil {
dbModel = dbModel.Where("title like ?", "%"+*listReq.Title.GetValue()+"%")
}
@@ -129,7 +129,7 @@ func (service userProtocolService) Detail(Id string) (res schema.UserProtocolRes
var obj = model.UserProtocol{}
err := service.CacheUtil.GetCache(Id, &obj)
if err != nil {
err := service.db.Where("id = ? AND is_delete = ?", Id, 0).Preload("CreatedUser").Limit(1).First(&obj).Error
err := service.db.Where("id = ? AND is_delete = ?", Id, 0).Preload("CreatedByUser").Limit(1).First(&obj).Error
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
return
}
+6 -7
View File
@@ -8,7 +8,7 @@ require (
github.com/gin-gonic/gin v1.11.0
github.com/go-playground/locales v0.14.1
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.28.0
github.com/go-playground/validator/v10 v10.30.0
github.com/go-sql-driver/mysql v1.9.3
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/google/uuid v1.6.0
@@ -29,13 +29,12 @@ require (
github.com/duke-git/lancet/v2 v2.3.8
github.com/gorilla/websocket v1.5.3
github.com/lionsoul2014/ip2region/binding/golang v0.0.0-20251113013923-bd30b77d5468
github.com/mitchellh/mapstructure v1.5.0
github.com/redis/go-redis/v9 v9.17.2
github.com/robfig/cron/v3 v3.0.1
github.com/wneessen/go-mail v0.7.2
go.uber.org/ratelimit v0.3.1
golang.org/x/sync v0.18.0
golang.org/x/text v0.31.0
golang.org/x/sync v0.19.0
golang.org/x/text v0.32.0
)
require (
@@ -49,7 +48,7 @@ require (
github.com/cloudwego/base64x v0.1.6 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.22.2 // indirect
@@ -96,11 +95,11 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/arch v0.23.0 // indirect
golang.org/x/crypto v0.44.0 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/tools v0.39.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
+12 -14
View File
@@ -31,8 +31,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY=
github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
@@ -73,8 +73,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
github.com/go-playground/validator/v10 v10.30.0 h1:5YBPNs273uzsZJD1I8uiB4Aqg9sN6sMDVX3s6LxmhWU=
github.com/go-playground/validator/v10 v10.30.0/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
@@ -119,8 +119,6 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -210,8 +208,8 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=
golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU=
golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 h1:zfMcR1Cs4KNuomFFgGefv5N0czO2XZpUbxGUy8i8ug0=
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6/go.mod h1:46edojNIoXTNOhySWIWdix628clX9ODXwPsQuG6hsK0=
golang.org/x/image v0.33.0 h1:LXRZRnv1+zGd5XBUVRFmYEphyyKJjQjCRiOuAP3sZfQ=
@@ -220,15 +218,15 @@ golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
+11 -11
View File
@@ -11,17 +11,17 @@ import (
// SystemCorn 定时任务实体
type SystemCorn struct {
Id string `gorm:"column:id;type:char(36);primarykey;comment:'id'"`
TaskName core.NullString `gorm:"column:task_name;type:char(100);comment:'任务名称'"`
TaskCode core.NullString `gorm:"column:task_code;type:char(100);comment:'任务编码'"`
CornExpr core.NullString `gorm:"column:corn_expr;type:char(100);comment:'corn表达式'"`
Status core.NullInt `gorm:"column:status;type:tinyint(1);comment:'状态'"`
CreatedBy core.NullString `gorm:"column:created_by;type:char(36);comment:'创建人'"`
CreatedUser system_model.SystemAuthAdminSimple `gorm:"foreignKey:CreatedBy"`
IsDelete soft_delete.DeletedAt `gorm:"column:is_delete;type:tinyint(1);not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.NullTime `gorm:"column:create_time;type:datetime;autoCreateTime;comment:'创建时间'"`
UpdateTime core.NullTime `gorm:"column:update_time;type:datetime;autoUpdateTime;comment:'更新时间'"`
DeleteTime core.NullTime `gorm:"column:delete_time;type:datetime;comment:'删除时间'"`
Id string `gorm:"column:id;type:char(36);primarykey;comment:'id'"`
TaskName core.NullString `gorm:"column:task_name;type:char(100);comment:'任务名称'"`
TaskCode core.NullString `gorm:"column:task_code;type:char(100);comment:'任务编码'"`
CornExpr core.NullString `gorm:"column:corn_expr;type:char(100);comment:'corn表达式'"`
Status core.NullInt `gorm:"column:status;type:tinyint(1);comment:'状态'"`
CreatedBy core.NullString `gorm:"column:created_by;type:char(36);comment:'创建人'"`
CreatedByUser system_model.SystemAuthAdminSimple `gorm:"foreignKey:CreatedBy"`
IsDelete soft_delete.DeletedAt `gorm:"column:is_delete;type:tinyint(1);not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.NullTime `gorm:"column:create_time;type:datetime;autoCreateTime;comment:'创建时间'"`
UpdateTime core.NullTime `gorm:"column:update_time;type:datetime;autoUpdateTime;comment:'更新时间'"`
DeleteTime core.NullTime `gorm:"column:delete_time;type:datetime;comment:'删除时间'"`
}
// 自动在创建时设置 UUIDv7
+6 -4
View File
@@ -41,10 +41,12 @@ func (m *SystemAuthAdmin) BeforeCreate(tx *gorm.DB) (err error) {
// SystemAuthAdminSimple 简化版系统管理员实体,用于关联查询
type SystemAuthAdminSimple struct {
ID string `gorm:"primarykey;type:char(36);comment:'uuid'"`
Username string `gorm:"not null;default:'';comment:'用户账号''"`
Nickname string `gorm:"not null;default:'';comment:'用户昵称'"`
Avatar string `gorm:"not null;default:'';comment:'用户头像'"`
ID string `gorm:"primarykey;type:char(36);comment:'uuid'"`
Username string `gorm:"not null;default:'';comment:'用户账号''"`
Nickname string `gorm:"not null;default:'';comment:'用户昵称'"`
Avatar string `gorm:"not null;default:'';comment:'用户头像'"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"`
}
func (m *SystemAuthAdminSimple) TableName() string {
+11 -11
View File
@@ -11,17 +11,17 @@ import (
// UserProtocol 用户协议实体
type UserProtocol struct {
Id string `gorm:"primarykey;type:char(36);comment:''"` //
Tag core.NullString `gorm:"comment:'标识'"` // 标识
Version core.NullInt `gorm:"column:version;comment:'排序'"` // 排序
Title core.NullString `gorm:"comment:'标题'"` // 标题
Content core.NullString `gorm:"comment:'协议内容'"` // 协议内容
CreatedBy core.NullString `gorm:"column:created_by;type:char(36);comment:'创建人'"`
CreatedUser system_model.SystemAuthAdminSimple `gorm:"foreignKey:CreatedBy"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
DeleteTime core.NullTime `gorm:"comment:'删除时间'"` // 删除时间
Id string `gorm:"primarykey;type:char(36);comment:''"` //
Tag core.NullString `gorm:"comment:'标识'"` // 标识
Version core.NullInt `gorm:"column:version;comment:'排序'"` // 排序
Title core.NullString `gorm:"comment:'标题'"` // 标题
Content core.NullString `gorm:"comment:'协议内容'"` // 协议内容
CreatedBy core.NullString `gorm:"column:created_by;type:char(36);comment:'创建人'"`
CreatedByUser system_model.SystemAuthAdminSimple `gorm:"foreignKey:CreatedBy"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
DeleteTime core.NullTime `gorm:"comment:'删除时间'"` // 删除时间
}
// 自动在创建时设置 UUIDv7