mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-04-25 05:35:18 +08:00
refactor: 代码优化与数据库表列显示配置优化
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"mayfly-go/internal/flow/api/form"
|
||||
"mayfly-go/internal/flow/api/vo"
|
||||
"mayfly-go/internal/flow/application"
|
||||
"mayfly-go/internal/flow/application/dto"
|
||||
"mayfly-go/internal/flow/domain/entity"
|
||||
tagapp "mayfly-go/internal/tag/application"
|
||||
tagentity "mayfly-go/internal/tag/domain/entity"
|
||||
@@ -42,7 +43,7 @@ func (a *Procdef) Save(rc *req.Ctx) {
|
||||
form := &form.Procdef{}
|
||||
procdef := req.BindJsonAndCopyTo(rc, form, new(entity.Procdef))
|
||||
rc.ReqParam = form
|
||||
biz.ErrIsNil(a.ProcdefApp.SaveProcdef(rc.MetaCtx, &application.SaveProcdefParam{
|
||||
biz.ErrIsNil(a.ProcdefApp.SaveProcdef(rc.MetaCtx, &dto.SaveProcdef{
|
||||
Procdef: procdef,
|
||||
CodePaths: form.CodePaths,
|
||||
}))
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package application
|
||||
package dto
|
||||
|
||||
import "mayfly-go/internal/flow/domain/entity"
|
||||
|
||||
type SaveProcdef struct {
|
||||
Procdef *entity.Procdef
|
||||
CodePaths []string
|
||||
}
|
||||
|
||||
// 启动流程实例请求入参
|
||||
type StarProcParam struct {
|
||||
type StarProc struct {
|
||||
BizType string // 业务类型
|
||||
BizKey string // 业务key
|
||||
Remark string // 备注
|
||||
BizForm string // 业务表单信息
|
||||
}
|
||||
|
||||
type CompleteProcinstTaskParam struct {
|
||||
TaskId uint64
|
||||
Remark string // 备注
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package application
|
||||
|
||||
import (
|
||||
"context"
|
||||
"mayfly-go/internal/flow/application/dto"
|
||||
"mayfly-go/internal/flow/domain/entity"
|
||||
"mayfly-go/internal/flow/domain/repository"
|
||||
tagapp "mayfly-go/internal/tag/application"
|
||||
@@ -11,18 +12,13 @@ import (
|
||||
"mayfly-go/pkg/model"
|
||||
)
|
||||
|
||||
type SaveProcdefParam struct {
|
||||
Procdef *entity.Procdef
|
||||
CodePaths []string
|
||||
}
|
||||
|
||||
type Procdef interface {
|
||||
base.App[*entity.Procdef]
|
||||
|
||||
GetPageList(condition *entity.Procdef, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
|
||||
|
||||
// 保存流程实例信息
|
||||
SaveProcdef(ctx context.Context, def *SaveProcdefParam) error
|
||||
SaveProcdef(ctx context.Context, def *dto.SaveProcdef) error
|
||||
|
||||
// 删除流程实例信息
|
||||
DeleteProcdef(ctx context.Context, defId uint64) error
|
||||
@@ -54,7 +50,7 @@ func (p *procdefAppImpl) GetPageList(condition *entity.Procdef, pageParam *model
|
||||
return p.Repo.GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
func (p *procdefAppImpl) SaveProcdef(ctx context.Context, defParam *SaveProcdefParam) error {
|
||||
func (p *procdefAppImpl) SaveProcdef(ctx context.Context, defParam *dto.SaveProcdef) error {
|
||||
def := defParam.Procdef
|
||||
if err := entity.ProcdefStatusEnum.Valid(def.Status); err != nil {
|
||||
return err
|
||||
|
||||
@@ -3,6 +3,7 @@ package application
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"mayfly-go/internal/flow/application/dto"
|
||||
"mayfly-go/internal/flow/domain/entity"
|
||||
"mayfly-go/internal/flow/domain/repository"
|
||||
"mayfly-go/pkg/base"
|
||||
@@ -20,7 +21,7 @@ type Procinst interface {
|
||||
GetProcinstTasks(condition *entity.ProcinstTaskQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
|
||||
|
||||
// StartProc 根据流程定义启动一个流程实例
|
||||
StartProc(ctx context.Context, procdefId uint64, reqParam *StarProcParam) (*entity.Procinst, error)
|
||||
StartProc(ctx context.Context, procdefId uint64, reqParam *dto.StarProc) (*entity.Procinst, error)
|
||||
|
||||
// 取消流程
|
||||
CancelProc(ctx context.Context, procinstId uint64) error
|
||||
@@ -57,7 +58,7 @@ func (p *procinstAppImpl) GetProcinstTasks(condition *entity.ProcinstTaskQuery,
|
||||
return p.procinstTaskRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
func (p *procinstAppImpl) StartProc(ctx context.Context, procdefId uint64, reqParam *StarProcParam) (*entity.Procinst, error) {
|
||||
func (p *procinstAppImpl) StartProc(ctx context.Context, procdefId uint64, reqParam *dto.StarProc) (*entity.Procinst, error) {
|
||||
procdef, err := p.procdefApp.GetById(procdefId)
|
||||
if err != nil {
|
||||
return nil, errorx.NewBiz("流程实例[%d]不存在", procdefId)
|
||||
|
||||
Reference in New Issue
Block a user