数据源管理增加所属机构,并将数据源编码指定为机构编码

This commit is contained in:
曹磊 2025-04-03 16:38:33 +08:00
parent 5269f55d6d
commit b24e8f50b8
6 changed files with 55 additions and 2 deletions

View File

@ -48,7 +48,6 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
@Autowired @Autowired
private ISysDataSourceService sysDataSourceService; private ISysDataSourceService sysDataSourceService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -224,6 +223,18 @@ public class SysDataSourceController extends JeecgController<SysDataSource, ISys
return super.importExcel(request, response, SysDataSource.class); return super.importExcel(request, response, SysDataSource.class);
} }
/**
* 机构列表查询
*
* @param addFLag
* @return
*/
@AutoLog(value = "多数据源管理-机构列表查询")
@ApiOperation(value = "多数据源管理-机构列表查询", notes = "多数据源管理-机构列表查询")
@RequiresPermissions("system:datasource:list")
@GetMapping(value = "/departList")
public Result<List<SysDataSource>> departList(@RequestParam(name = "addFLag") String addFLag) {
return this.sysDataSourceService.queryDepartList(addFLag);
}
} }

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.system.entity; package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -116,8 +117,13 @@ public class SysDataSource {
*/ */
@Excel(name = "所属部门", width = 15) @Excel(name = "所属部门", width = 15)
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "org_code")
private java.lang.String sysOrgCode; private java.lang.String sysOrgCode;
@TableField(exist = false)
@ApiModelProperty(value = "所属部门")
private java.lang.String departName;
/**租户ID*/ /**租户ID*/
@ApiModelProperty(value = "租户ID") @ApiModelProperty(value = "租户ID")
private java.lang.Integer tenantId; private java.lang.Integer tenantId;

View File

@ -2,6 +2,9 @@ package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.entity.SysDataSource; import org.jeecg.modules.system.entity.SysDataSource;
import org.springframework.data.repository.query.Param;
import java.util.List;
/** /**
* @Description: 多数据源管理 * @Description: 多数据源管理
@ -11,4 +14,6 @@ import org.jeecg.modules.system.entity.SysDataSource;
*/ */
public interface SysDataSourceMapper extends BaseMapper<SysDataSource> { public interface SysDataSourceMapper extends BaseMapper<SysDataSource> {
List<SysDataSource> queryDepartList(@Param("addFLag") String addFLag);
} }

View File

@ -2,4 +2,15 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.SysDataSourceMapper"> <mapper namespace="org.jeecg.modules.system.mapper.SysDataSourceMapper">
<select id="queryDepartList" parameterType="String" resultType="org.jeecg.modules.system.entity.SysDataSource">
select org_code as code,
depart_name as departName
from sys_depart
where del_flag = '0'
and org_category='1'
<if test="addFLag != null and addFLag != ''">
and org_code NOT IN ( select sys_org_code from sys_data_source )
</if>
</select>
</mapper> </mapper>

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.system.entity.SysDataSource; import org.jeecg.modules.system.entity.SysDataSource;
import java.util.List;
/** /**
* @Description: 多数据源管理 * @Description: 多数据源管理
* @Author: jeecg-boot * @Author: jeecg-boot
@ -33,4 +35,11 @@ public interface ISysDataSourceService extends IService<SysDataSource> {
* @return * @return
*/ */
Result deleteDataSource(String id); Result deleteDataSource(String id);
/**
* 机构列表查询
* @param addFLag
* @return
*/
Result<List<SysDataSource>> queryDepartList(String addFLag);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.List;
/** /**
* @Description: 多数据源管理 * @Description: 多数据源管理
@ -128,4 +129,14 @@ public class SysDataSourceServiceImpl extends ServiceImpl<SysDataSourceMapper, S
return count(qw); return count(qw);
} }
/**
* 机构列表查询
* @param addFLag
* @return
*/
@Override
public Result<List<SysDataSource>> queryDepartList(String addFLag) {
List<SysDataSource> list = baseMapper.queryDepartList(addFLag);
return Result.OK(list);
}
} }