fix: 前端代理默认端口调整&水印开关不生效

This commit is contained in:
meilin.huang
2023-09-27 17:19:58 +08:00
parent 92dff6fdc3
commit fac71a4794
4 changed files with 21 additions and 24 deletions

View File

@@ -76,42 +76,36 @@ func (d *dbAppImpl) GetById(id uint64, cols ...string) *entity.Db {
}
func (d *dbAppImpl) Save(dbEntity *entity.Db) {
// 查找是否存在该库
oldDb := &entity.Db{Name: dbEntity.Name}
// 查找是否存在
oldDb := &entity.Db{Name: dbEntity.Name, InstanceId: dbEntity.InstanceId}
err := d.GetDbBy(oldDb)
if dbEntity.Id == 0 {
biz.IsTrue(err != nil, "该数据库资源已存在")
biz.IsTrue(err != nil, "该实例下数据库已存在")
d.dbRepo.Insert(dbEntity)
return
}
// 如果存在该库,则校验修改的库是否为该库
if err == nil {
biz.IsTrue(oldDb.Id == dbEntity.Id, "该数据库资源已存在")
biz.IsTrue(oldDb.Id == dbEntity.Id, "该实例下数据库已存在")
}
dbId := dbEntity.Id
old := d.GetById(dbId)
var oldDbs []any
for _, v := range strings.Split(old.Database, " ") {
oldDbs := strings.Split(old.Database, " ")
newDbs := strings.Split(dbEntity.Database, " ")
// 比较新旧数据库列表,需要将移除的数据库相关联的信息删除
_, delDb, _ := collx.ArrayCompare(newDbs, oldDbs, func(i1, i2 string) bool {
return i1 == i2
})
for _, v := range delDb {
// 关闭数据库连接
CloseDb(dbEntity.Id, v)
oldDbs = append(oldDbs, v)
}
var newDbs []any
for _, v := range strings.Split(dbEntity.Database, " ") {
newDbs = append(newDbs, v)
}
// 比较新旧数据库列表,需要将移除的数据库相关联的信息删除
_, delDb, _ := collx.ArrayCompare(newDbs, oldDbs, func(i1, i2 any) bool {
return i1.(string) == i2.(string)
})
for _, v := range delDb {
// 删除该库关联的所有sql记录
d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v.(string)})
d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v})
}
d.dbRepo.Update(dbEntity)