迁移部分int到string

This commit is contained in:
xh
2025-12-19 12:35:24 +08:00
parent 84eff225b9
commit 1c0b19a1c0
7 changed files with 41 additions and 68 deletions
+7 -12
View File
@@ -8,8 +8,7 @@ type CommonUploadImageReq struct {
// CommonAlbumListReq 相册文件列表参数
type CommonAlbumListReq struct {
Cid string `form:"cid"` // 类目ID
// Type int `form:"type" binding:"omitempty,oneof=10 20 30"` // 文件类型: [10=图片, 20=视频]
Cid string `form:"cid"` // 类目ID
Name string `form:"name"` // 文件名称
Ext []string `form:"ext[]"` // 文件扩展
@@ -31,13 +30,11 @@ type CommonAlbumMoveReq struct {
type CommonAlbumAddReq struct {
Cid string `form:"cid"` // 类目ID
AdminId string `form:"admin_id"` // 管理ID
// Uid uint `form:"uid" binding:"gte=0"` // 用户ID
// Type int `form:"type" binding:"oneof=10 20 30"` // 文件类型: [10=图片, 20=视频,30文件]
Name string `form:"name"` // 文件名称
Uri string `form:"uri"` // 文件路径
Ext string `form:"ext"` // 文件扩展
Size int64 `form:"size"` // 文件大小
Hash string `form:"hash"`
Name string `form:"name"` // 文件名称
Uri string `form:"uri"` // 文件路径
Ext string `form:"ext"` // 文件扩展
Size int64 `form:"size"` // 文件大小
Hash string `form:"hash"`
}
// CommonAlbumDelReq 相册文件删除参数
@@ -47,14 +44,12 @@ type CommonAlbumDelReq struct {
// CommonCateListReq 相册分类列表参数
type CommonCateListReq struct {
// Type int `form:"type" binding:"omitempty,oneof=10 20 30"` // 分类类型: [10=图片,20=视频,30文件]
Name string `form:"name"` // 分类名称
}
// CommonCateAddReq 相册分类新增参数
type CommonCateAddReq struct {
Pid string `form:"pid" binding:"gte=0"` // 父级ID
// Type int `form:"type" binding:"required,oneof=10 20 30"` // 分类类型: [10=图片,20=视频,30文件]
Pid string `form:"pid" binding:"gte=0"` // 父级ID
Name string `form:"name" binding:"required,min=1,max=30"` // 分类名称
}
@@ -28,34 +28,21 @@ type FlowApplyAddReq struct {
ApplyUserId string `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
FlowName string `form:"flowName"` // 流程名称
// FlowGroup int `form:"flowGroup"` // 流程分类
// FlowRemark string `form:"flowRemark"` // 流程描述
// FlowFormData string `form:"flowFormData"` // 表单配置
// FlowProcessData string `form:"flowProcessData"` // 流程配置
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态:1待提交,2审批中,3审批完成,4审批失败
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态:1待提交,2审批中,3审批完成,4审批失败
}
// FlowApplyEditReq 申请流程新增参数
type FlowApplyEditReq struct {
Id string `form:"id"` //
// TemplateId int `form:"templateId"` // 模板
// ApplyUserId int `form:"applyUserId"` // 申请人id
// ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
FlowName string `form:"flowName"` // 流程名称
// FlowGroup int `form:"flowGroup"` // 流程分类
// FlowRemark string `form:"flowRemark"` // 流程描述
// FlowFormData string `form:"flowFormData"` // 表单配置
// FlowProcessData string `form:"flowProcessData"` // 流程配置
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
Id string `form:"id"` //
FlowName string `form:"flowName"` // 流程名称
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态:1待提交,2审批中,3审批完成,4审批失败
}
// FlowApplyDelReq 申请流程新增参数
type FlowApplyDelReq struct {
Id int `form:"id"` //
Id string `form:"id"` //
}
// FlowApplyResp 申请流程返回信息
@@ -8,7 +8,7 @@ type FlowHistoryListReq struct {
TemplateId string `form:"templateId"` // 模板id
ApplyUserId string `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
ApproverId int `form:"approverId"` // 审批人id
ApproverId string `form:"approverId"` // 审批人id
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
NodeId string `form:"nodeId"` // 节点
NodeLabel string `form:"nodeLabel"` // 节点名称
@@ -27,9 +27,9 @@ type FlowHistoryDetailReq struct {
type FlowHistoryAddReq struct {
ApplyId string `form:"applyId"` // 申请id
TemplateId string `form:"templateId"` // 模板id
ApplyUserId int `form:"applyUserId"` // 申请人id
ApplyUserId string `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
ApproverId int `form:"approverId"` // 审批人id
ApproverId string `form:"approverId"` // 审批人id
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
NodeId string `form:"nodeId"` // 节点
NodeLabel string `form:"nodeLabel"` // 节点名称
@@ -44,9 +44,9 @@ type FlowHistoryEditReq struct {
Id string `form:"id"` // 历史id
ApplyId string `form:"applyId"` // 申请id
TemplateId string `form:"templateId"` // 模板id
ApplyUserId int `form:"applyUserId"` // 申请人id
ApplyUserId string `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
ApproverId int `form:"approverId"` // 审批人id
ApproverId string `form:"approverId"` // 审批人id
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
NodeId string `form:"nodeId"` // 节点
NodeLabel string `form:"nodeLabel"` // 节点名称
@@ -58,7 +58,7 @@ type FlowHistoryEditReq struct {
// FlowHistoryDelReq 流程历史新增参数
type FlowHistoryDelReq struct {
Id int `form:"id"` // 历史id
Id string `form:"id"` // 历史id
}
// FlowHistoryResp 流程历史返回信息
@@ -105,21 +105,14 @@ type FlowTree struct {
}
type NextNodeReq struct {
ApplyId string `form:"applyId"` // 申请id
// CurrentNodeId string `form:"currentNodeId"` // 流程里的节点id
// FormValue string `form:"formValue"`
// NextNodeAdminId int `form:"nextNodeAdminId"` // 下一个节点的审批用户id
}
type PassReq struct {
ApplyId string `form:"applyId"` // 申请id
// CurrentNodeId string `form:"currentNodeId"` // 流程里的节点id
// FormValue string `form:"formValue"`
ApplyId string `form:"applyId"` // 申请id
NextNodeAdminId string `form:"nextNodeAdminId"` // 下一个节点的审批用户id
PassRemark string `form:"passRemark"` // 通过备注
}
type BackReq struct {
ApplyId string `form:"applyId"` // 申请id
// Type int `form:"type"` //驳回类型:1申请人,2审批节点
ApplyId string `form:"applyId"` // 申请id
HistoryId string `form:"historyId"` //审批节点
Remark string `form:"Remark"` // 备注
}
+13 -15
View File
@@ -48,21 +48,19 @@ type EditColumn struct {
ColumnComment string `form:"columnComment" binding:"required,max=200"` // 列描述
IsPk uint8 `form:"isPk" binding:"oneof=0 1"` // 是否主键: [0=否, 1=是]
IsIncrement uint8 `form:"isIncrement" binding:"oneof=0 1"` // 是否自增: [0=否, 1=是]
IsRequired uint8 `form:"isStop" binding:"oneof=0 1"` // 是否必填: [0=否, 1=是]
IsInsert uint8 `form:"isInsert" binding:"oneof=0 1"` // 是否新增字段: [0=否, 1=是]
IsEdit uint8 `form:"isEdit" binding:"oneof=0 1"` // 是否编辑字段: [0=否, 1=是]
IsList uint8 `form:"isList" binding:"oneof=0 1"` // 是否列表字段: [0=否, 1=是]
IsQuery uint8 `form:"isQuery" binding:"oneof=0 1"` // 是否查询字段: [0=否, 1=是]
QueryType string `form:"queryType" binding:"required,max=30"` // 查询方式
HtmlType string `form:"htmlType" binding:"required,max=30"` // 表单类型
DictType string `form:"dictType" binding:"required,max=200"` // 字典类型
ListAllApi string `form:"listAllApi" binding:"max=200"` // 下拉框数据来源listAll
CreateTime core.NullTime `form:"createTime"` // 创建时间
UpdateTime core.NullTime `form:"updateTime"` // 更新时间
IsPk uint8 `form:"isPk" binding:"oneof=0 1"` // 是否主键: [0=否, 1=是]
IsIncrement uint8 `form:"isIncrement" binding:"oneof=0 1"` // 是否自增: [0=否, 1=是]
IsRequired uint8 `form:"isStop" binding:"oneof=0 1"` // 是否必填: [0=否, 1=是]
IsInsert uint8 `form:"isInsert" binding:"oneof=0 1"` // 是否新增字段: [0=否, 1=是]
IsEdit uint8 `form:"isEdit" binding:"oneof=0 1"` // 是否编辑字段: [0=否, 1=是]
IsList uint8 `form:"isList" binding:"oneof=0 1"` // 是否列表字段: [0=否, 1=是]
IsQuery uint8 `form:"isQuery" binding:"oneof=0 1"` // 是否查询字段: [0=否, 1=是]
QueryType string `form:"queryType" binding:"required,max=30"` // 查询方式
HtmlType string `form:"htmlType" binding:"required,max=30"` // 表单类型
DictType string `form:"dictType" binding:"required,max=200"` // 字典类型
ListAllApi string `form:"listAllApi" binding:"max=200"` // 下拉框数据来源listAll
CreateTime core.NullTime `form:"createTime"` // 创建时间
UpdateTime core.NullTime `form:"updateTime"` // 更新时间
}
// EditTableReq 编辑表结构参数
@@ -137,7 +137,7 @@ func (service flowApplyService) Edit(editReq flowSchema.FlowApplyEditReq) (e err
}
// Del 申请流程删除
func (service flowApplyService) Del(id int) (e error) {
func (service flowApplyService) Del(id string) (e error) {
var obj model.FlowApply
err := service.db.Where("id = ? AND is_delete = ?", id, 0).Limit(1).First(&obj).Error
// 校验
@@ -53,7 +53,7 @@ func (service flowHistoryService) List(page request.PageReq, listReq flowSchema.
if listReq.ApplyUserNickname != "" {
dbModel = dbModel.Where("apply_user_nickname like ?", "%"+listReq.ApplyUserNickname+"%")
}
if listReq.ApproverId > 0 {
if listReq.ApproverId != "" {
dbModel = dbModel.Where("approver_id = ?", listReq.ApproverId)
}
if listReq.ApproverNickname != "" {
@@ -159,7 +159,7 @@ func (service flowHistoryService) Edit(editReq flowSchema.FlowHistoryEditReq) (e
}
// Del 流程历史删除
func (service flowHistoryService) Del(id int) (e error) {
func (service flowHistoryService) Del(id string) (e error) {
var obj model.FlowHistory
err := service.db.Where("id = ?", id).Limit(1).First(&obj).Error
// 校验
+5 -5
View File
@@ -5,6 +5,7 @@ import (
"github.com/google/uuid"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
// FlowHistory 流程历史实体
@@ -33,11 +34,10 @@ type FlowHistory struct {
PassRemark string `gorm:"comment:'通过备注'"` // 通过备注
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
UpdateTime core.NullTime `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
CreateTime core.NullTime `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
DeleteTime core.NullTime `gorm:"default:null;comment:'删除时间'"` // 删除时间
}