From 0b0cb988931ccce6eecfe451a5a77e7c107dd574 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 22 八月 2024 16:25:20 +0800
Subject: [PATCH] 新增动态数据源

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDevicePageReqVO.java                       |   23 ++
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/convert/db/DataSourceConfigConvert.java                         |   36 ++++
 iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/dal/mysql/app/AppMapper.java                                 |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDeviceRespVO.java                          |   75 ++++++++
 iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml                                                               |    2 
 iailab-module-data/iailab-module-data-biz/pom.xml                                                                                                 |   16 +
 pom.xml                                                                                                                                           |    3 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusDeviceController.java |   79 ++++----
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusDeviceDao.java                     |   19 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusDeviceService.java             |    7 
 iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/dto/DataSourceConfigRespDTO.java                         |   35 +++
 iailab-cloud/iailab-nacos/src/main/resources/application.yaml                                                                                     |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusDeviceEntity.java               |   11 +
 iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml                                                                                   |    2 
 iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml                                                             |    6 
 iailab-fast/pom.xml                                                                                                                               |   18 ++
 iailab-framework/iailab-common-biz-tenant/pom.xml                                                                                                 |    1 
 iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApi.java                          |   28 +++
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigBaseVO.java              |   27 +++
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigCreateReqVO.java         |   20 ++
 iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml                                                           |    2 
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApiImpl.java                      |   26 ++
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigSimpleRespVO.java        |   16 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusDeviceServiceImpl.java    |   21 -
 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigUpdateReqVO.java         |   24 ++
 25 files changed, 433 insertions(+), 68 deletions(-)

diff --git a/iailab-cloud/iailab-nacos/src/main/resources/application.yaml b/iailab-cloud/iailab-nacos/src/main/resources/application.yaml
index 89c04a6..45ea50a 100644
--- a/iailab-cloud/iailab-nacos/src/main/resources/application.yaml
+++ b/iailab-cloud/iailab-nacos/src/main/resources/application.yaml
@@ -1,7 +1,7 @@
 db:
   num: 1
   url:
-    '0': jdbc:mysql://172.16.8.100:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+    '0': jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
   password:
     '0': 123456
   user:
diff --git a/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml b/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml
index 2e01529..7fa0abd 100644
--- a/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml
+++ b/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml
@@ -52,7 +52,7 @@
       number_format: 0.
       new_builtin_class_resolver: safer
   datasource:
-    url: jdbc:mysql://172.16.8.100:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: 123456
     driver-class-name: com.mysql.cj.jdbc.Driver
diff --git a/iailab-fast/pom.xml b/iailab-fast/pom.xml
new file mode 100644
index 0000000..4166105
--- /dev/null
+++ b/iailab-fast/pom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>iailab-plat</artifactId>
+        <groupId>com.iailab</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>iailab-fast</artifactId>
+    <description>
+        快速开发框架,默认基础system,data,model
+    </description>
+
+
+</project>
\ No newline at end of file
diff --git a/iailab-framework/iailab-common-biz-tenant/pom.xml b/iailab-framework/iailab-common-biz-tenant/pom.xml
index 15caee0..61b521d 100644
--- a/iailab-framework/iailab-common-biz-tenant/pom.xml
+++ b/iailab-framework/iailab-common-biz-tenant/pom.xml
@@ -89,6 +89,7 @@
 
     </dependencies>
 
+
     <build>
         <plugins>
             <plugin>
diff --git a/iailab-module-data/iailab-module-data-biz/pom.xml b/iailab-module-data/iailab-module-data-biz/pom.xml
index e476258..8221109 100644
--- a/iailab-module-data/iailab-module-data-biz/pom.xml
+++ b/iailab-module-data/iailab-module-data-biz/pom.xml
@@ -79,6 +79,10 @@
             <version>${revision}</version>
         </dependency>
         <dependency>
+            <groupId>com.iailab</groupId>
+            <artifactId>iailab-common-biz-tenant</artifactId>
+        </dependency>
+        <dependency>
             <groupId>com.auth0</groupId>
             <artifactId>java-jwt</artifactId>
             <version>${java-jwt.version}</version>
