diff --git a/pom.xml b/pom.xml index b6c9087..479a474 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ 5.3.33 5.7.12 1.2.23 + 3.4.1 1.21 3.0.0 2.3.3 @@ -70,6 +71,20 @@ ${druid.version} + + + com.baomidou + mybatis-plus-boot-starter + ${mp.version} + + + + + com.baomidou + mybatis-plus-extension + ${mp.version} + + eu.bitwalker @@ -77,12 +92,6 @@ ${bitwalker.version} - - - com.github.pagehelper - pagehelper-spring-boot-starter - ${pagehelper.boot.version} - @@ -181,6 +190,12 @@ ${sync.version} + + com.lyr + sync-gather + ${sync.version} + + @@ -191,6 +206,7 @@ sync-quartz sync-generator sync-common + sync-gather pom diff --git a/sync-admin/pom.xml b/sync-admin/pom.xml index ddaef56..1bc6ce7 100644 --- a/sync-admin/pom.xml +++ b/sync-admin/pom.xml @@ -61,6 +61,12 @@ sync-generator + + + com.lyr + sync-gather + + diff --git a/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysLogininforController.java b/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysLogininforController.java index f76d7e9..cda2985 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysLogininforController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysLogininforController.java @@ -33,7 +33,6 @@ public class SysLogininforController extends BaseController { @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") @GetMapping("/list") public TableDataInfo list(SysLogininfor logininfor) { - startPage(); List list = logininforService.selectLogininforList(logininfor); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysOperlogController.java b/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysOperlogController.java index a06f70e..9c43907 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysOperlogController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/monitor/SysOperlogController.java @@ -29,7 +29,7 @@ public class SysOperlogController extends BaseController { @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") @GetMapping("/list") public TableDataInfo list(SysOperLog operLog) { - startPage(); + List list = operLogService.selectOperLogList(operLog); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysConfigController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysConfigController.java index b113671..c3cd4d7 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysConfigController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysConfigController.java @@ -33,7 +33,7 @@ public class SysConfigController extends BaseController { @PreAuthorize("@ss.hasPermi('system:config:list')") @GetMapping("/list") public TableDataInfo list(SysConfig config) { - startPage(); + List list = configService.selectConfigList(config); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictDataController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictDataController.java index 41a927f..efeb7f1 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictDataController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictDataController.java @@ -36,7 +36,7 @@ public class SysDictDataController extends BaseController { @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") public TableDataInfo list(SysDictData dictData) { - startPage(); + List list = dictDataService.selectDictDataList(dictData); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictTypeController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictTypeController.java index bdfe66f..2fddf4d 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictTypeController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysDictTypeController.java @@ -30,7 +30,7 @@ public class SysDictTypeController extends BaseController { @PreAuthorize("@ss.hasPermi('system:dict:list')") @GetMapping("/list") public TableDataInfo list(SysDictType dictType) { - startPage(); + List list = dictTypeService.selectDictTypeList(dictType); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysNoticeController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysNoticeController.java index 292e332..036afd9 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysNoticeController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysNoticeController.java @@ -31,7 +31,7 @@ public class SysNoticeController extends BaseController { @PreAuthorize("@ss.hasPermi('system:notice:list')") @GetMapping("/list") public TableDataInfo list(SysNotice notice) { - startPage(); + List list = noticeService.selectNoticeList(notice); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysPostController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysPostController.java index 41517c2..6625251 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysPostController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysPostController.java @@ -33,7 +33,7 @@ public class SysPostController extends BaseController { @PreAuthorize("@ss.hasPermi('system:post:list')") @GetMapping("/list") public TableDataInfo list(SysPost post) { - startPage(); + List list = postService.selectPostList(post); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysRoleController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysRoleController.java index 82c726f..83ed625 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysRoleController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysRoleController.java @@ -51,7 +51,7 @@ public class SysRoleController extends BaseController { @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") public TableDataInfo list(SysRole role) { - startPage(); + List list = roleService.selectRoleList(role); return getDataTable(list); } @@ -171,7 +171,7 @@ public class SysRoleController extends BaseController { @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/allocatedList") public TableDataInfo allocatedList(SysUser user) { - startPage(); + List list = userService.selectAllocatedList(user); return getDataTable(list); } @@ -182,7 +182,7 @@ public class SysRoleController extends BaseController { @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/unallocatedList") public TableDataInfo unallocatedList(SysUser user) { - startPage(); + List list = userService.selectUnallocatedList(user); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/system/SysUserController.java b/sync-admin/src/main/java/com/lyr/web/controller/system/SysUserController.java index 8b53f93..4921eb9 100644 --- a/sync-admin/src/main/java/com/lyr/web/controller/system/SysUserController.java +++ b/sync-admin/src/main/java/com/lyr/web/controller/system/SysUserController.java @@ -52,7 +52,7 @@ public class SysUserController extends BaseController { @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") public TableDataInfo list(SysUser user) { - startPage(); + List list = userService.selectUserList(user); return getDataTable(list); } diff --git a/sync-admin/src/main/java/com/lyr/web/controller/tool/DataSourceManagerController.java b/sync-admin/src/main/java/com/lyr/web/controller/tool/DataSourceManagerController.java new file mode 100644 index 0000000..0fb2229 --- /dev/null +++ b/sync-admin/src/main/java/com/lyr/web/controller/tool/DataSourceManagerController.java @@ -0,0 +1,19 @@ +package com.lyr.web.controller.tool; + +import com.lyr.framework.manager.DataSourceManagerService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @author liyc + * @date 2024/10/30 + * @description TODO + **/ +@RestController("/dataSourceManager") +public class DataSourceManagerController { + + + +} diff --git a/sync-admin/src/main/resources/application.yml b/sync-admin/src/main/resources/application.yml index e539dc3..5c45fe6 100644 --- a/sync-admin/src/main/resources/application.yml +++ b/sync-admin/src/main/resources/application.yml @@ -100,25 +100,23 @@ token: # 令牌有效期(默认30分钟) expireTime: 30 -# MyBatis配置 -mybatis: - # 搜索指定包别名 + +mybatis-plus: typeAliasesPackage: com.lyr.**.domain - # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml - -# PageHelper分页插件 -pagehelper: - helperDialect: mysql - supportMethodsArguments: true - params: count=countSql + mapperPackage: com.lyr.**.mapper + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + map-underscore-to-camel-case: true + global-config: + db-config: + id-type: AUTO + banner: off # Swagger配置 swagger: # 是否开启swagger - enabled: true + enabled: false # 请求前缀 pathMapping: /dev-api diff --git a/sync-admin/target/classes/application.yml b/sync-admin/target/classes/application.yml index c133c49..2d6cc3d 100644 --- a/sync-admin/target/classes/application.yml +++ b/sync-admin/target/classes/application.yml @@ -100,25 +100,23 @@ token: # 令牌有效期(默认30分钟) expireTime: 30 -# MyBatis配置 -mybatis: - # 搜索指定包别名 + +mybatis-plus: typeAliasesPackage: com.lyr.**.domain - # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml - -# PageHelper分页插件 -pagehelper: - helperDialect: mysql - supportMethodsArguments: true - params: count=countSql + mapperPackage: com.lyr.**.mapper + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + map-underscore-to-camel-case: true + global-config: + db-config: + id-type: AUTO + banner: off # Swagger配置 swagger: # 是否开启swagger - enabled: true + enabled: false # 请求前缀 pathMapping: /dev-api diff --git a/sync-admin/target/classes/com/lyr/web/controller/monitor/SysLogininforController.class b/sync-admin/target/classes/com/lyr/web/controller/monitor/SysLogininforController.class index e01dd35..53a2e17 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/monitor/SysLogininforController.class and b/sync-admin/target/classes/com/lyr/web/controller/monitor/SysLogininforController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/monitor/SysOperlogController.class b/sync-admin/target/classes/com/lyr/web/controller/monitor/SysOperlogController.class index 0b69aa3..cb06921 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/monitor/SysOperlogController.class and b/sync-admin/target/classes/com/lyr/web/controller/monitor/SysOperlogController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysConfigController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysConfigController.class index e1424a7..cc05cf1 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysConfigController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysConfigController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysDictDataController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysDictDataController.class index 7f499e0..2dfba68 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysDictDataController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysDictDataController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysDictTypeController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysDictTypeController.class index eb5b810..08b29ab 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysDictTypeController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysDictTypeController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysNoticeController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysNoticeController.class index 5486117..ac7fd47 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysNoticeController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysNoticeController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysPostController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysPostController.class index 742c13b..2ae8a2f 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysPostController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysPostController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysRoleController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysRoleController.class index 73d0a8b..73a77be 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysRoleController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysRoleController.class differ diff --git a/sync-admin/target/classes/com/lyr/web/controller/system/SysUserController.class b/sync-admin/target/classes/com/lyr/web/controller/system/SysUserController.class index 90107f6..9c546cd 100644 Binary files a/sync-admin/target/classes/com/lyr/web/controller/system/SysUserController.class and b/sync-admin/target/classes/com/lyr/web/controller/system/SysUserController.class differ diff --git a/sync-common/pom.xml b/sync-common/pom.xml index 94607dd..a084544 100644 --- a/sync-common/pom.xml +++ b/sync-common/pom.xml @@ -35,11 +35,6 @@ spring-boot-starter-security - - - com.github.pagehelper - pagehelper-spring-boot-starter - diff --git a/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java b/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java index a4d6519..3decce2 100644 --- a/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java +++ b/sync-common/src/main/java/com/lyr/common/core/controller/BaseController.java @@ -1,18 +1,12 @@ package com.lyr.common.core.controller; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import com.lyr.common.constant.HttpStatus; import com.lyr.common.core.domain.AjaxResult; import com.lyr.common.core.domain.model.LoginUser; -import com.lyr.common.core.page.PageDomain; import com.lyr.common.core.page.TableDataInfo; -import com.lyr.common.core.page.TableSupport; import com.lyr.common.utils.DateUtils; -import com.lyr.common.utils.PageUtils; import com.lyr.common.utils.SecurityUtils; import com.lyr.common.utils.StringUtils; -import com.lyr.common.utils.sql.SqlUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.WebDataBinder; @@ -44,31 +38,6 @@ public class BaseController { }); } - /** - * 设置请求分页数据 - */ - protected void startPage() { - PageUtils.startPage(); - } - - /** - * 设置请求排序数据 - */ - protected void startOrderBy() { - PageDomain pageDomain = TableSupport.buildPageRequest(); - if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) { - String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); - PageHelper.orderBy(orderBy); - } - } - - /** - * 清理分页的线程变量 - */ - protected void clearPage() { - PageUtils.clearPage(); - } - /** * 响应请求分页数据 */ @@ -78,7 +47,7 @@ public class BaseController { rspData.setCode(HttpStatus.SUCCESS); rspData.setMsg("查询成功"); rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); + // rspData.setTotal(new Page(list).getTotal()); return rspData; } diff --git a/sync-common/src/main/java/com/lyr/common/utils/PageUtils.java b/sync-common/src/main/java/com/lyr/common/utils/PageUtils.java deleted file mode 100644 index 1d53d5a..0000000 --- a/sync-common/src/main/java/com/lyr/common/utils/PageUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.lyr.common.utils; - -import com.github.pagehelper.PageHelper; -import com.lyr.common.core.page.PageDomain; -import com.lyr.common.core.page.TableSupport; -import com.lyr.common.utils.sql.SqlUtil; - -/** - * 分页工具类 - * - * @author ruoyi - */ -public class PageUtils extends PageHelper { - /** - * 设置请求分页数据 - */ - public static void startPage() { - PageDomain pageDomain = TableSupport.buildPageRequest(); - Integer pageNum = pageDomain.getPageNum(); - Integer pageSize = pageDomain.getPageSize(); - String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); - Boolean reasonable = pageDomain.getReasonable(); - PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); - } - - /** - * 清理分页的线程变量 - */ - public static void clearPage() { - PageHelper.clearPage(); - } -} diff --git a/sync-common/target/classes/com/lyr/common/core/controller/BaseController$1.class b/sync-common/target/classes/com/lyr/common/core/controller/BaseController$1.class index c4350f8..264a2dc 100644 Binary files a/sync-common/target/classes/com/lyr/common/core/controller/BaseController$1.class and b/sync-common/target/classes/com/lyr/common/core/controller/BaseController$1.class differ diff --git a/sync-common/target/classes/com/lyr/common/core/controller/BaseController.class b/sync-common/target/classes/com/lyr/common/core/controller/BaseController.class index 68df8e1..839b1e7 100644 Binary files a/sync-common/target/classes/com/lyr/common/core/controller/BaseController.class and b/sync-common/target/classes/com/lyr/common/core/controller/BaseController.class differ diff --git a/sync-common/target/classes/com/lyr/common/core/redis/RedisCache.class b/sync-common/target/classes/com/lyr/common/core/redis/RedisCache.class index bdc2216..0192864 100644 Binary files a/sync-common/target/classes/com/lyr/common/core/redis/RedisCache.class and b/sync-common/target/classes/com/lyr/common/core/redis/RedisCache.class differ diff --git a/sync-common/target/classes/com/lyr/common/utils/PageUtils.class b/sync-common/target/classes/com/lyr/common/utils/PageUtils.class deleted file mode 100644 index c0f2d9a..0000000 Binary files a/sync-common/target/classes/com/lyr/common/utils/PageUtils.class and /dev/null differ diff --git a/sync-framework/pom.xml b/sync-framework/pom.xml index 19e8c9c..edf5d4b 100644 --- a/sync-framework/pom.xml +++ b/sync-framework/pom.xml @@ -35,6 +35,22 @@ druid-spring-boot-starter + + com.baomidou + mybatis-plus-boot-starter + + + + com.baomidou + mybatis-plus-extension + + + + com.microsoft.sqlserver + mssql-jdbc + 12.8.1.jre8 + + pro.fessional diff --git a/sync-framework/src/main/java/com/lyr/framework/config/DruidConfig.java b/sync-framework/src/main/java/com/lyr/framework/config/DruidConfig.java index 54009a0..46b4ca5 100644 --- a/sync-framework/src/main/java/com/lyr/framework/config/DruidConfig.java +++ b/sync-framework/src/main/java/com/lyr/framework/config/DruidConfig.java @@ -18,7 +18,6 @@ import org.springframework.context.annotation.Primary; import javax.servlet.*; import javax.sql.DataSource; import java.io.IOException; -import java.util.HashMap; import java.util.Map; /** @@ -46,10 +45,15 @@ public class DruidConfig { @Bean(name = "dynamicDataSource") @Primary public DynamicDataSource dataSource(DataSource masterDataSource) { - Map targetDataSources = new HashMap<>(); + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + dynamicDataSource.setDefaultTargetDataSource(masterDataSource); + dynamicDataSource.addTargetDataSource(DataSourceType.MASTER.name(), masterDataSource); + dynamicDataSource.addTargetDataSource(DataSourceType.SLAVE.name(), "slaveDataSource"); + return dynamicDataSource; + /* Map targetDataSources = new HashMap<>(); targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); - return new DynamicDataSource(masterDataSource, targetDataSources); + return new DynamicDataSource(masterDataSource, targetDataSources);*/ } /** @@ -87,8 +91,7 @@ public class DruidConfig { } @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); // 重置缓冲区,响应头不会被重置 response.resetBuffer(); @@ -109,4 +112,6 @@ public class DruidConfig { registrationBean.addUrlPatterns(commonJsPattern); return registrationBean; } + + } diff --git a/sync-framework/src/main/java/com/lyr/framework/config/MyBatisConfig.java b/sync-framework/src/main/java/com/lyr/framework/config/MyBatisConfig.java index 8c39c6d..a74847f 100644 --- a/sync-framework/src/main/java/com/lyr/framework/config/MyBatisConfig.java +++ b/sync-framework/src/main/java/com/lyr/framework/config/MyBatisConfig.java @@ -1,29 +1,10 @@ package com.lyr.framework.config; -import com.lyr.common.utils.StringUtils; -import org.apache.ibatis.io.VFS; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; -import org.springframework.beans.factory.annotation.Autowired; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.util.ClassUtils; - -import javax.sql.DataSource; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; +import org.springframework.transaction.annotation.EnableTransactionManagement; /** * Mybatis支持*匹配扫描包 @@ -31,79 +12,14 @@ import java.util.List; * @author ruoyi */ @Configuration +@EnableTransactionManagement(proxyTargetClass = true) public class MyBatisConfig { - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; - @Autowired - private Environment env; - public static String setTypeAliasesPackage(String typeAliasesPackage) { - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); - List allResult = new ArrayList(); - try { - for (String aliasesPackage : typeAliasesPackage.split(",")) { - List result = new ArrayList(); - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; - Resource[] resources = resolver.getResources(aliasesPackage); - if (resources != null && resources.length > 0) { - MetadataReader metadataReader = null; - for (Resource resource : resources) { - if (resource.isReadable()) { - metadataReader = metadataReaderFactory.getMetadataReader(resource); - try { - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - } - if (result.size() > 0) { - HashSet hashResult = new HashSet(result); - allResult.addAll(hashResult); - } - } - if (allResult.size() > 0) { - typeAliasesPackage = String.join(",", allResult.toArray(new String[0])); - } else { - throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); - } - } catch (IOException e) { - e.printStackTrace(); - } - return typeAliasesPackage; - } - - public Resource[] resolveMapperLocations(String[] mapperLocations) { - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); - List resources = new ArrayList(); - if (mapperLocations != null) { - for (String mapperLocation : mapperLocations) { - try { - Resource[] mappers = resourceResolver.getResources(mapperLocation); - resources.addAll(Arrays.asList(mappers)); - } catch (IOException e) { - // ignore - } - } - } - return resources.toArray(new Resource[resources.size()]); - } @Bean - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); - String mapperLocations = env.getProperty("mybatis.mapperLocations"); - String configLocation = env.getProperty("mybatis.configLocation"); - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); - VFS.addImplClass(SpringBootVFS.class); - - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); - return sessionFactory.getObject(); + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); + return interceptor; } } \ No newline at end of file diff --git a/sync-framework/src/main/java/com/lyr/framework/config/SecurityConfig.java b/sync-framework/src/main/java/com/lyr/framework/config/SecurityConfig.java index 8e54f30..ab8e7a4 100644 --- a/sync-framework/src/main/java/com/lyr/framework/config/SecurityConfig.java +++ b/sync-framework/src/main/java/com/lyr/framework/config/SecurityConfig.java @@ -112,6 +112,7 @@ public class SecurityConfig { // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers("/gather/*", "/gather/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); }) diff --git a/sync-framework/src/main/java/com/lyr/framework/datasource/DynamicDataSource.java b/sync-framework/src/main/java/com/lyr/framework/datasource/DynamicDataSource.java index 33f2e8a..f0f9e6f 100644 --- a/sync-framework/src/main/java/com/lyr/framework/datasource/DynamicDataSource.java +++ b/sync-framework/src/main/java/com/lyr/framework/datasource/DynamicDataSource.java @@ -1,9 +1,12 @@ package com.lyr.framework.datasource; +import com.alibaba.druid.pool.DruidDataSource; +import com.lyr.common.utils.spring.SpringUtils; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; import javax.sql.DataSource; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * 动态数据源 @@ -11,14 +14,52 @@ import java.util.Map; * @author ruoyi */ public class DynamicDataSource extends AbstractRoutingDataSource { + + private static Map targetDataSources = new ConcurrentHashMap<>(); + + @Override + protected Object determineCurrentLookupKey() { + return DynamicDataSourceContextHolder.getDataSourceType(); + } + + + public DynamicDataSource() { + super.setTargetDataSources(targetDataSources); + } + + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) { super.setDefaultTargetDataSource(defaultTargetDataSource); super.setTargetDataSources(targetDataSources); super.afterPropertiesSet(); } - @Override - protected Object determineCurrentLookupKey() { - return DynamicDataSourceContextHolder.getDataSourceType(); + public void addTargetDataSource(Object key, Object dataSource) { + if (dataSource instanceof String) { + try { + SpringUtils.getBean(dataSource.toString()); + this.targetDataSources.put(key, dataSource); + } catch (Exception e) { + } + } else { + this.targetDataSources.put(key, dataSource); + } + super.afterPropertiesSet(); // 重新初始化数据源 + } + + + public void removeTargetDataSource(Object key) { + this.targetDataSources.remove(key); + super.afterPropertiesSet(); // 重新初始化数据源 + } + + public void print() { + DruidDataSource resolvedDefaultDataSource = (DruidDataSource) getResolvedDefaultDataSource(); + System.out.println("主数据源:" + resolvedDefaultDataSource.getUrl()); + Map resolvedDataSources = getResolvedDataSources(); + for (Map.Entry entry : resolvedDataSources.entrySet()) { + DruidDataSource value = (DruidDataSource) entry.getValue(); + System.out.println("数据源[" + entry.getKey() + "]:" + value.getUrl()); + } } } \ No newline at end of file diff --git a/sync-framework/src/main/java/com/lyr/framework/manager/DataSourceManagerService.java b/sync-framework/src/main/java/com/lyr/framework/manager/DataSourceManagerService.java new file mode 100644 index 0000000..df1fe2a --- /dev/null +++ b/sync-framework/src/main/java/com/lyr/framework/manager/DataSourceManagerService.java @@ -0,0 +1,57 @@ +package com.lyr.framework.manager; + +import com.lyr.framework.datasource.DynamicDataSource; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.sql.DataSource; + +/** + * @author liyc + * @date 2024/10/30 + * @description TODO + **/ +@Component +public class DataSourceManagerService implements ApplicationContextAware { + + private ApplicationContext applicationContext; + @Resource + private DynamicDataSource dynamicDataSource; + + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + public void print() { + dynamicDataSource.print(); + } + + + public void registerDataSources(String beanName, DataSource dataSource) { + DataSource resolvedDefaultDataSource = dynamicDataSource.getResolvedDefaultDataSource(); + dynamicDataSource.setDefaultTargetDataSource(resolvedDefaultDataSource); + dynamicDataSource.addTargetDataSource(beanName, dataSource); + } + + public void add() { + /* // 构建数据源 + DruidDataSource dataSource = new DruidDataSource(); + dataSource.setUrl("jdbc:sqlserver://192.168.3.28:1433;DatabaseName=BiDataDeYue;encrypt=true;trustServerCertificate=true;"); + dataSource.setUsername("sa"); + dataSource.setPassword("mssql_whdZeB"); + dataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); + try { + DataSource resolvedDefaultDataSource = dynamicDataSource.getResolvedDefaultDataSource(); + dynamicDataSource.setDefaultTargetDataSource(resolvedDefaultDataSource); + dynamicDataSource.addTargetDataSource("deYueMssql", dataSource); + } catch (BeansException e) { + }*/ + } + + +} diff --git a/sync-framework/src/main/java/com/lyr/framework/web/service/SysLoginService.java b/sync-framework/src/main/java/com/lyr/framework/web/service/SysLoginService.java index fed18eb..778e749 100644 --- a/sync-framework/src/main/java/com/lyr/framework/web/service/SysLoginService.java +++ b/sync-framework/src/main/java/com/lyr/framework/web/service/SysLoginService.java @@ -13,6 +13,7 @@ import com.lyr.common.utils.MessageUtils; import com.lyr.common.utils.StringUtils; import com.lyr.common.utils.ip.IpUtils; import com.lyr.framework.manager.AsyncManager; +import com.lyr.framework.manager.DataSourceManagerService; import com.lyr.framework.manager.factory.AsyncFactory; import com.lyr.framework.security.context.AuthenticationContextHolder; import com.lyr.system.service.ISysConfigService; diff --git a/sync-framework/target/classes/com/lyr/framework/config/DruidConfig$1.class b/sync-framework/target/classes/com/lyr/framework/config/DruidConfig$1.class index b34799a..d55f4e9 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/config/DruidConfig$1.class and b/sync-framework/target/classes/com/lyr/framework/config/DruidConfig$1.class differ diff --git a/sync-framework/target/classes/com/lyr/framework/config/DruidConfig.class b/sync-framework/target/classes/com/lyr/framework/config/DruidConfig.class index 5235953..fed0116 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/config/DruidConfig.class and b/sync-framework/target/classes/com/lyr/framework/config/DruidConfig.class differ diff --git a/sync-framework/target/classes/com/lyr/framework/config/MyBatisConfig.class b/sync-framework/target/classes/com/lyr/framework/config/MyBatisConfig.class index 8f72026..bbee882 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/config/MyBatisConfig.class and b/sync-framework/target/classes/com/lyr/framework/config/MyBatisConfig.class differ diff --git a/sync-framework/target/classes/com/lyr/framework/config/SecurityConfig.class b/sync-framework/target/classes/com/lyr/framework/config/SecurityConfig.class index ef45f14..130c787 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/config/SecurityConfig.class and b/sync-framework/target/classes/com/lyr/framework/config/SecurityConfig.class differ diff --git a/sync-framework/target/classes/com/lyr/framework/datasource/DynamicDataSource.class b/sync-framework/target/classes/com/lyr/framework/datasource/DynamicDataSource.class index 836bba7..5261157 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/datasource/DynamicDataSource.class and b/sync-framework/target/classes/com/lyr/framework/datasource/DynamicDataSource.class differ diff --git a/sync-framework/target/classes/com/lyr/framework/web/service/SysLoginService.class b/sync-framework/target/classes/com/lyr/framework/web/service/SysLoginService.class index 19e6659..0a96c98 100644 Binary files a/sync-framework/target/classes/com/lyr/framework/web/service/SysLoginService.class and b/sync-framework/target/classes/com/lyr/framework/web/service/SysLoginService.class differ diff --git a/sync-gather/pom.xml b/sync-gather/pom.xml new file mode 100644 index 0000000..dabe325 --- /dev/null +++ b/sync-gather/pom.xml @@ -0,0 +1,40 @@ + + + + com.lyr + sync + 1.0.0 + + 4.0.0 + + sync-gather + + + 数据采集模块 + + + + + + + com.lyr + sync-common + + + + com.lyr + sync-framework + + + + org.projectlombok + lombok + provided + + + + + + \ No newline at end of file diff --git a/sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java b/sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java new file mode 100644 index 0000000..0ba0eb6 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/controller/DataSourceConfigController.java @@ -0,0 +1,34 @@ +package com.lyr.gather.controller; + +import com.lyr.gather.service.DataSourceConfigService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @author liyc + * @date 2024/10/30 + * @description TODO + **/ +@RestController +@RequestMapping("/gather") +public class DataSourceConfigController { + + + @Resource + private DataSourceConfigService dataSourceConfigService; + + + @GetMapping("/print") + public void print() { + dataSourceConfigService.print(); + } + + + @GetMapping("/add") + public void add() { + dataSourceConfigService.add(); + } +} diff --git a/sync-gather/src/main/java/com/lyr/gather/domain/vo/DataSourceConfig.java b/sync-gather/src/main/java/com/lyr/gather/domain/vo/DataSourceConfig.java new file mode 100644 index 0000000..c07c4fd --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/domain/vo/DataSourceConfig.java @@ -0,0 +1,68 @@ +package com.lyr.gather.domain.vo; + +import com.lyr.common.annotation.Excel; +import lombok.Data; + + +/** + * @author liyc + * @date 2024/10/30 + * @description TODO + **/ +@Data +public class DataSourceConfig { + + private static final long serialVersionUID = 1L; + + /** + * 主键,自动递增 + */ + private Long id; + + /** + * 数据源的唯一名称,用于标识不同的数据源 + */ + @Excel(name = "数据源的唯一名称,用于标识不同的数据源") + private String name; + + /** + * 数据库类型,例如 MySQL, PostgreSQL 等 + */ + @Excel(name = "数据库类型,例如 MySQL, PostgreSQL 等") + private String dbType; + + /** + * 数据库连接URL + */ + @Excel(name = "数据库连接URL") + private String url; + + /** + * 数据库用户名 + */ + @Excel(name = "数据库用户名") + private String username; + + /** + * 数据库密码 + */ + @Excel(name = "数据库密码") + private String password; + + /** + * 数据库驱动类名 + */ + @Excel(name = "数据库驱动类名") + private String driverClassName; + + @Excel(name = "bean名称") + private String beanName; + + /** + * 是否启用该数据源,1 表示启用,0 表示禁用 + */ + @Excel(name = "是否启用该数据源,1 表示启用,0 表示禁用") + private Integer isEnabled; + + +} diff --git a/sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java b/sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java new file mode 100644 index 0000000..2a3f286 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/mapper/DataSourceConfigMapper.java @@ -0,0 +1,7 @@ +package com.lyr.gather.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lyr.gather.domain.vo.DataSourceConfig; + +public interface DataSourceConfigMapper extends BaseMapper { +} diff --git a/sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java b/sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java new file mode 100644 index 0000000..1e48d39 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/service/DataSourceConfigService.java @@ -0,0 +1,11 @@ +package com.lyr.gather.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lyr.gather.domain.vo.DataSourceConfig; + +public interface DataSourceConfigService extends IService { + + void print(); + + void add(); +} diff --git a/sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java b/sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java new file mode 100644 index 0000000..e9cc276 --- /dev/null +++ b/sync-gather/src/main/java/com/lyr/gather/service/impl/DataSourceConfigServiceImpl.java @@ -0,0 +1,48 @@ +package com.lyr.gather.service.impl; + +import com.alibaba.druid.pool.DruidDataSource; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyr.framework.manager.DataSourceManagerService; +import com.lyr.gather.domain.vo.DataSourceConfig; +import com.lyr.gather.mapper.DataSourceConfigMapper; +import com.lyr.gather.service.DataSourceConfigService; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.List; + +@Service +public class DataSourceConfigServiceImpl extends ServiceImpl implements DataSourceConfigService { + + @Resource + private DataSourceManagerService dataSourceManagerService; + + @PostConstruct + private void registered() { + List configList = this.lambdaQuery().eq(DataSourceConfig::getIsEnabled, 1).list(); + configList.stream().forEach(e -> { + DruidDataSource dataSource = new DruidDataSource(); + dataSource.setDriverClassName(e.getDriverClassName()); + dataSource.setUrl(e.getUrl()); + dataSource.setUsername(e.getUsername()); + dataSource.setPassword(e.getPassword()); + dataSourceManagerService.registerDataSources(e.getBeanName(), dataSource); + }); + } + + @Override + public void print() { + dataSourceManagerService.print(); + } + + @Override + public void add() { + DruidDataSource dataSource = new DruidDataSource(); + dataSource.setUrl("jdbc:sqlserver://192.168.3.28:1433;DatabaseName=BiDataDeYue;encrypt=true;trustServerCertificate=true;"); + dataSource.setUsername("sa"); + dataSource.setPassword("mssql_whdZeB"); + dataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); + dataSourceManagerService.registerDataSources("biDataDeYue", dataSource); + } +} diff --git a/sync-generator/src/main/java/com/lyr/generator/controller/GenController.java b/sync-generator/src/main/java/com/lyr/generator/controller/GenController.java index b5a11e4..aa56180 100644 --- a/sync-generator/src/main/java/com/lyr/generator/controller/GenController.java +++ b/sync-generator/src/main/java/com/lyr/generator/controller/GenController.java @@ -49,7 +49,7 @@ public class GenController extends BaseController { @PreAuthorize("@ss.hasPermi('tool:gen:list')") @GetMapping("/list") public TableDataInfo genList(GenTable genTable) { - startPage(); + List list = genTableService.selectGenTableList(genTable); return getDataTable(list); } @@ -76,7 +76,7 @@ public class GenController extends BaseController { @PreAuthorize("@ss.hasPermi('tool:gen:list')") @GetMapping("/db/list") public TableDataInfo dataList(GenTable genTable) { - startPage(); + List list = genTableService.selectDbTableList(genTable); return getDataTable(list); } diff --git a/sync-generator/src/main/resources/vm/java/controller.java.vm b/sync-generator/src/main/resources/vm/java/controller.java.vm index f5d98a8..7d7a138 100644 --- a/sync-generator/src/main/resources/vm/java/controller.java.vm +++ b/sync-generator/src/main/resources/vm/java/controller.java.vm @@ -44,7 +44,7 @@ public class ${ClassName}Controller extends BaseController { @GetMapping("/list") #if($table.crud || $table.sub) public TableDataInfo list(${ClassName} ${className}) { - startPage(); + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); return getDataTable(list); } diff --git a/sync-generator/target/classes/com/lyr/generator/controller/GenController.class b/sync-generator/target/classes/com/lyr/generator/controller/GenController.class index 3b8a7e5..1f77943 100644 Binary files a/sync-generator/target/classes/com/lyr/generator/controller/GenController.class and b/sync-generator/target/classes/com/lyr/generator/controller/GenController.class differ diff --git a/sync-generator/target/classes/vm/java/controller.java.vm b/sync-generator/target/classes/vm/java/controller.java.vm index f5d98a8..7d7a138 100644 --- a/sync-generator/target/classes/vm/java/controller.java.vm +++ b/sync-generator/target/classes/vm/java/controller.java.vm @@ -44,7 +44,7 @@ public class ${ClassName}Controller extends BaseController { @GetMapping("/list") #if($table.crud || $table.sub) public TableDataInfo list(${ClassName} ${className}) { - startPage(); + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); return getDataTable(list); } diff --git a/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobController.java b/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobController.java index 3d6bfd5..8bb2683 100644 --- a/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobController.java +++ b/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobController.java @@ -38,7 +38,7 @@ public class SysJobController extends BaseController { @PreAuthorize("@ss.hasPermi('monitor:job:list')") @GetMapping("/list") public TableDataInfo list(SysJob sysJob) { - startPage(); + List list = jobService.selectJobList(sysJob); return getDataTable(list); } diff --git a/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobLogController.java b/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobLogController.java index a55153b..22be600 100644 --- a/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobLogController.java +++ b/sync-quartz/src/main/java/com/lyr/quartz/controller/SysJobLogController.java @@ -32,7 +32,7 @@ public class SysJobLogController extends BaseController { @PreAuthorize("@ss.hasPermi('monitor:job:list')") @GetMapping("/list") public TableDataInfo list(SysJobLog sysJobLog) { - startPage(); + List list = jobLogService.selectJobLogList(sysJobLog); return getDataTable(list); } diff --git a/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobController.class b/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobController.class index b20b09b..eb4c637 100644 Binary files a/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobController.class and b/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobController.class differ diff --git a/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobLogController.class b/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobLogController.class index 7b3f1d7..c576f29 100644 Binary files a/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobLogController.class and b/sync-quartz/target/classes/com/lyr/quartz/controller/SysJobLogController.class differ diff --git a/sync-system/pom.xml b/sync-system/pom.xml index 4594aa5..ced0814 100644 --- a/sync-system/pom.xml +++ b/sync-system/pom.xml @@ -23,6 +23,16 @@ sync-common + + org.projectlombok + lombok + provided + + + + com.baomidou + mybatis-plus-boot-starter + \ No newline at end of file diff --git a/sync-system/src/main/java/com/lyr/system/domain/SysCache.java b/sync-system/src/main/java/com/lyr/system/domain/SysCache.java index 1d1d450..a2a9bc7 100644 --- a/sync-system/src/main/java/com/lyr/system/domain/SysCache.java +++ b/sync-system/src/main/java/com/lyr/system/domain/SysCache.java @@ -1,5 +1,6 @@ package com.lyr.system.domain; + import com.lyr.common.utils.StringUtils; /** diff --git a/sync-system/src/main/java/com/lyr/system/mapper/SysDeptMapper.java b/sync-system/src/main/java/com/lyr/system/mapper/SysDeptMapper.java index fff8626..1065bab 100644 --- a/sync-system/src/main/java/com/lyr/system/mapper/SysDeptMapper.java +++ b/sync-system/src/main/java/com/lyr/system/mapper/SysDeptMapper.java @@ -1,5 +1,6 @@ package com.lyr.system.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.lyr.common.core.domain.entity.SysDept; import org.apache.ibatis.annotations.Param; @@ -10,7 +11,7 @@ import java.util.List; * * @author ruoyi */ -public interface SysDeptMapper { +public interface SysDeptMapper extends BaseMapper { /** * 查询部门管理数据 * diff --git a/sync-system/src/main/java/com/lyr/system/service/impl/SysDictDataServiceImpl.java b/sync-system/src/main/java/com/lyr/system/service/impl/SysDictDataServiceImpl.java index 5016ba6..b16c7c9 100644 --- a/sync-system/src/main/java/com/lyr/system/service/impl/SysDictDataServiceImpl.java +++ b/sync-system/src/main/java/com/lyr/system/service/impl/SysDictDataServiceImpl.java @@ -2,6 +2,7 @@ package com.lyr.system.service.impl; import com.lyr.common.core.domain.entity.SysDictData; import com.lyr.common.utils.DictUtils; +import com.lyr.common.utils.spring.SpringUtils; import com.lyr.system.mapper.SysDictDataMapper; import com.lyr.system.service.ISysDictDataService; import org.springframework.beans.factory.annotation.Autowired; diff --git a/sync-system/src/main/resources/mapper/system/SysDeptMapper.xml b/sync-system/src/main/resources/mapper/system/SysDeptMapper.xml index 0afc409..e68b16f 100644 --- a/sync-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/sync-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -23,8 +23,18 @@ - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, - d.del_flag, d.create_by, d.create_time + select d.dept_id, + d.parent_id, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.phone, + d.email, + d.status, + d.del_flag, + d.create_by, + d.create_time from sys_dept d @@ -61,27 +71,47 @@