统一软删除字段

This commit is contained in:
xiangheng
2024-06-29 00:46:01 +08:00
parent 562ce63382
commit 0701cd8b4c
7 changed files with 113 additions and 85 deletions

View File

@@ -1,14 +1,18 @@
package model
import "x_admin/core"
import (
"x_admin/core"
//ArticleCollect 文章收藏实体
"gorm.io/plugin/soft_delete"
)
// ArticleCollect 文章收藏实体
type ArticleCollect struct {
Id int `gorm:"primarykey;comment:'主键'"` // 主键
UserId int `gorm:"comment:'用户ID'"` // 用户ID
ArticleId int `gorm:"comment:'文章ID'"` // 文章ID
IsDelete int `gorm:"comment:'是否删除'"` // 是否删除
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
Id int `gorm:"primarykey;comment:'主键'"` // 主键
UserId int `gorm:"comment:'用户ID'"` // 用户ID
ArticleId int `gorm:"comment:'文章ID'"` // 文章ID
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
}

View File

@@ -1,32 +1,36 @@
package common_model
import "x_admin/core"
import (
"x_admin/core"
//Album 相册实体
"gorm.io/plugin/soft_delete"
)
// Album 相册实体
type Album struct {
ID uint `gorm:"primarykey;comment:'主键ID'"`
Cid uint `gorm:"not null;default:0;comment:'类目ID'"`
Aid uint `gorm:"not null;default:0;comment:'管理ID'"`
Uid uint `gorm:"not null;default:0;comment:'用户ID'"`
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
Name string `gorm:"not null;default:'';comment:'文件名称''"`
Uri string `gorm:"not null;comment:'文件路径'"`
Ext string `gorm:"not null;default:'';comment:'文件扩展'"`
Size int64 `gorm:"not null;default:0;comment:文件大小"`
IsDelete uint8 `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
ID uint `gorm:"primarykey;comment:'主键ID'"`
Cid uint `gorm:"not null;default:0;comment:'类目ID'"`
Aid uint `gorm:"not null;default:0;comment:'管理ID'"`
Uid uint `gorm:"not null;default:0;comment:'用户ID'"`
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
Name string `gorm:"not null;default:'';comment:'文件名称''"`
Uri string `gorm:"not null;comment:'文件路径'"`
Ext string `gorm:"not null;default:'';comment:'文件扩展'"`
Size int64 `gorm:"not null;default:0;comment:文件大小"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
}
//AlbumCate 相册分类实体
// AlbumCate 相册分类实体
type AlbumCate struct {
ID uint `gorm:"primarykey;comment:'主键ID'"`
Pid uint `gorm:"not null;default:0;comment:'父级ID'"`
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
Name string `gorm:"not null;default:'';comment:'分类名称''"`
IsDelete uint8 `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
ID uint `gorm:"primarykey;comment:'主键ID'"`
Pid uint `gorm:"not null;default:0;comment:'父级ID'"`
Type int `gorm:"not null;default:10;comment:'文件类型: [10=图片, 20=视频]''"`
Name string `gorm:"not null;default:'';comment:'分类名称''"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
}

View File

@@ -1,23 +1,27 @@
package model
import "x_admin/core"
import (
"x_admin/core"
//FlowApply 申请流程实体
"gorm.io/plugin/soft_delete"
)
// FlowApply 申请流程实体
type FlowApply struct {
Id int `gorm:"primarykey;comment:''"` //
TemplateId int `gorm:"comment:'模板'"` // 模板
ApplyUserId int `gorm:"comment:'申请人id'"` // 申请人id
ApplyUserNickname string `gorm:"comment:'申请人昵称'"` // 申请人昵称
FlowName string `gorm:"comment:'流程名称'"` // 流程名称
FlowGroup int `gorm:"comment:'流程分类'"` // 流程分类
FlowRemark string `gorm:"comment:'流程描述'"` // 流程描述
FlowFormData string `gorm:"comment:'表单配置'"` // 表单配置
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
FormValue string `gorm:"comment:'表单值'"` // 表单值
Status int `gorm:"comment:'状态1待提交2审批中3审批完成4审批失败'"` // 状态0待提交1审批中2审批完成3审批失败
IsDelete int `gorm:"comment:'是否删除'"` // 是否删除
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
Id int `gorm:"primarykey;comment:''"` //
TemplateId int `gorm:"comment:'模板'"` // 模板
ApplyUserId int `gorm:"comment:'申请人id'"` // 申请人id
ApplyUserNickname string `gorm:"comment:'申请人昵称'"` // 申请人昵称
FlowName string `gorm:"comment:'流程名称'"` // 流程名称
FlowGroup int `gorm:"comment:'流程分类'"` // 流程分类
FlowRemark string `gorm:"comment:'流程描述'"` // 流程描述
FlowFormData string `gorm:"comment:'表单配置'"` // 表单配置
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
FormValue string `gorm:"comment:'表单值'"` // 表单值
Status int `gorm:"comment:'状态1待提交2审批中3审批完成4审批失败'"` // 状态0待提交1审批中2审批完成3审批失败
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
}