@@ -106,6 +110,12 @@
             <groupId>org.openscada.external</groupId>
             <artifactId>org.openscada.external.jcifs</artifactId>
             <version>1.2.25</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.bouncycastle</groupId>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.openscada.jinterop</groupId>
@@ -116,6 +126,12 @@
             <groupId>org.openscada.jinterop</groupId>
             <artifactId>org.openscada.jinterop.deps</artifactId>
             <version>1.5.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.bouncycastle</groupId>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.openscada.utgard</groupId>
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusDeviceController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusDeviceController.java
index d70b262..a59347e 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusDeviceController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusDeviceController.java
@@ -1,14 +1,21 @@
 package com.iailab.module.data.channel.modbus.controller.admin;
 
-import com.iailab.module.data.common.utils.PageUtils;
-import com.iailab.module.data.common.utils.R;
+import com.iailab.framework.common.pojo.CommonResult;
+import com.iailab.framework.common.pojo.PageResult;
+import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.modbus.vo.ModBusDevicePageReqVO;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
 import com.iailab.module.data.channel.modbus.service.ChannelModbusDeviceService;
+
 import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import com.iailab.module.data.channel.modbus.vo.ModBusDeviceRespVO;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
 import java.util.UUID;
+
+import static com.iailab.framework.common.pojo.CommonResult.success;
 
 /**
  * 操作modbus配置
@@ -25,59 +32,59 @@
     /**
      * 分页查询设备
      *
-     * @param params
+     * @param reqVO
      */
