mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	fix: 前端代理默认端口调整&水印开关不生效
This commit is contained in:
		@@ -405,9 +405,7 @@ const toIndex = async () => {
 | 
				
			|||||||
        // 关闭 loading
 | 
					        // 关闭 loading
 | 
				
			||||||
        state.loading.signIn = true;
 | 
					        state.loading.signIn = true;
 | 
				
			||||||
        ElMessage.success(`${currentTimeInfo},欢迎回来!`);
 | 
					        ElMessage.success(`${currentTimeInfo},欢迎回来!`);
 | 
				
			||||||
        if (await useWartermark()) {
 | 
					        saveUseWatermark(await useWartermark());
 | 
				
			||||||
            saveUseWatermark(true);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }, 300);
 | 
					    }, 300);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,12 @@
 | 
				
			|||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
        <el-row class="mb5">
 | 
					        <el-row class="mb5">
 | 
				
			||||||
            <el-col :span="4">
 | 
					            <el-col :span="4">
 | 
				
			||||||
                <el-button type="primary" icon="plus" @click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases.split(' ') }, state.db)" size="small"
 | 
					                <el-button
 | 
				
			||||||
 | 
					                    :disabled="!state.db || !nowDbInst.id"
 | 
				
			||||||
 | 
					                    type="primary"
 | 
				
			||||||
 | 
					                    icon="plus"
 | 
				
			||||||
 | 
					                    @click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases?.split(' ') }, state.db)"
 | 
				
			||||||
 | 
					                    size="small"
 | 
				
			||||||
                    >新建查询</el-button
 | 
					                    >新建查询</el-button
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
            </el-col>
 | 
					            </el-col>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ const viteConfig: UserConfig = {
 | 
				
			|||||||
        open: VITE_OPEN,
 | 
					        open: VITE_OPEN,
 | 
				
			||||||
        proxy: {
 | 
					        proxy: {
 | 
				
			||||||
            '/api': {
 | 
					            '/api': {
 | 
				
			||||||
                target: 'http://localhost:8888',
 | 
					                target: 'http://localhost:18888',
 | 
				
			||||||
                ws: true,
 | 
					                ws: true,
 | 
				
			||||||
                changeOrigin: true,
 | 
					                changeOrigin: true,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,42 +76,36 @@ func (d *dbAppImpl) GetById(id uint64, cols ...string) *entity.Db {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (d *dbAppImpl) Save(dbEntity *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)
 | 
						err := d.GetDbBy(oldDb)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if dbEntity.Id == 0 {
 | 
						if dbEntity.Id == 0 {
 | 
				
			||||||
		biz.IsTrue(err != nil, "该数据库资源已存在")
 | 
							biz.IsTrue(err != nil, "该实例下数据库名已存在")
 | 
				
			||||||
		d.dbRepo.Insert(dbEntity)
 | 
							d.dbRepo.Insert(dbEntity)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 如果存在该库,则校验修改的库是否为该库
 | 
						// 如果存在该库,则校验修改的库是否为该库
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
		biz.IsTrue(oldDb.Id == dbEntity.Id, "该数据库资源已存在")
 | 
							biz.IsTrue(oldDb.Id == dbEntity.Id, "该实例下数据库名已存在")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dbId := dbEntity.Id
 | 
						dbId := dbEntity.Id
 | 
				
			||||||
	old := d.GetById(dbId)
 | 
						old := d.GetById(dbId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var oldDbs []any
 | 
						oldDbs := strings.Split(old.Database, " ")
 | 
				
			||||||
	for _, v := range 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)
 | 
							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记录
 | 
							// 删除该库关联的所有sql记录
 | 
				
			||||||
		d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v.(string)})
 | 
							d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d.dbRepo.Update(dbEntity)
 | 
						d.dbRepo.Update(dbEntity)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user