mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: sql解析器替换、工单统一由‘我的流程’发起、流程定义支持自定义条件触发审批、资源隐藏编号、model支持物理删除等
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user