-    @GetMapping("/list")
-    public R list(@RequestParam Map<String, Object> params){
-        PageUtils page = channelModbusDeviceService.queryPage(params);
+    @GetMapping("/page")
+    public CommonResult<PageResult<ModBusDeviceRespVO>> list(@Valid ModBusDevicePageReqVO reqVO) {
+        PageResult<ChannelModBusDeviceEntity> page = channelModbusDeviceService.queryPage(reqVO);
 
-        return R.ok().put("page", page);
+        return success(BeanUtils.toBean(page, ModBusDeviceRespVO.class));
     }
+
     /**
      * 根据id查询设备详情
      *
      * @param id
      */
     @GetMapping("/info/{id}")
-    public R info(@PathVariable("id") String id){
-        ChannelModBusDeviceEntity info= channelModbusDeviceService.info(id);
-        return R.ok().put("data", info);
-    }
-    /**
-    * 添加设备
-    *
-    * @param channelModBusDeviceEntity
-    */
-    @PostMapping("/add")
-    public R add(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity){
-        String id = UUID.randomUUID().toString();
-        channelModBusDeviceEntity.setId(id);
-        channelModbusDeviceService.add(channelModBusDeviceEntity);
-        return R.ok();
+    public CommonResult<ChannelModBusDeviceEntity> info(@PathVariable("id") String id) {
+        ChannelModBusDeviceEntity info = channelModbusDeviceService.info(id);
+        return success(info);
     }
 
     /**
-    * 修改设备
-    *
-    * @param channelModBusDeviceEntity
-    */
-    @PostMapping("/update")
-    public R update(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) {
+     * 添加设备
+     *
+     * @param channelModBusDeviceEntity
+     */
+    @PostMapping("/add")
+    public CommonResult<Boolean> add(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) {
+        String id = UUID.randomUUID().toString();
+        channelModBusDeviceEntity.setId(id);
+        channelModbusDeviceService.add(channelModBusDeviceEntity);
+        return success(true);
+    }
+
+    /**
+     * 修改设备
+     *
+     * @param channelModBusDeviceEntity
+     */
+    @PutMapping("/update")
+    public CommonResult<Boolean> update(@RequestBody ChannelModBusDeviceEntity channelModBusDeviceEntity) {
         channelModbusDeviceService.update(channelModBusDeviceEntity);
-        return R.ok();
+        return success(true);
     }
 
     /**
      * 删除设备
      *
-     * @param params
-     *
+     * @param id
      */
-    @PostMapping("/delete")
-    public R delete(@RequestBody Map<String, Object> params) {
-        String id = (String)params.get("id");
+    @DeleteMapping("/delete")
+    public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         channelModbusDeviceService.delete(id);
-        return R.ok();
+        return success(true);
     }
 
 
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusDeviceDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusDeviceDao.java
index efc4510..7c6463f 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusDeviceDao.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusDeviceDao.java
@@ -1,10 +1,11 @@
 package com.iailab.module.data.channel.modbus.dao;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.iailab.framework.common.pojo.PageResult;
+import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
+import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
-import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
-import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
-import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
+import com.iailab.module.data.channel.modbus.vo.ModBusDevicePageReqVO;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -12,7 +13,15 @@
  * @Description
  * @createTime 2023年04月24日 11:33:00
  */
+@TenantDS
 @Mapper
-public interface ChannelModBusDeviceDao extends BaseMapper<ChannelModBusDeviceEntity> {
+public interface ChannelModBusDeviceDao extends BaseMapperX<ChannelModBusDeviceEntity> {
+
+    default PageResult<ChannelModBusDeviceEntity> selectPage(ModBusDevicePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ChannelModBusDeviceEntity>()
+                .likeIfPresent(ChannelModBusDeviceEntity::getName, reqVO.getName())
+                .likeIfPresent(ChannelModBusDeviceEntity::getAddress, reqVO.getAddress())
+                .orderByDesc(ChannelModBusDeviceEntity::getCreateTime));
+    }
 
 }
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusDeviceEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusDeviceEntity.java
index 6bc525e..8a16759 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusDeviceEntity.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusDeviceEntity.java
@@ -7,6 +7,7 @@
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * ModBus设备表
@@ -82,4 +83,14 @@
      */
     private String projectReference;
 
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
 }
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusDeviceService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusDeviceService.java
index 85fe38e..311222f 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusDeviceService.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusDeviceService.java
@@ -1,6 +1,7 @@
 package com.iailab.module.data.channel.modbus.service;
 
-import com.iailab.module.data.common.utils.PageUtils;
+import com.iailab.framework.common.pojo.PageResult;
+import com.iailab.module.data.channel.modbus.vo.ModBusDevicePageReqVO;
 import com.iailab.module.data.channel.modbus.dto.ChannelModBusDeviceDTO;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
 
@@ -16,9 +17,9 @@
     /**
      * 分页查询设备
      *
-     * @param params
+     * @param reqVO
      */
-    PageUtils queryPage(Map<String, Object> params);
+    PageResult<ChannelModBusDeviceEntity> queryPage(ModBusDevicePageReqVO reqVO);
     /**
      * 添加设备
      *
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusDeviceServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusDeviceServiceImpl.java
index aaeb70d..313949b 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusDeviceServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusDeviceServiceImpl.java
@@ -1,12 +1,10 @@
 package com.iailab.module.data.channel.modbus.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.ConvertUtils;
-import com.iailab.module.data.common.utils.PageUtils;
-import com.iailab.module.data.common.utils.Query;
+import com.iailab.module.data.channel.modbus.vo.ModBusDevicePageReqVO;
 import com.iailab.module.data.channel.modbus.dao.ChannelModBusDeviceDao;
 import com.iailab.module.data.channel.modbus.dto.ChannelModBusDeviceDTO;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity;
@@ -33,20 +31,11 @@
     /**
      * 分页查询设备
      *
-     * @param params
+     * @param reqVO
      */
     @Override
-    public PageUtils queryPage(Map<String, Object> params) {
-
-        String name = (String) params.get("name");
-
-        IPage<ChannelModBusDeviceEntity> page = this.page(
-                new Query<ChannelModBusDeviceEntity>().getPage(params),
-                new QueryWrapper<ChannelModBusDeviceEntity>()
-                        .like(StringUtils.isNotBlank(name), "name", name)
-                        .orderByDesc("create_time")
-        );
-        return new PageUtils(page);
+    public PageResult<ChannelModBusDeviceEntity> queryPage(ModBusDevicePageReqVO reqVO) {
+        return channelModBusDeviceDao.selectPage(reqVO);
     }
 
     /**
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDevicePageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDevicePageReqVO.java
new file mode 100644
index 0000000..b505b75
--- /dev/null
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDevicePageReqVO.java
@@ -0,0 +1,23 @@
+package com.iailab.module.data.channel.modbus.vo;
+
+import com.iailab.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月22日
+ */
+@Schema(description = "数据平台 - ModeBus分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ModBusDevicePageReqVO extends PageParam {
+
+    private String name;
+
+    private String address;
+}
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDeviceRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDeviceRespVO.java
new file mode 100644
index 0000000..bd816fa
--- /dev/null
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusDeviceRespVO.java
@@ -0,0 +1,75 @@
+package com.iailab.module.data.channel.modbus.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月22日
+ */
+@Schema(description = "数据平台 - ModBusDevice Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ModBusDeviceRespVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("ID")
+    private String id;
+
+    @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("设备名称")
+    private String name;
+
+    @Schema(description = "IP地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("IP地址")
+    private String address;
+
+    @Schema(description = "端口", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("端口")
+    private Integer port;
+
+    @Schema(description = "不活动超时(ms)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("不活动超时(ms)")
+    private Integer connectInactivityTimeout;
+
+    @Schema(description = "重连超时(ms)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("重连超时(ms)")
+    private Integer reconnectInterval;
+
+    @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("重试次数")
+    private Integer attemptsBeforeTimeout;
+
+    @Schema(description = "重试间隔(ms)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("重试间隔(ms)")
+    private Integer waitToRetryMilliseconds;
+
+    @Schema(description = "读超时(ms)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("读超时(ms)")
+    private Integer readTimeout;
+
+    @Schema(description = "写超时(ms)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("写超时(ms)")
+    private Integer writeTimeout;
+
+    @Schema(description = "是否使用优化", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("是否使用优化")
+    private Boolean useOptimizedBlockRead;
+
+    @Schema(description = "统内部用,默认空字符串", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("统内部用,默认空字符串")
+    private String projectReference;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("创建时间")
+    private Date createTime;
+
+    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("更新时间")
+    private Date updateTime;
+}
\ No newline at end of file
diff --git a/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApi.java b/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApi.java
new file mode 100644
index 0000000..fee6243
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApi.java
@@ -0,0 +1,28 @@
+package com.iailab.module.infra.api.db;
+
+import com.iailab.module.infra.api.db.dto.DataSourceConfigRespDTO;
+import com.iailab.module.infra.enums.ApiConstants;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 数据源配置 API 接口
+ *
+ * @author 芋道源码
+ */
+@FeignClient(name = ApiConstants.NAME)
+@Tag(name = "RPC 服务 - 数据源配置")
+public interface DataSourceConfigServiceApi {
+
+    String PREFIX = ApiConstants.PREFIX + "/data-source";
+
+    @PostMapping(PREFIX + "/get")
+    @Operation(summary = "获得数据源配置")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    DataSourceConfigRespDTO getDataSourceConfig(@RequestParam("id") Long id);
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/dto/DataSourceConfigRespDTO.java b/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/dto/DataSourceConfigRespDTO.java
new file mode 100644
index 0000000..ce03cf4
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-api/src/main/java/com/iailab/module/infra/api/db/dto/DataSourceConfigRespDTO.java
@@ -0,0 +1,35 @@
+package com.iailab.module.infra.api.db.dto;
+
+import lombok.Data;
+
+/**
+ * 数据源配置 Response DTO
+ *
+ * @author 芋道源码
+ */
+@Data
+public class DataSourceConfigRespDTO {
+
+    /**
+     * 主键编号
+     */
+    private Long id;
+    /**
+     * 连接名
+     */
+    private String name;
+
+    /**
+     * 数据源连接
+     */
+    private String url;
+    /**
+     * 用户名
+     */
+    private String username;
+    /**
+     * 密码
+     */
+    private String password;
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApiImpl.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApiImpl.java
new file mode 100644
index 0000000..5df495a
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/db/DataSourceConfigServiceApiImpl.java
@@ -0,0 +1,26 @@
+package com.iailab.module.infra.api.db;
+
+import com.iailab.module.infra.api.db.dto.DataSourceConfigRespDTO;
+import com.iailab.module.infra.convert.db.DataSourceConfigConvert;
+import com.iailab.module.infra.service.db.DataSourceConfigService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * 数据源配置 API 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+public class DataSourceConfigServiceApiImpl implements DataSourceConfigServiceApi {
+
+    @Resource
+    private DataSourceConfigService dataSourceConfigService;
+
+    @Override
+    public DataSourceConfigRespDTO getDataSourceConfig(Long id) {
+        return DataSourceConfigConvert.INSTANCE.convert02(dataSourceConfigService.getDataSourceConfig(id));
+    }
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigBaseVO.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigBaseVO.java
new file mode 100644
index 0000000..ec44265
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigBaseVO.java
@@ -0,0 +1,27 @@
+package com.iailab.module.infra.controller.admin.db.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+* 数据源配置 Base VO,提供给添加、修改、详细的子 VO 使用
+* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
+*/
+@Data
+public class DataSourceConfigBaseVO {
+
+    @Schema(description = "数据源名称", required = true, example = "test")
+    @NotNull(message = "数据源名称不能为空")
+    private String name;
+
+    @Schema(description = "数据源连接", required = true, example = "jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro")
+    @NotNull(message = "数据源连接不能为空")
+    private String url;
+
+    @Schema(description = "用户名", required = true, example = "root")
+    @NotNull(message = "用户名不能为空")
+    private String username;
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigCreateReqVO.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigCreateReqVO.java
new file mode 100644
index 0000000..70069ba
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigCreateReqVO.java
@@ -0,0 +1,20 @@
+package com.iailab.module.infra.controller.admin.db.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 数据源配置创建 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class DataSourceConfigCreateReqVO extends DataSourceConfigBaseVO {
+
+    @Schema(description = "密码", required = true, example = "123456")
+    @NotNull(message = "密码不能为空")
+    private String password;
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigSimpleRespVO.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigSimpleRespVO.java
new file mode 100644
index 0000000..bab8658
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigSimpleRespVO.java
@@ -0,0 +1,16 @@
+package com.iailab.module.infra.controller.admin.db.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 数据源配置的精简 Response VO")
+@Data
+public class DataSourceConfigSimpleRespVO {
+
+    @Schema(description = "主键编号", required = true, example = "1024")
+    private Integer id;
+
+    @Schema(description = "数据源名称", required = true, example = "test")
+    private String name;
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigUpdateReqVO.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigUpdateReqVO.java
new file mode 100644
index 0000000..2997373
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/db/vo/DataSourceConfigUpdateReqVO.java
@@ -0,0 +1,24 @@
+package com.iailab.module.infra.controller.admin.db.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 数据源配置更新 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class DataSourceConfigUpdateReqVO extends DataSourceConfigBaseVO {
+
+    @Schema(description = "主键编号", required = true, example = "1024")
+    @NotNull(message = "主键编号不能为空")
+    private Long id;
+
+    @Schema(description = "密码", required = true, example = "123456")
+    @NotNull(message = "密码不能为空")
+    private String password;
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/convert/db/DataSourceConfigConvert.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/convert/db/DataSourceConfigConvert.java
new file mode 100644
index 0000000..2c6dcd4
--- /dev/null
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/convert/db/DataSourceConfigConvert.java
@@ -0,0 +1,36 @@
+package com.iailab.module.infra.convert.db;
+
+import com.iailab.module.infra.api.db.dto.DataSourceConfigRespDTO;
+import com.iailab.module.infra.controller.admin.db.vo.DataSourceConfigCreateReqVO;
+import com.iailab.module.infra.controller.admin.db.vo.DataSourceConfigRespVO;
+import com.iailab.module.infra.controller.admin.db.vo.DataSourceConfigSimpleRespVO;
+import com.iailab.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
+import com.iailab.module.infra.dal.dataobject.db.DataSourceConfigDO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+import java.util.List;
+
+/**
+ * 数据源配置 Convert
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface DataSourceConfigConvert {
+
+    DataSourceConfigConvert INSTANCE = Mappers.getMapper(DataSourceConfigConvert.class);
+
+    DataSourceConfigDO convert(DataSourceConfigCreateReqVO bean);
+
+    DataSourceConfigDO convert(DataSourceConfigUpdateReqVO bean);
+
+    DataSourceConfigRespVO convert(DataSourceConfigDO bean);
+
+    List<DataSourceConfigRespVO> convertList(List<DataSourceConfigDO> list);
+
+    DataSourceConfigRespDTO convert02(DataSourceConfigDO bean);
+
+    List<DataSourceConfigSimpleRespVO> convertList02(List<DataSourceConfigDO> list);
+
+}
diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml
index ae450ec..54f313b 100644
--- a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml
+++ b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml
@@ -44,7 +44,7 @@
       primary: master
       datasource:
         master:
-          url: jdbc:mysql://172.16.8.100:3306/iailab-plat?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
+          url: jdbc:mysql://127.0.0.1:3306/iailab_plat_system?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
           #          url: jdbc:mysql://127.0.0.1:3306/iailab-plat?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
           #          url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
           #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
diff --git a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/dal/mysql/app/AppMapper.java b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/dal/mysql/app/AppMapper.java
index fc04cee..c23e44f 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/dal/mysql/app/AppMapper.java
+++ b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/dal/mysql/app/AppMapper.java
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
 import com.iailab.module.system.controller.admin.app.vo.AppPageReqVO;
 import com.iailab.module.system.dal.dataobject.app.AppDO;
 import org.apache.ibatis.annotations.Mapper;
@@ -13,6 +14,7 @@
  * @createTime 2024年08月16日
  */
 @Mapper
+@TenantDS
 public interface AppMapper extends BaseMapperX<AppDO> {
 
     default PageResult<AppDO> selectPage(AppPageReqVO reqVO) {
diff --git a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml
index d4d62cd..c3c18fa 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml
+++ b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml
@@ -39,12 +39,12 @@
       primary: master
       datasource:
         master:
-          url: jdbc:mysql://127.0.0.1:3306/iailab-plat?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
+          url: jdbc:mysql://127.0.0.1:3306/iailab_plat_system?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
           username: root
           password: 123456
         slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
           lazy: true # 开启懒加载,保证启动速度
-          url: jdbc:mysql://127.0.0.1:3306/iailab-plat?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
+          url: jdbc:mysql://127.0.0.1:3306/iailab_plat_system?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
           username: root
           password: 123456
 
@@ -53,7 +53,7 @@
     host: 127.0.0.1 # 地址
     port: 6379 # 端口
     database: 1 # 数据库索引
-    password: 123456 # 密码,建议生产环境开启
+    #password: 123456 # 密码,建议生产环境开启
 
 --- #################### MQ 消息队列相关配置 ####################
 
diff --git a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml
index eafd929..2fe59e7 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml
+++ b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml
@@ -77,7 +77,7 @@
 
   # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
   redis:
-    host: 172.16.8.100 # 地址
+    host: 127.0.0.1 # 地址
     port: 6379 # 端口
     database: 0 # 数据库索引
     password: 123456 # 密码,建议生产环境开启
diff --git a/pom.xml b/pom.xml
index 5871d99..b6b1bfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,6 +18,7 @@
         <module>iailab-module-report</module>
         <module>iailab-module-data</module>
         <module>iailab-module-model</module>
+        <!--<module>iailab-fast</module>-->
     </modules>
 
     <name>${project.artifactId}</name>
@@ -117,7 +118,7 @@
                 <nacos.username>nacos</nacos.username>
                 <nacos.password>nacos</nacos.password>
                 <nacos.metadata.version>1.0.0</nacos.metadata.version>
-                <log.path>D:\data</log.path>
+                <log.path>E:\DLUT\iailab-plat</log.path>
                 <logstash.address>127.0.0.1:4560</logstash.address>
             </properties>
             <activation>

--
Gitblit v1.9.3