mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[新增] 新增工作流
This commit is contained in:
@@ -442,7 +442,7 @@ func GenCode(tableId int64) {
|
|||||||
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/services/"+tab.TableName+".go", b2.Bytes())
|
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/services/"+tab.TableName+".go", b2.Bytes())
|
||||||
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/api/"+tab.TableName+".go", b3.Bytes())
|
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/api/"+tab.TableName+".go", b3.Bytes())
|
||||||
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/router/"+tab.TableName+".go", b4.Bytes())
|
kgo.KFile.WriteFile("./apps/"+tab.PackageName+"/router/"+tab.TableName+".go", b4.Bytes())
|
||||||
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/api/"+tab.PackageName+"/"+tab.BusinessName+".js", b5.Bytes())
|
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/api/"+tab.PackageName+"/"+tab.BusinessName+".ts", b5.Bytes())
|
||||||
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/views/"+tab.PackageName+"/"+tab.BusinessName+"/index.vue", b6.Bytes())
|
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/views/"+tab.PackageName+"/"+tab.BusinessName+"/index.vue", b6.Bytes())
|
||||||
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/views/"+tab.PackageName+"/"+tab.BusinessName+"/"+"component"+"/editModule.vue", b7.Bytes())
|
kgo.KFile.WriteFile(global.Conf.Gen.Frontpath+"/views/"+tab.PackageName+"/"+tab.BusinessName+"/"+"component"+"/editModule.vue", b7.Bytes())
|
||||||
}
|
}
|
||||||
|
|||||||
65
apps/flow/api/flow_work_classify.go
Normal file
65
apps/flow/api/flow_work_classify.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// 生成日期:2022-08-24 22:02:33 +0800 CST
|
||||||
|
// 生成路径: apps/flow/api/flow_work_classify.go
|
||||||
|
// 生成人:panda
|
||||||
|
// ==========================================================================
|
||||||
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
"github.com/XM-GO/PandaKit/restfulx"
|
||||||
|
|
||||||
|
"github.com/XM-GO/PandaKit/utils"
|
||||||
|
"pandax/apps/flow/entity"
|
||||||
|
"pandax/apps/flow/services"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FlowWorkClassifyApi struct {
|
||||||
|
FlowWorkClassifyApp services.FlowWorkClassifyModel
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFlowWorkClassifyList Classify列表数据
|
||||||
|
func (p *FlowWorkClassifyApi) GetFlowWorkClassifyList(rc *restfulx.ReqCtx) {
|
||||||
|
data := entity.FlowWorkClassify{}
|
||||||
|
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||||
|
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||||
|
data.Name = restfulx.QueryParam(rc, "name")
|
||||||
|
|
||||||
|
list, total := p.FlowWorkClassifyApp.FindListPage(pageNum, pageSize, data)
|
||||||
|
|
||||||
|
rc.ResData = model.ResultPage{
|
||||||
|
Total: total,
|
||||||
|
PageNum: int64(pageNum),
|
||||||
|
PageSize: int64(pageNum),
|
||||||
|
Data: list,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFlowWorkClassify 获取Classify
|
||||||
|
func (p *FlowWorkClassifyApi) GetFlowWorkClassify(rc *restfulx.ReqCtx) {
|
||||||
|
id := restfulx.PathParamInt(rc, "id")
|
||||||
|
p.FlowWorkClassifyApp.FindOne(int64(id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertFlowWorkClassify 添加Classify
|
||||||
|
func (p *FlowWorkClassifyApi) InsertFlowWorkClassify(rc *restfulx.ReqCtx) {
|
||||||
|
var data entity.FlowWorkClassify
|
||||||
|
restfulx.BindQuery(rc, &data)
|
||||||
|
|
||||||
|
p.FlowWorkClassifyApp.Insert(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateFlowWorkClassify 修改Classify
|
||||||
|
func (p *FlowWorkClassifyApi) UpdateFlowWorkClassify(rc *restfulx.ReqCtx) {
|
||||||
|
var data entity.FlowWorkClassify
|
||||||
|
restfulx.BindQuery(rc, &data)
|
||||||
|
|
||||||
|
p.FlowWorkClassifyApp.Update(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteFlowWorkClassify 删除Classify
|
||||||
|
func (p *FlowWorkClassifyApi) DeleteFlowWorkClassify(rc *restfulx.ReqCtx) {
|
||||||
|
id := restfulx.PathParam(rc, "id")
|
||||||
|
ids := utils.IdsStrToIdsIntGroup(id)
|
||||||
|
p.FlowWorkClassifyApp.Delete(ids)
|
||||||
|
}
|
||||||
14
apps/flow/entity/work_classify.go
Normal file
14
apps/flow/entity/work_classify.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import "github.com/XM-GO/PandaKit/model"
|
||||||
|
|
||||||
|
// FlowWorkClassify 工作流流程分类
|
||||||
|
type FlowWorkClassify struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Name string `gorm:"column:name; type: varchar(128)" json:"name"` // 分类名称
|
||||||
|
Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkClassify) TableName() string {
|
||||||
|
return "flow_work_classify"
|
||||||
|
}
|
||||||
25
apps/flow/entity/work_info.go
Normal file
25
apps/flow/entity/work_info.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkInfo 工作流信息
|
||||||
|
type FlowWorkInfo struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Name string `gorm:"column:name; type:varchar(128)" json:"name"` // 流程名称
|
||||||
|
Icon string `gorm:"column:icon; type:varchar(128)" json:"icon" ` // 流程标签
|
||||||
|
Structure json.RawMessage `gorm:"column:structure; type:json" json:"structure" ` // 流程结构
|
||||||
|
Classify int `gorm:"column:classify; type:int(11)" json:"classify"` // 分类ID
|
||||||
|
Templates json.RawMessage `gorm:"column:templates; type:json" json:"templates"` // 模版
|
||||||
|
Task json.RawMessage `gorm:"column:task; type:json" json:"task"` // 任务ID, array, 可执行多个任务,可以当成通知任务,每个节点都会去执行
|
||||||
|
SubmitCount int `gorm:"column:submit_count; type:int(11); default:0" json:"submitCount"` // 提交统计
|
||||||
|
Creator int `gorm:"column:creator; type:int(11)" json:"creator"` // 创建者
|
||||||
|
Notice json.RawMessage `gorm:"column:notice; type:json" json:"notice"` // 绑定通知
|
||||||
|
Remarks string `gorm:"column:remarks; type:varchar(1024)" json:"remarks"` // 流程备注
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkInfo) TableName() string {
|
||||||
|
return "flow_work_info"
|
||||||
|
}
|
||||||
26
apps/flow/entity/work_order.go
Normal file
26
apps/flow/entity/work_order.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkOrder 工作流工单
|
||||||
|
type FlowWorkOrder struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Title string `gorm:"column:title; type:varchar(128)" json:"title"` // 工单标题
|
||||||
|
Priority int `gorm:"column:priority; type:int(11)" json:"priority"` // 工单优先级 1,正常 2,紧急 3,非常紧急
|
||||||
|
Process int `gorm:"column:process; type:int(11)" json:"process"` // 流程ID
|
||||||
|
Classify int `gorm:"column:classify; type:int(11)" json:"classify"` // 分类ID
|
||||||
|
IsEnd int `gorm:"column:is_end; type:int(11); default:0" json:"is_end"` // 是否结束, 0 未结束,1 已结束
|
||||||
|
IsDenied int `gorm:"column:is_denied; type:int(11); default:0" json:"is_denied"` // 是否被拒绝, 0 没有,1 有
|
||||||
|
State json.RawMessage `gorm:"column:state; type:json" json:"state"` // 状态信息
|
||||||
|
RelatedPerson json.RawMessage `gorm:"column:related_person; type:json" json:"related_person"` // 工单所有处理人
|
||||||
|
Creator int `gorm:"column:creator; type:int(11)" json:"creator"` // 创建人
|
||||||
|
UrgeCount int `gorm:"column:urge_count; type:int(11); default:0" json:"urge_count"` // 催办次数
|
||||||
|
UrgeLastTime int `gorm:"column:urge_last_time; type:int(11); default:0" json:"urge_last_time"` // 上一次催促时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkOrder) TableName() string {
|
||||||
|
return "flow_work_order"
|
||||||
|
}
|
||||||
18
apps/flow/entity/work_order_templates.go
Normal file
18
apps/flow/entity/work_order_templates.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkOrderTemplate 工单绑定模版数据
|
||||||
|
type FlowWorkOrderTemplate struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
WorkOrder int `gorm:"column:work_order; type: int(11)" json:"work_order"` // 工单ID
|
||||||
|
FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure"` // 表单结构
|
||||||
|
FormData json.RawMessage `gorm:"column:form_data; type: json" json:"form_data"` // 表单数据
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkOrderTemplate) TableName() string {
|
||||||
|
return "flow_work_order_templates"
|
||||||
|
}
|
||||||
25
apps/flow/entity/work_stage.go
Normal file
25
apps/flow/entity/work_stage.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkStage 工作流工序(流转历史)
|
||||||
|
type FlowWorkStage struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Title string `gorm:"column:title; type: varchar(128)" json:"title"` // 工单标题
|
||||||
|
WorkOrder int `gorm:"column:work_order; type: int(11)" json:"work_order"` // 工单ID
|
||||||
|
State string `gorm:"column:state; type: varchar(128)" json:"state"` // 工单状态
|
||||||
|
Source string `gorm:"column:source; type: varchar(128)" json:"source"` // 源节点ID
|
||||||
|
Target string `gorm:"column:target; type: varchar(128)" json:"target"` // 目标节点ID
|
||||||
|
Stage string `gorm:"column:stage; type: varchar(128)" json:"stage"` // 流转ID
|
||||||
|
Status int `gorm:"column:status; type: int(11)" json:"status"` // 流转状态 1 同意, 0 拒绝, 2 其他
|
||||||
|
Processor string `gorm:"column:processor; type: varchar(45)" json:"processor"` // 处理人
|
||||||
|
ProcessorId int `gorm:"column:processor_id; type: int(11)" json:"processor_id"` // 处理人ID
|
||||||
|
CostDuration int64 `gorm:"column:cost_duration; type: int(11)" json:"cost_duration"` // 处理时长
|
||||||
|
Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkStage) TableName() string {
|
||||||
|
return "flow_work_stage"
|
||||||
|
}
|
||||||
33
apps/flow/entity/work_task.go
Normal file
33
apps/flow/entity/work_task.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkTask 工作流任务
|
||||||
|
type FlowWorkTask struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Name string `gorm:"column:name; type: varchar(256)" json:"name"` // 任务名称
|
||||||
|
TaskType string `gorm:"column:task_type; type: varchar(45)" json:"task_type"` // 任务类型
|
||||||
|
Content string `gorm:"column:content; type: longtext" json:"content"` // 任务内容
|
||||||
|
Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者
|
||||||
|
Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkTask) TableName() string {
|
||||||
|
return "flow_work_task"
|
||||||
|
}
|
||||||
|
|
||||||
|
// FlowWorkTaskHistory 工作流任务执行历史
|
||||||
|
type FlowWorkTaskHistory struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Task int `gorm:"column:task; type: int(11)" json:"task"` // 任务ID
|
||||||
|
Name string `gorm:"column:name; type: varchar(256)" json:"name"` // 任务名称
|
||||||
|
TaskType int `gorm:"column:task_type; type: int(11)" json:"task_type"` // 任务类型, python, shell
|
||||||
|
ExecutionTime string `gorm:"column:execution_time; type: varchar(128)" json:"execution_time"` // 执行时间
|
||||||
|
Result string `gorm:"column:result; type: longtext" json:"result"` // 任务返回
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkTaskHistory) TableName() string {
|
||||||
|
return "flow_work_task_history"
|
||||||
|
}
|
||||||
19
apps/flow/entity/work_templates.go
Normal file
19
apps/flow/entity/work_templates.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlowWorkTemplates 工作流表单模板
|
||||||
|
type FlowWorkTemplates struct {
|
||||||
|
model.BaseAutoModel
|
||||||
|
Name string `gorm:"column:name; type: varchar(128)" json:"name" binding:"required"` // 模板名称
|
||||||
|
FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure" binding:"required"` // 表单结构
|
||||||
|
Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者
|
||||||
|
Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FlowWorkTemplates) TableName() string {
|
||||||
|
return "flow_work_templates"
|
||||||
|
}
|
||||||
70
apps/flow/router/flow_work_classify.go
Normal file
70
apps/flow/router/flow_work_classify.go
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
// ==========================================================================
|
||||||
|
// 生成日期:2022-08-24 22:02:33 +0800 CST
|
||||||
|
// 生成路径: apps/flow/router/flow_work_classify.go
|
||||||
|
// 生成人:panda
|
||||||
|
// ==========================================================================
|
||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/model"
|
||||||
|
"github.com/XM-GO/PandaKit/restfulx"
|
||||||
|
"pandax/apps/flow/api"
|
||||||
|
"pandax/apps/flow/entity"
|
||||||
|
"pandax/apps/flow/services"
|
||||||
|
|
||||||
|
restfulspec "github.com/emicklei/go-restful-openapi/v2"
|
||||||
|
"github.com/emicklei/go-restful/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitFlowWorkClassifyRouter(container *restful.Container) {
|
||||||
|
s := &api.FlowWorkClassifyApi{
|
||||||
|
FlowWorkClassifyApp: services.FlowWorkClassifyModelDao,
|
||||||
|
}
|
||||||
|
|
||||||
|
ws := new(restful.WebService)
|
||||||
|
ws.Path("/flow/workclassify").Produces(restful.MIME_JSON)
|
||||||
|
tags := []string{"workclassify"}
|
||||||
|
|
||||||
|
ws.Route(ws.GET("/list").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithLog("获取Classify分页列表").Handle(s.GetFlowWorkClassifyList)
|
||||||
|
}).
|
||||||
|
Doc("获取Classify分页列表").
|
||||||
|
Param(ws.QueryParameter("pageNum", "页数").Required(true).DataType("int")).
|
||||||
|
Param(ws.QueryParameter("pageSize", "每页条数").Required(true).DataType("int")).
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
|
Writes(model.ResultPage{}).
|
||||||
|
Returns(200, "OK", model.ResultPage{}))
|
||||||
|
|
||||||
|
ws.Route(ws.GET("/{id}").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithLog("获取Classify信息").Handle(s.GetFlowWorkClassify)
|
||||||
|
}).
|
||||||
|
Doc("获取Classify信息").
|
||||||
|
Param(ws.PathParameter("id", "Id").DataType("int")).
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
|
Writes(entity.FlowWorkClassify{}). // on the response
|
||||||
|
Returns(200, "OK", entity.FlowWorkClassify{}).
|
||||||
|
Returns(404, "Not Found", nil))
|
||||||
|
|
||||||
|
ws.Route(ws.POST("").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithLog("添加Classify信息").Handle(s.InsertFlowWorkClassify)
|
||||||
|
}).
|
||||||
|
Doc("添加Classify信息").
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
|
Reads(entity.FlowWorkClassify{}))
|
||||||
|
|
||||||
|
ws.Route(ws.PUT("").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithLog("修改Classify信息").Handle(s.UpdateFlowWorkClassify)
|
||||||
|
}).
|
||||||
|
Doc("修改Classify信息").
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
|
Reads(entity.FlowWorkClassify{}))
|
||||||
|
|
||||||
|
ws.Route(ws.DELETE("/{id}").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithLog("删除Classify信息").Handle(s.DeleteFlowWorkClassify)
|
||||||
|
}).
|
||||||
|
Doc("删除Classify信息").
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
|
Param(ws.PathParameter("id", "多id 1,2,3").DataType("string")))
|
||||||
|
|
||||||
|
container.Add(ws)
|
||||||
|
}
|
||||||
87
apps/flow/services/flow_work_classify.go
Normal file
87
apps/flow/services/flow_work_classify.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
// ==========================================================================
|
||||||
|
// 生成日期:2022-08-24 22:02:33 +0800 CST
|
||||||
|
// 生成路径: apps/flow/services/flow_work_classify.go
|
||||||
|
// 生成人:panda
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/biz"
|
||||||
|
"pandax/apps/flow/entity"
|
||||||
|
"pandax/pkg/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
FlowWorkClassifyModel interface {
|
||||||
|
Insert(data entity.FlowWorkClassify) *entity.FlowWorkClassify
|
||||||
|
FindOne(id int64) *entity.FlowWorkClassify
|
||||||
|
FindListPage(page, pageSize int, data entity.FlowWorkClassify) (*[]entity.FlowWorkClassify, int64)
|
||||||
|
FindList(data entity.FlowWorkClassify) *[]entity.FlowWorkClassify
|
||||||
|
Update(data entity.FlowWorkClassify) *entity.FlowWorkClassify
|
||||||
|
Delete(ids []int64)
|
||||||
|
}
|
||||||
|
|
||||||
|
workclassifyModelImpl struct {
|
||||||
|
table string
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
var FlowWorkClassifyModelDao FlowWorkClassifyModel = &workclassifyModelImpl{
|
||||||
|
table: `flow_work_classify`,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) Insert(data entity.FlowWorkClassify) *entity.FlowWorkClassify {
|
||||||
|
err := global.Db.Table(m.table).Create(&data).Error
|
||||||
|
biz.ErrIsNil(err, "添加工作流分类失败")
|
||||||
|
return &data
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) FindOne(id int64) *entity.FlowWorkClassify {
|
||||||
|
resData := new(entity.FlowWorkClassify)
|
||||||
|
db := global.Db.Table(m.table).Where("id = ?", id)
|
||||||
|
err := db.First(resData).Error
|
||||||
|
biz.ErrIsNil(err, "查询工作流分类失败")
|
||||||
|
return resData
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) FindListPage(page, pageSize int, data entity.FlowWorkClassify) (*[]entity.FlowWorkClassify, int64) {
|
||||||
|
list := make([]entity.FlowWorkClassify, 0)
|
||||||
|
var total int64 = 0
|
||||||
|
offset := pageSize * (page - 1)
|
||||||
|
db := global.Db.Table(m.table)
|
||||||
|
// 此处填写 where参数判断
|
||||||
|
if data.Name != "" {
|
||||||
|
db = db.Where("name like ?", "%"+data.Name+"%")
|
||||||
|
}
|
||||||
|
if data.Creator != 0 {
|
||||||
|
db = db.Where("creator = ?", data.Creator)
|
||||||
|
}
|
||||||
|
err := db.Count(&total).Error
|
||||||
|
err = db.Order("create_time").Limit(pageSize).Offset(offset).Find(&list).Error
|
||||||
|
biz.ErrIsNil(err, "查询工作流分类分页列表失败")
|
||||||
|
return &list, total
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) FindList(data entity.FlowWorkClassify) *[]entity.FlowWorkClassify {
|
||||||
|
list := make([]entity.FlowWorkClassify, 0)
|
||||||
|
db := global.Db.Table(m.table)
|
||||||
|
// 此处填写 where参数判断
|
||||||
|
if data.Name != "" {
|
||||||
|
db = db.Where("name like ?", "%"+data.Name+"%")
|
||||||
|
}
|
||||||
|
if data.Creator != 0 {
|
||||||
|
db = db.Where("creator = ?", data.Creator)
|
||||||
|
}
|
||||||
|
biz.ErrIsNil(db.Order("create_time").Find(&list).Error, "查询工作流分类列表失败")
|
||||||
|
return &list
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) Update(data entity.FlowWorkClassify) *entity.FlowWorkClassify {
|
||||||
|
biz.ErrIsNil(global.Db.Table(m.table).Updates(&data).Error, "修改工作流分类失败")
|
||||||
|
return &data
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *workclassifyModelImpl) Delete(ids []int64) {
|
||||||
|
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.FlowWorkClassify{}, "id in (?)", ids).Error, "删除工作流分类失败")
|
||||||
|
}
|
||||||
2
go.mod
2
go.mod
@@ -24,7 +24,7 @@ require (
|
|||||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
|
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
|
||||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||||
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
|
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
|
||||||
github.com/XM-GO/PandaKit v0.0.0-20220819142346-23e2263623b4 // indirect
|
github.com/XM-GO/PandaKit v0.0.0-20220821142427-3acdfc4785d9 // indirect
|
||||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible // indirect
|
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible // indirect
|
||||||
github.com/brianvoe/gofakeit/v6 v6.0.2 // indirect
|
github.com/brianvoe/gofakeit/v6 v6.0.2 // indirect
|
||||||
github.com/casbin/casbin/v2 v2.37.4 // indirect
|
github.com/casbin/casbin/v2 v2.37.4 // indirect
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -18,6 +18,8 @@ github.com/XM-GO/PandaKit v0.0.0-20220819095140-dd76101b435f h1:Ginj9GfKXfr10uLn
|
|||||||
github.com/XM-GO/PandaKit v0.0.0-20220819095140-dd76101b435f/go.mod h1:A/0dFObLVa7Yzeq6cMmcjNUoajSgcLkEJglLc41BO3w=
|
github.com/XM-GO/PandaKit v0.0.0-20220819095140-dd76101b435f/go.mod h1:A/0dFObLVa7Yzeq6cMmcjNUoajSgcLkEJglLc41BO3w=
|
||||||
github.com/XM-GO/PandaKit v0.0.0-20220819142346-23e2263623b4 h1:0mNXB5TRKIQBg08rEyJfJlOl9WWO0I2P+wpbAg7WFrw=
|
github.com/XM-GO/PandaKit v0.0.0-20220819142346-23e2263623b4 h1:0mNXB5TRKIQBg08rEyJfJlOl9WWO0I2P+wpbAg7WFrw=
|
||||||
github.com/XM-GO/PandaKit v0.0.0-20220819142346-23e2263623b4/go.mod h1:A/0dFObLVa7Yzeq6cMmcjNUoajSgcLkEJglLc41BO3w=
|
github.com/XM-GO/PandaKit v0.0.0-20220819142346-23e2263623b4/go.mod h1:A/0dFObLVa7Yzeq6cMmcjNUoajSgcLkEJglLc41BO3w=
|
||||||
|
github.com/XM-GO/PandaKit v0.0.0-20220821142427-3acdfc4785d9 h1:m0d1Oh4a6UfUyuplkUoI5Ztc6kPZRVXw6SnTtCV4Tj0=
|
||||||
|
github.com/XM-GO/PandaKit v0.0.0-20220821142427-3acdfc4785d9/go.mod h1:A/0dFObLVa7Yzeq6cMmcjNUoajSgcLkEJglLc41BO3w=
|
||||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible h1:ht2+VfbXtNLGhCsnTMc6/N26nSTBK6qdhktjYyjJQkk=
|
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible h1:ht2+VfbXtNLGhCsnTMc6/N26nSTBK6qdhktjYyjJQkk=
|
||||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
|
github.com/aliyun/aliyun-oss-go-sdk v2.2.0+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package initialize
|
|||||||
import (
|
import (
|
||||||
"github.com/XM-GO/PandaKit/biz"
|
"github.com/XM-GO/PandaKit/biz"
|
||||||
devEntity "pandax/apps/develop/entity"
|
devEntity "pandax/apps/develop/entity"
|
||||||
|
flowEntity "pandax/apps/flow/entity"
|
||||||
jobEntity "pandax/apps/job/entity"
|
jobEntity "pandax/apps/job/entity"
|
||||||
logEntity "pandax/apps/log/entity"
|
logEntity "pandax/apps/log/entity"
|
||||||
resSourceEntity "pandax/apps/resource/entity"
|
resSourceEntity "pandax/apps/resource/entity"
|
||||||
@@ -38,6 +39,15 @@ func InitTable() {
|
|||||||
devEntity.DevGenTableColumn{},
|
devEntity.DevGenTableColumn{},
|
||||||
resSourceEntity.ResOss{},
|
resSourceEntity.ResOss{},
|
||||||
resSourceEntity.ResEmail{},
|
resSourceEntity.ResEmail{},
|
||||||
|
|
||||||
|
flowEntity.FlowWorkClassify{},
|
||||||
|
flowEntity.FlowWorkInfo{},
|
||||||
|
flowEntity.FlowWorkTemplates{},
|
||||||
|
flowEntity.FlowWorkOrder{},
|
||||||
|
flowEntity.FlowWorkOrderTemplate{},
|
||||||
|
flowEntity.FlowWorkStage{},
|
||||||
|
flowEntity.FlowWorkTask{},
|
||||||
|
flowEntity.FlowWorkTaskHistory{},
|
||||||
),
|
),
|
||||||
"初始化表失败")
|
"初始化表失败")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -568,7 +568,6 @@ CREATE TABLE `res_osses` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of res_osses
|
-- Records of res_osses
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `res_osses` VALUES (1, '0', '', 'LTAIdAnE8qDuKnZe', 'F3NYT7IWukPrtF4o4832uQpbfkm6Ye', 'xmzimg', 'oss-cn-qingdao.aliyuncs.com', 'alioss', '', '阿里云对象存储1', '0', '2022-01-13 17:02:14', '2022-01-17 10:12:30', NULL);
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_apis
|
-- Table structure for sys_apis
|
||||||
|
|||||||
Reference in New Issue
Block a user