View File

@@ -1,8 +1,12 @@
package model
import "x_admin/core"
import (
"x_admin/core"
//FlowTemplate 流程模板实体
"gorm.io/plugin/soft_delete"
)
// FlowTemplate 流程模板实体
type FlowTemplate struct {
Id int `gorm:"primarykey;comment:''"` //
FlowName string `gorm:"comment:'流程名称'"` // 流程名称
@@ -12,8 +16,8 @@ type FlowTemplate struct {
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
IsDelete uint8 `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.TsTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
}

View File

@@ -1,8 +1,12 @@
package model
import "x_admin/core"
import (
"x_admin/core"
//MonitorProject 错误项目实体
"gorm.io/plugin/soft_delete"
)
// MonitorProject 错误项目实体
type MonitorProject struct {
Id int `gorm:"primarykey;comment:'项目id'" excel:"name:项目id;"` // 项目id
@@ -12,7 +16,7 @@ type MonitorProject struct {
ProjectType string `gorm:"comment:'项目类型go java web node php 等'" excel:"name:项目类型"` // 项目类型go java web node php 等
IsDelete int `gorm:"comment:'是否删除: 0=否, 1=是'" excel:"name:是否删除: 0=否, 1=是;"` // 是否删除: 0=否, 1=是
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;comment:'更新时间'" excel:"name:更新时间;"` // 更新时间

View File

@@ -1,19 +1,23 @@
package setting_model
import "x_admin/core"
import (
"x_admin/core"
//DictData 字典数据实体
"gorm.io/plugin/soft_delete"
)
// DictData 字典数据实体
type DictData struct {
ID uint `gorm:"primarykey;comment:'主键'"`
TypeId uint `gorm:"not null;default:0;comment:'类型'"`
Name string `gorm:"not null;default:'';comment:'键名''"`
Value string `gorm:"not null;default:'';comment:'数值'"`
Color string `gorm:"default:'';comment:'颜色'"`
Remark string `gorm:"not null;default:'';comment:'备注'"`
Sort uint16 `gorm:"not null;default:0;comment:'排序'"`
Status uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
IsDelete uint8 `gorm:"not null;default:0;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
ID uint `gorm:"primarykey;comment:'主键'"`
TypeId uint `gorm:"not null;default:0;comment:'类型'"`
Name string `gorm:"not null;default:'';comment:'键名''"`
Value string `gorm:"not null;default:'';comment:'数值'"`
Color string `gorm:"default:'';comment:'颜色'"`
Remark string `gorm:"not null;default:'';comment:'备注'"`
Sort uint16 `gorm:"not null;default:0;comment:'排序'"`
Status uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
}

View File

@@ -1,16 +1,20 @@
package setting_model
import "x_admin/core"
import (
"x_admin/core"
//DictType 字典类型实体
"gorm.io/plugin/soft_delete"
)
// DictType 字典类型实体
type DictType struct {
ID uint `gorm:"primarykey;comment:'主键'"`
DictName string `gorm:"not null;default:'';comment:'字典名称''"`
DictType string `gorm:"not null;default:'';comment:'字典类型'"`
DictRemark string `gorm:"not null;default:'';comment:'字典备注'"`
DictStatus uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
IsDelete uint8 `gorm:"not null;default:0;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
ID uint `gorm:"primarykey;comment:'主键'"`
DictName string `gorm:"not null;default:'';comment:'字典名称''"`
DictType string `gorm:"not null;default:'';comment:'字典类型'"`
DictRemark string `gorm:"not null;default:'';comment:'字典备注'"`
DictStatus uint8 `gorm:"not null;default:1;comment:'字典状态: 0=停用, 1=正常'"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
}