feat: sql解析器替换、工单统一由‘我的流程’发起、流程定义支持自定义条件触发审批、资源隐藏编号、model支持物理删除等

This commit is contained in:
meilin.huang
2024-10-16 17:24:50 +08:00
parent 43edef412c
commit e135e4ce64
170 changed files with 397197 additions and 1251 deletions

View File

@@ -2,7 +2,6 @@ package form
type Mongo struct {
Id uint64 `json:"id"`
Code string `json:"code" binding:"required"`
Uri string `binding:"required" json:"uri"`
SshTunnelMachineId int `json:"sshTunnelMachineId"` // ssh隧道机器id
Name string `binding:"required" json:"name"`

View File

@@ -12,6 +12,7 @@ import (
"mayfly-go/pkg/base"
"mayfly-go/pkg/errorx"
"mayfly-go/pkg/model"
"mayfly-go/pkg/utils/stringx"
)
type Mongo interface {
@@ -84,9 +85,9 @@ func (d *mongoAppImpl) SaveMongo(ctx context.Context, m *entity.Mongo, tagCodePa
if err == nil {
return errorx.NewBiz("该名称已存在")
}
if d.CountByCond(&entity.Mongo{Code: m.Code}) > 0 {
return errorx.NewBiz("该编码已存在")
}
// 生成随机编号
m.Code = stringx.Rand(10)
return d.Tx(ctx, func(ctx context.Context) error {
return d.Insert(ctx, m)
@@ -95,6 +96,7 @@ func (d *mongoAppImpl) SaveMongo(ctx context.Context, m *entity.Mongo, tagCodePa
ResourceTag: &tagdto.ResourceTag{
Type: tagentity.TagTypeMongo,
Code: m.Code,
Name: m.Name,
},
ParentTagCodePaths: tagCodePaths,
})
@@ -117,7 +119,7 @@ func (d *mongoAppImpl) SaveMongo(ctx context.Context, m *entity.Mongo, tagCodePa
return d.UpdateById(ctx, m)
}, func(ctx context.Context) error {
if oldMongo.Name != m.Name {
if err := d.tagApp.UpdateTagName(ctx, tagentity.TagTypeMachine, oldMongo.Code, m.Name); err != nil {
if err := d.tagApp.UpdateTagName(ctx, tagentity.TagTypeMongo, oldMongo.Code, m.Name); err != nil {
return err
}
}

View File

@@ -7,6 +7,7 @@ type MongoQuery struct {
Code string `json:"code" form:"code"`
Name string
Keyword string `json:"keyword" form:"keyword"`
Uri string
SshTunnelMachineId uint64 // ssh隧道机器id
TagPath string `json:"tagPath" form:"tagPath"`

View File

@@ -21,5 +21,11 @@ func (d *mongoRepoImpl) GetList(condition *entity.MongoQuery, pageParam *model.P
Like("name", condition.Name).
Eq("code", condition.Code).
In("code", condition.Codes)
keyword := condition.Keyword
if keyword != "" {
keyword = "%" + keyword + "%"
qd.And("name like ? or code like ?", keyword, keyword)
}
return d.PageByCondToAny(qd, pageParam, toEntity)
}