Browse Source

基础架构

lixueqiang 2 years ago
parent
commit
a40457704f
100 changed files with 4461 additions and 5620 deletions
  1. 1 0
      .gitignore
  2. 2 2
      db/Dockerfile
  3. 0 423
      db/kxs_codegen.sql
  4. 4238 0
      db/kxs_sys.sql
  5. 0 91
      kxs-codegen/pom.xml
  6. 0 22
      kxs-codegen/src/main/java/com/kxs/codegen/biz/KxsCodeGenApplication.java
  7. 0 125
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenDsConfController.java
  8. 0 137
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenFieldTypeController.java
  9. 0 145
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenGroupController.java
  10. 0 176
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTableController.java
  11. 0 146
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTemplateController.java
  12. 0 131
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTemplateGroupController.java
  13. 0 104
      kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GeneratorController.java
  14. 0 84
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/ColumnEntity.java
  15. 0 69
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenConfig.java
  16. 0 114
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenDatasourceConf.java
  17. 0 103
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenFieldType.java
  18. 0 98
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenGroupEntity.java
  19. 0 172
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTable.java
  20. 0 155
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTableColumnEntity.java
  21. 0 109
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTemplateEntity.java
  22. 0 54
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTemplateGroupEntity.java
  23. 0 66
      kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/TableEntity.java
  24. 0 32
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenDatasourceConfMapper.java
  25. 0 39
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenDynamicMapper.java
  26. 0 44
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenFieldTypeMapper.java
  27. 0 37
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenGroupMapper.java
  28. 0 33
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTableColumnMapper.java
  29. 0 33
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTableMapper.java
  30. 0 33
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTemplateGroupMapper.java
  31. 0 42
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTemplateMapper.java
  32. 0 97
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GeneratorMapper.java
  33. 0 31
      kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GeneratorMysqlMapper.java
  34. 0 65
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenDatasourceConfService.java
  35. 0 41
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenFieldTypeService.java
  36. 0 53
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenGroupService.java
  37. 0 47
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTableColumnService.java
  38. 0 73
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTableService.java
  39. 0 31
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTemplateGroupService.java
  40. 0 31
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTemplateService.java
  41. 0 50
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GeneratorService.java
  42. 0 172
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenDatasourceConfServiceImpl.java
  43. 0 51
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenFieldTypeServiceImpl.java
  44. 0 116
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenGroupServiceImpl.java
  45. 0 88
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTableColumnServiceImpl.java
  46. 0 208
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTableServiceImpl.java
  47. 0 35
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTemplateGroupServiceImpl.java
  48. 0 35
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTemplateServiceImpl.java
  49. 0 253
      kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GeneratorServiceImpl.java
  50. 0 26
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/BoolFillEnum.java
  51. 0 62
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/CommonColumnFiledEnum.java
  52. 0 32
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/DictTool.java
  53. 0 75
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/GenKit.java
  54. 0 21
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/GeneratorTypeEnum.java
  55. 0 35
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/NamingCaseTool.java
  56. 0 69
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/VelocityKit.java
  57. 0 45
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/GroupVo.java
  58. 0 22
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/SqlDto.java
  59. 0 21
      kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/TemplateGroupDTO.java
  60. 0 51
      kxs-codegen/src/main/resources/application.yml
  61. 0 88
      kxs-codegen/src/main/resources/logback-spring.xml
  62. 0 41
      kxs-codegen/src/main/resources/mapper/GenFieldTypeMapper.xml
  63. 0 26
      kxs-codegen/src/main/resources/mapper/GenGroupMapper.xml
  64. 0 45
      kxs-codegen/src/main/resources/mapper/GenTableMapper.xml
  65. 0 10
      kxs-codegen/src/main/resources/mapper/GenTemplateGroupMapper.xml
  66. 0 22
      kxs-codegen/src/main/resources/mapper/GenTemplateMapper.xml
  67. 0 48
      kxs-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml
  68. 0 12
      kxs-codegen/src/main/resources/template/config.json
  69. 0 4
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/config/JacksonConfiguration.java
  70. 4 2
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/CommonConstants.java
  71. 38 0
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/enums/UserStatusEnum.java
  72. 1 2
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/exception/GlobalBizExceptionHandler.java
  73. 1 1
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/jackson/SkyJavaTimeModule.java
  74. 2 2
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/R.java
  75. 6 6
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/RetOps.java
  76. 5 6
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/SpringContextHolder.java
  77. 0 2
      kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/WebUtils.java
  78. 1 0
      kxs-common/kxs-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  79. 0 36
      kxs-common/kxs-common-datasource/pom.xml
  80. 0 91
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/DynamicDataSourceAutoConfiguration.java
  81. 0 21
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/annotation/EnableDynamicDataSource.java
  82. 0 30
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/ClearTtlDataSourceFilter.java
  83. 0 40
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/DataSourceProperties.java
  84. 0 85
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/JdbcDynamicDataSourceProvider.java
  85. 0 60
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/LastParamDsProcessor.java
  86. 0 30
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/enums/DsConfTypeEnum.java
  87. 0 72
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/enums/DsJdbcUrlEnum.java
  88. 0 57
      kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/support/DataSourceConstants.java
  89. 3 2
      kxs-common/kxs-common-log/src/main/java/com/kxs/common/log/aspect/SysLogAspect.java
  90. 3 3
      kxs-common/kxs-common-log/src/main/java/com/kxs/common/log/event/SysLogListener.java
  91. 0 1
      kxs-common/kxs-common-log/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  92. 4 0
      kxs-common/kxs-common-security/pom.xml
  93. 1 1
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/ResourceAuthExceptionEntryPoint.java
  94. 3 3
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/SkyCustomOpaqueTokenIntrospector.java
  95. 2 1
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/SkySecurityInnerAspect.java
  96. 74 0
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/model/KxsSecurityUser.java
  97. 66 0
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsAppUserServiceImpl.java
  98. 0 2
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsUserDetailsService.java
  99. 5 12
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsUserDetailsServiceImpl.java
  100. 1 1
      kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java

+ 1 - 0
.gitignore

@@ -12,6 +12,7 @@
 .settings
 .springBeans
 bin/
+db/
 data/
 target/
 

+ 2 - 2
db/Dockerfile

@@ -4,8 +4,8 @@ ENV TZ=Asia/Shanghai
 
 RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
-COPY ./kxs.sql /docker-entrypoint-initdb.d
+COPY kxs_sys.sql /docker-entrypoint-initdb.d
 
-COPY ./kxs_codegen.sql /docker-entrypoint-initdb.d
+COPY ./kxs_config.sql /docker-entrypoint-initdb.d
 
 COPY ./kxs_job.sql /docker-entrypoint-initdb.d

File diff suppressed because it is too large
+ 0 - 423
db/kxs_codegen.sql


File diff suppressed because it is too large
+ 4238 - 0
db/kxs_sys.sql


+ 0 - 91
kxs-codegen/pom.xml

@@ -1,91 +0,0 @@
-<?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">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>com.kxs</groupId>
-		<artifactId>kxs</artifactId>
-		<version>1.1.0</version>
-	</parent>
-
-	<artifactId>kxs-codegen</artifactId>
-	<packaging>jar</packaging>
-
-	<description>代码生成模块</description>
-	<properties>
-		<configuration.version>1.10</configuration.version>
-		<velocity.version>2.3</velocity.version>
-		<velocity.tool.version>3.1</velocity.tool.version>
-		<screw.version>0.0.3</screw.version>
-		<jasypt.version>3.0.5</jasypt.version>
-	</properties>
-	<dependencies>
-		<dependency>
-			<groupId>com.baomidou</groupId>
-			<artifactId>mybatis-plus-boot-starter</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.mysql</groupId>
-			<artifactId>mysql-connector-j</artifactId>
-		</dependency>
-		<!--common-->
-		<dependency>
-			<groupId>cn.hutool</groupId>
-			<artifactId>hutool-json</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.kxs</groupId>
-			<artifactId>kxs-common-core</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>commons-configuration</groupId>
-			<artifactId>commons-configuration</artifactId>
-			<version>${configuration.version}</version>
-		</dependency>
-		<!--日志处理-->
-		<dependency>
-			<groupId>com.kxs</groupId>
-			<artifactId>kxs-common-log</artifactId>
-		</dependency>
-		<!--安全模块-->
-		<dependency>
-			<groupId>com.kxs</groupId>
-			<artifactId>kxs-common-security</artifactId>
-		</dependency>
-		<!--代码生成模板引擎-->
-		<dependency>
-			<groupId>org.apache.velocity</groupId>
-			<artifactId>velocity-engine-core</artifactId>
-			<version>${velocity.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.velocity.tools</groupId>
-			<artifactId>velocity-tools-generic</artifactId>
-			<version>${velocity.tool.version}</version>
-		</dependency>
-		<!--生成文档-->
-		<dependency>
-			<groupId>io.springboot.plugin</groupId>
-			<artifactId>screw-spring-boot-starter</artifactId>
-			<version>${screw.version}</version>
-		</dependency>
-		<!--undertow容器-->
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-undertow</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.kxs</groupId>
-			<artifactId>kxs-common-datasource</artifactId>
-		</dependency>
-		<!--配置文件加解密-->
-		<dependency>
-			<groupId>com.github.ulisesbocchio</groupId>
-			<artifactId>jasypt-spring-boot-starter</artifactId>
-			<version>${jasypt.version}</version>
-		</dependency>
-
-	</dependencies>
-
-</project>

+ 0 - 22
kxs-codegen/src/main/java/com/kxs/codegen/biz/KxsCodeGenApplication.java

@@ -1,22 +0,0 @@
-
-package com.kxs.codegen.biz;
-
-import com.kxs.common.datasource.annotation.EnableDynamicDataSource;
-import com.kxs.common.security.annotation.EnableAuthResourceServer;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * @author LXQ
- * @date 2021/07/29 代码生成模块
- */
-@EnableDynamicDataSource
-@EnableAuthResourceServer
-@SpringBootApplication
-public class KxsCodeGenApplication {
-
-	public static void main(String[] args) {
-		SpringApplication.run(KxsCodeGenApplication.class, args);
-	}
-
-}

+ 0 - 125
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenDsConfController.java

@@ -1,125 +0,0 @@
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.ContentType;
-import cn.smallbun.screw.boot.config.Screw;
-import cn.smallbun.screw.boot.properties.ScrewProperties;
-import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenDatasourceConf;
-import com.kxs.codegen.biz.service.GenDatasourceConfService;
-import com.kxs.common.core.util.R;
-import com.kxs.common.core.util.SpringContextHolder;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.*;
-
-import javax.sql.DataSource;
-
-/**
- * 数据源管理
- *
- * @author LXQ
- * @date 2021-03-31 16:00:20
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/dsconf")
-public class GenDsConfController {
-
-	private final GenDatasourceConfService datasourceConfService;
-
-	private final Screw screw;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param datasourceConf 数据源表
-	 * @return
-	 */
-	@GetMapping("/page")
-	public R getSysDatasourceConfPage(Page page, GenDatasourceConf datasourceConf) {
-		return R.ok(datasourceConfService.page(page,
-				Wrappers.<GenDatasourceConf>lambdaQuery()
-					.like(StrUtil.isNotBlank(datasourceConf.getDsName()), GenDatasourceConf::getDsName,
-							datasourceConf.getDsName())));
-	}
-
-	/**
-	 * 查询全部数据源
-	 * @return
-	 */
-	@GetMapping("/list")
-	public R list() {
-		return R.ok(datasourceConfService.list());
-	}
-
-	/**
-	 * 通过id查询数据源表
-	 * @param id id
-	 * @return R
-	 */
-	@GetMapping("/{id}")
-	public R getById(@PathVariable("id") Long id) {
-		return R.ok(datasourceConfService.getById(id));
-	}
-
-	/**
-	 * 新增数据源表
-	 * @param datasourceConf 数据源表
-	 * @return R
-	 */
-	@PostMapping
-	public R save(@RequestBody GenDatasourceConf datasourceConf) {
-		return R.ok(datasourceConfService.saveDsByEnc(datasourceConf));
-	}
-
-	/**
-	 * 修改数据源表
-	 * @param conf 数据源表
-	 * @return R
-	 */
-	@PutMapping
-	public R updateById(@RequestBody GenDatasourceConf conf) {
-		return R.ok(datasourceConfService.updateDsByEnc(conf));
-	}
-
-	/**
-	 * 通过id删除数据源表
-	 * @param ids id
-	 * @return R
-	 */
-	@DeleteMapping
-	public R removeById(@RequestBody Long[] ids) {
-		return R.ok(datasourceConfService.removeByDsId(ids));
-	}
-
-	/**
-	 * 查询数据源对应的文档
-	 * @param dsName 数据源名称
-	 */
-	@SneakyThrows
-	@GetMapping("/doc")
-	public void generatorDoc(String dsName, HttpServletResponse response) {
-		// 设置指定的数据源
-		DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
-		DynamicDataSourceContextHolder.push(dsName);
-		DataSource dataSource = dynamicRoutingDataSource.determineDataSource();
-
-		// 设置指定的目标表
-		ScrewProperties screwProperties = SpringContextHolder.getBean(ScrewProperties.class);
-
-		// 生成
-		byte[] data = screw.documentGeneration(dataSource, screwProperties).toByteArray();
-		response.reset();
-		response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length));
-		response.setContentType(ContentType.OCTET_STREAM.getValue());
-		IoUtil.write(response.getOutputStream(), Boolean.TRUE, data);
-	}
-
-}

+ 0 - 137
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenFieldTypeController.java

@@ -1,137 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenFieldType;
-import com.kxs.codegen.biz.service.GenFieldTypeService;
-import com.kxs.common.core.util.R;
-import com.kxs.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/fieldtype")
-@Tag(description = "fieldtype", name = "列属性管理")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class GenFieldTypeController {
-
-	private final GenFieldTypeService fieldTypeService;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param fieldType 列属性
-	 * @return
-	 */
-	@Operation(summary = "分页查询", description = "分页查询")
-	@GetMapping("/page")
-	public R getFieldTypePage(Page page, GenFieldType fieldType) {
-		return R.ok(fieldTypeService.page(page,
-				Wrappers.<GenFieldType>lambdaQuery()
-					.like(StrUtil.isNotBlank(fieldType.getColumnType()), GenFieldType::getColumnType,
-							fieldType.getColumnType())));
-	}
-
-	@Operation(summary = "查询列表", description = "查询列表")
-	@GetMapping("/list")
-	public R list(GenFieldType fieldType) {
-		return R.ok(fieldTypeService.list(Wrappers.query(fieldType)));
-	}
-
-	/**
-	 * 通过id查询列属性
-	 * @param id id
-	 * @return R
-	 */
-	@Operation(summary = "通过id查询", description = "通过id查询")
-	@GetMapping("/details/{id}")
-	public R getById(@PathVariable("id") Long id) {
-		return R.ok(fieldTypeService.getById(id));
-	}
-
-	@GetMapping("/details")
-	public R getDetails(GenFieldType query) {
-		return R.ok(fieldTypeService.getOne(Wrappers.query(query), false));
-	}
-
-	/**
-	 * 新增列属性
-	 * @param fieldType 列属性
-	 * @return R
-	 */
-	@Operation(summary = "新增列属性", description = "新增列属性")
-	@SysLog("新增列属性")
-	@PostMapping
-	public R save(@RequestBody GenFieldType fieldType) {
-		return R.ok(fieldTypeService.save(fieldType));
-	}
-
-	/**
-	 * 修改列属性
-	 * @param fieldType 列属性
-	 * @return R
-	 */
-	@Operation(summary = "修改列属性", description = "修改列属性")
-	@SysLog("修改列属性")
-	@PutMapping
-	public R updateById(@RequestBody GenFieldType fieldType) {
-		return R.ok(fieldTypeService.updateById(fieldType));
-	}
-
-	/**
-	 * 通过id删除列属性
-	 * @param ids id
-	 * @return R
-	 */
-	@Operation(summary = "通过id删除列属性", description = "通过id删除列属性")
-	@SysLog("通过id删除列属性")
-	@DeleteMapping
-	public R removeById(@RequestBody Long[] ids) {
-		return R.ok(fieldTypeService.removeBatchByIds(CollUtil.toList(ids)));
-	}
-
-	/**
-	 * 导出excel 表格
-	 * @param fieldType 查询条件
-	 * @return excel 文件流
-	 */
-	@ResponseExcel
-	@GetMapping("/export")
-	public List<GenFieldType> export(GenFieldType fieldType) {
-		return fieldTypeService.list(Wrappers.query(fieldType));
-	}
-
-}

+ 0 - 145
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenGroupController.java

@@ -1,145 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import com.kxs.codegen.biz.service.GenGroupService;
-import com.kxs.codegen.biz.util.vo.GroupVo;
-import com.kxs.codegen.biz.util.vo.TemplateGroupDTO;
-import com.kxs.common.core.util.R;
-import com.kxs.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 模板分组
- *
- * @author PIG
- * @date 2023-02-21 20:01:53
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/group")
-@Tag(description = "group", name = "模板分组管理")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class GenGroupController {
-
-	private final GenGroupService genGroupService;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param genGroup 模板分组
-	 * @return
-	 */
-	@Operation(summary = "分页查询", description = "分页查询")
-	@GetMapping("/page")
-	@PreAuthorize("@pms.hasPermission('codegen_group_view')")
-	public R getgenGroupPage(Page page, GenGroupEntity genGroup) {
-		LambdaQueryWrapper<GenGroupEntity> wrapper = Wrappers.<GenGroupEntity>lambdaQuery()
-			.like(genGroup.getId() != null, GenGroupEntity::getId, genGroup.getId())
-			.like(StrUtil.isNotEmpty(genGroup.getGroupName()), GenGroupEntity::getGroupName, genGroup.getGroupName());
-		return R.ok(genGroupService.page(page, wrapper));
-	}
-
-	/**
-	 * 通过id查询模板分组
-	 * @param id id
-	 * @return R
-	 */
-	@Operation(summary = "通过id查询", description = "通过id查询")
-	@GetMapping("/{id}")
-	@PreAuthorize("@pms.hasPermission('codegen_group_view')")
-	public R getById(@PathVariable("id") Long id) {
-		return R.ok(genGroupService.getGroupVoById(id));
-	}
-
-	/**
-	 * 新增模板分组
-	 * @param genTemplateGroup 模板分组
-	 * @return R
-	 */
-	@Operation(summary = "新增模板分组", description = "新增模板分组")
-	@SysLog("新增模板分组")
-	@PostMapping
-	@PreAuthorize("@pms.hasPermission('codegen_group_add')")
-	public R save(@RequestBody TemplateGroupDTO genTemplateGroup) {
-		genGroupService.saveGenGroup(genTemplateGroup);
-		return R.ok();
-	}
-
-	/**
-	 * 修改模板分组
-	 * @param groupVo 模板分组
-	 * @return R
-	 */
-	@Operation(summary = "修改模板分组", description = "修改模板分组")
-	@SysLog("修改模板分组")
-	@PutMapping
-	@PreAuthorize("@pms.hasPermission('codegen_group_edit')")
-	public R updateById(@RequestBody GroupVo groupVo) {
-		genGroupService.updateGroupAndTemplateById(groupVo);
-		return R.ok();
-	}
-
-	/**
-	 * 通过id删除模板分组
-	 * @param ids id列表
-	 * @return R
-	 */
-	@Operation(summary = "通过id删除模板分组", description = "通过id删除模板分组")
-	@SysLog("通过id删除模板分组")
-	@DeleteMapping
-	@PreAuthorize("@pms.hasPermission('codegen_group_del')")
-	public R removeById(@RequestBody Long[] ids) {
-		genGroupService.delGroupAndTemplate(ids);
-		return R.ok();
-	}
-
-	/**
-	 * 导出excel 表格
-	 * @param genGroup 查询条件
-	 * @return excel 文件流
-	 */
-	@ResponseExcel
-	@GetMapping("/export")
-	@PreAuthorize("@pms.hasPermission('codegen_group_export')")
-	public List<GenGroupEntity> export(GenGroupEntity genGroup) {
-		return genGroupService.list(Wrappers.query(genGroup));
-	}
-
-	@GetMapping("/list")
-	@Operation(summary = "查询列表", description = "查询列表")
-	public R list() {
-		List<GenGroupEntity> list = genGroupService.list();
-		return R.ok(list);
-	}
-
-}

+ 0 - 176
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTableController.java

@@ -1,176 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenTable;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-import com.kxs.codegen.biz.service.GenTableColumnService;
-import com.kxs.codegen.biz.service.GenTableService;
-import com.kxs.common.core.util.R;
-import com.kxs.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:34:55
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/table")
-@Tag(description = "table", name = "列属性管理")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class GenTableController {
-
-	private final GenTableColumnService tableColumnService;
-
-	private final GenTableService tableService;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param table 列属性
-	 * @return
-	 */
-	@Operation(summary = "分页查询", description = "分页查询")
-	@GetMapping("/page")
-	public R getTablePage(Page page, GenTable table) {
-
-		return R.ok(tableService.list(page, table));
-	}
-
-	/**
-	 * 通过id查询列属性
-	 * @param id id
-	 * @return R
-	 */
-	@Operation(summary = "通过id查询", description = "通过id查询")
-	@GetMapping("/{id}")
-	public R getById(@PathVariable("id") Long id) {
-		return R.ok(tableService.getById(id));
-	}
-
-	/**
-	 * 新增列属性
-	 * @param table 列属性
-	 * @return R
-	 */
-	@Operation(summary = "新增列属性", description = "新增列属性")
-	@SysLog("新增列属性")
-	@PostMapping
-	public R save(@RequestBody GenTable table) {
-		return R.ok(tableService.save(table));
-	}
-
-	/**
-	 * 修改列属性
-	 * @param table 列属性
-	 * @return R
-	 */
-	@Operation(summary = "修改列属性", description = "修改列属性")
-	@SysLog("修改列属性")
-	@PutMapping
-	public R updateById(@RequestBody GenTable table) {
-		return R.ok(tableService.updateById(table));
-	}
-
-	/**
-	 * 通过id删除列属性
-	 * @param id id
-	 * @return R
-	 */
-	@Operation(summary = "通过id删除列属性", description = "通过id删除列属性")
-	@SysLog("通过id删除列属性")
-	@DeleteMapping("/{id}")
-	public R removeById(@PathVariable Long id) {
-		return R.ok(tableService.removeById(id));
-	}
-
-	/**
-	 * 导出excel 表格
-	 * @param table 查询条件
-	 * @return excel 文件流
-	 */
-	@ResponseExcel
-	@GetMapping("/export")
-	public List<GenTable> export(GenTable table) {
-		return tableService.list(Wrappers.query(table));
-	}
-
-	@GetMapping("/list/{dsName}")
-	public R listTable(@PathVariable("dsName") String dsName) {
-		return R.ok(tableService.queryDsAllTable(dsName));
-	}
-
-	@GetMapping("/column/{dsName}/{tableName}")
-	public R column(@PathVariable("dsName") String dsName, @PathVariable String tableName) {
-		return R.ok(tableService.queryColumn(dsName, tableName));
-	}
-
-	/**
-	 * 获取表信息
-	 * @param dsName 数据源
-	 * @param tableName 表名称
-	 */
-	@GetMapping("/{dsName}/{tableName}")
-	public R<GenTable> info(@PathVariable("dsName") String dsName, @PathVariable String tableName) {
-		return R.ok(tableService.queryOrBuildTable(dsName, tableName));
-	}
-
-	/**
-	 * 同步表信息
-	 * @param dsName 数据源
-	 * @param tableName 表名称
-	 */
-	@GetMapping("/sync/{dsName}/{tableName}")
-	public R<GenTable> sync(@PathVariable("dsName") String dsName, @PathVariable String tableName) {
-		// 表配置删除
-		tableService.remove(
-				Wrappers.<GenTable>lambdaQuery().eq(GenTable::getDsName, dsName).eq(GenTable::getTableName, tableName));
-		// 字段配置删除
-		tableColumnService.remove(Wrappers.<GenTableColumnEntity>lambdaQuery()
-			.eq(GenTableColumnEntity::getDsName, dsName)
-			.eq(GenTableColumnEntity::getTableName, tableName));
-		return R.ok(tableService.queryOrBuildTable(dsName, tableName));
-	}
-
-	/**
-	 * 修改表字段数据
-	 * @param dsName 数据源
-	 * @param tableName 表名称
-	 * @param tableFieldList 字段列表
-	 */
-	@PutMapping("/field/{dsName}/{tableName}")
-	public R<String> updateTableField(@PathVariable("dsName") String dsName, @PathVariable String tableName,
-			@RequestBody List<GenTableColumnEntity> tableFieldList) {
-		tableColumnService.updateTableField(dsName, tableName, tableFieldList);
-		return R.ok();
-	}
-
-}

+ 0 - 146
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTemplateController.java

@@ -1,146 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-import com.kxs.codegen.biz.service.GenTemplateService;
-import com.kxs.common.core.util.R;
-import com.kxs.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 模板
- *
- * @author PIG
- * @date 2023-02-21 17:15:44
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/template")
-@Tag(description = "template", name = "模板管理")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class GenTemplateController {
-
-	private final GenTemplateService genTemplateService;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param genTemplate 模板
-	 * @return
-	 */
-	@Operation(summary = "分页查询", description = "分页查询")
-	@GetMapping("/page")
-	@PreAuthorize("@pms.hasPermission('codegen_template_view')")
-	public R getgenTemplatePage(Page page, GenTemplateEntity genTemplate) {
-		LambdaQueryWrapper<GenTemplateEntity> wrapper = Wrappers.<GenTemplateEntity>lambdaQuery()
-			.like(genTemplate.getId() != null, GenTemplateEntity::getId, genTemplate.getId())
-			.like(StrUtil.isNotEmpty(genTemplate.getTemplateName()), GenTemplateEntity::getTemplateName,
-					genTemplate.getTemplateName());
-		return R.ok(genTemplateService.page(page, wrapper));
-	}
-
-	/**
-	 * 查询全部模板
-	 * @return
-	 */
-	@Operation(summary = "查询全部", description = "查询全部")
-	@GetMapping("/list")
-	@PreAuthorize("@pms.hasPermission('codegen_template_view')")
-	public R list() {
-		return R.ok(genTemplateService.list(Wrappers.emptyWrapper()));
-	}
-
-	/**
-	 * 通过id查询模板
-	 * @param id id
-	 * @return R
-	 */
-	@Operation(summary = "通过id查询", description = "通过id查询")
-	@GetMapping("/{id}")
-	@PreAuthorize("@pms.hasPermission('codegen_template_view')")
-	public R getById(@PathVariable("id") Long id) {
-		return R.ok(genTemplateService.getById(id));
-	}
-
-	/**
-	 * 新增模板
-	 * @param genTemplate 模板
-	 * @return R
-	 */
-	@Operation(summary = "新增模板", description = "新增模板")
-	@SysLog("新增模板")
-	@PostMapping
-	@PreAuthorize("@pms.hasPermission('codegen_template_add')")
-	public R save(@RequestBody GenTemplateEntity genTemplate) {
-		return R.ok(genTemplateService.save(genTemplate));
-	}
-
-	/**
-	 * 修改模板
-	 * @param genTemplate 模板
-	 * @return R
-	 */
-	@Operation(summary = "修改模板", description = "修改模板")
-	@SysLog("修改模板")
-	@PutMapping
-	@PreAuthorize("@pms.hasPermission('codegen_template_edit')")
-	public R updateById(@RequestBody GenTemplateEntity genTemplate) {
-		return R.ok(genTemplateService.updateById(genTemplate));
-	}
-
-	/**
-	 * 通过id删除模板
-	 * @param ids id列表
-	 * @return R
-	 */
-	@Operation(summary = "通过id删除模板", description = "通过id删除模板")
-	@SysLog("通过id删除模板")
-	@DeleteMapping
-	@PreAuthorize("@pms.hasPermission('codegen_template_del')")
-	public R removeById(@RequestBody Long[] ids) {
-		return R.ok(genTemplateService.removeBatchByIds(CollUtil.toList(ids)));
-	}
-
-	/**
-	 * 导出excel 表格
-	 * @param genTemplate 查询条件
-	 * @return excel 文件流
-	 */
-	@ResponseExcel
-	@GetMapping("/export")
-	@PreAuthorize("@pms.hasPermission('codegen_template_export')")
-	public List<GenTemplateEntity> export(GenTemplateEntity genTemplate) {
-		return genTemplateService.list(Wrappers.query(genTemplate));
-	}
-
-}

+ 0 - 131
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GenTemplateGroupController.java

@@ -1,131 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.GenTemplateGroupEntity;
-import com.kxs.codegen.biz.service.GenTemplateGroupService;
-import com.kxs.common.core.util.R;
-import com.kxs.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 模板分组关联表
- *
- * @author PIG
- * @date 2023-02-22 09:25:15
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/templateGroup")
-@Tag(description = "templateGroup", name = "模板分组关联表管理")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class GenTemplateGroupController {
-
-	private final GenTemplateGroupService genTemplateGroupService;
-
-	/**
-	 * 分页查询
-	 * @param page 分页对象
-	 * @param genTemplateGroup 模板分组关联表
-	 * @return
-	 */
-	@Operation(summary = "分页查询", description = "分页查询")
-	@GetMapping("/page")
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_view')")
-	public R getgenTemplateGroupPage(Page page, GenTemplateGroupEntity genTemplateGroup) {
-		LambdaQueryWrapper<GenTemplateGroupEntity> wrapper = Wrappers.lambdaQuery();
-		return R.ok(genTemplateGroupService.page(page, wrapper));
-	}
-
-	/**
-	 * 通过id查询模板分组关联表
-	 * @param groupId id
-	 * @return R
-	 */
-	@Operation(summary = "通过id查询", description = "通过id查询")
-	@GetMapping("/{groupId}")
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_view')")
-	public R getById(@PathVariable("groupId") Long groupId) {
-		return R.ok(genTemplateGroupService.getById(groupId));
-	}
-
-	/**
-	 * 新增模板分组关联表
-	 * @param genTemplateGroup 模板分组关联表
-	 * @return R
-	 */
-	@Operation(summary = "新增模板分组关联表", description = "新增模板分组关联表")
-	@SysLog("新增模板分组关联表")
-	@PostMapping
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_add')")
-	public R save(@RequestBody GenTemplateGroupEntity genTemplateGroup) {
-		return R.ok(genTemplateGroupService.save(genTemplateGroup));
-	}
-
-	/**
-	 * 修改模板分组关联表
-	 * @param genTemplateGroup 模板分组关联表
-	 * @return R
-	 */
-	@Operation(summary = "修改模板分组关联表", description = "修改模板分组关联表")
-	@SysLog("修改模板分组关联表")
-	@PutMapping
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_edit')")
-	public R updateById(@RequestBody GenTemplateGroupEntity genTemplateGroup) {
-		return R.ok(genTemplateGroupService.updateById(genTemplateGroup));
-	}
-
-	/**
-	 * 通过id删除模板分组关联表
-	 * @param ids groupId列表
-	 * @return R
-	 */
-	@Operation(summary = "通过id删除模板分组关联表", description = "通过id删除模板分组关联表")
-	@SysLog("通过id删除模板分组关联表")
-	@DeleteMapping
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_del')")
-	public R removeById(@RequestBody Long[] ids) {
-		return R.ok(genTemplateGroupService.removeBatchByIds(CollUtil.toList(ids)));
-	}
-
-	/**
-	 * 导出excel 表格
-	 * @param genTemplateGroup 查询条件
-	 * @return excel 文件流
-	 */
-	@ResponseExcel
-	@GetMapping("/export")
-	@PreAuthorize("@pms.hasPermission('codegen_templateGroup_export')")
-	public List<GenTemplateGroupEntity> export(GenTemplateGroupEntity genTemplateGroup) {
-		return genTemplateGroupService.list(Wrappers.query(genTemplateGroup));
-	}
-
-}

+ 0 - 104
kxs-codegen/src/main/java/com/kxs/codegen/biz/controller/GeneratorController.java

@@ -1,104 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.controller;
-
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.StrUtil;
-import com.kxs.codegen.biz.service.GeneratorService;
-import com.kxs.common.core.util.R;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.io.ByteArrayOutputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipOutputStream;
-
-/**
- * 代码生成器
- *
- * @author LXQ
- * @date 2021-07-30
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/generator")
-public class GeneratorController {
-
-	private final GeneratorService generatorService;
-
-	/**
-	 * ZIP 下载生成代码
-	 * @param tableIds 数据表ID
-	 * @param response 流输出对象
-	 */
-	@SneakyThrows
-	@GetMapping("/download")
-	public void download(String tableIds, HttpServletResponse response) {
-		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-		ZipOutputStream zip = new ZipOutputStream(outputStream);
-
-		// 生成代码
-		for (String tableId : tableIds.split(StrUtil.COMMA)) {
-			generatorService.downloadCode(Long.parseLong(tableId), zip);
-		}
-
-		IoUtil.close(zip);
-
-		// zip压缩包数据
-		byte[] data = outputStream.toByteArray();
-
-		response.reset();
-		response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s.zip", tableIds));
-		response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length));
-		response.setContentType("application/octet-stream; charset=UTF-8");
-		IoUtil.write(response.getOutputStream(), false, data);
-	}
-
-	/**
-	 * 目标目录生成代码
-	 */
-	@ResponseBody
-	@GetMapping("/code")
-	public R<String> code(String tableIds) throws Exception {
-		// 生成代码
-		for (String tableId : tableIds.split(StrUtil.COMMA)) {
-			generatorService.generatorCode(Long.valueOf(tableId));
-		}
-
-		return R.ok();
-	}
-
-	/**
-	 * 预览代码
-	 * @param tableId 表ID
-	 * @return
-	 */
-	@SneakyThrows
-	@GetMapping("/preview")
-	public List<Map<String, String>> preview(Long tableId) {
-		return generatorService.preview(tableId);
-	}
-
-}

+ 0 - 84
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/ColumnEntity.java

@@ -1,84 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import lombok.Data;
-
-/**
- * @author LXQ
- * @date 2021/07/29 列属性: https://blog.csdn.net/lkforce/article/details/79557482
- */
-@Data
-public class ColumnEntity {
-
-	/**
-	 * 列表
-	 */
-	private String columnName;
-
-	/**
-	 * 数据类型
-	 */
-	private String dataType;
-
-	/**
-	 * JAVA 数据类型
-	 */
-	private String javaType;
-
-	/**
-	 * 备注
-	 */
-	private String comments;
-
-	/**
-	 * 驼峰属性
-	 */
-	private String caseAttrName;
-
-	/**
-	 * 普通属性
-	 */
-	private String lowerAttrName;
-
-	/**
-	 * 属性类型
-	 */
-	private String attrType;
-
-	/**
-	 * 其他信息
-	 */
-	private String extra;
-
-	/**
-	 * 字段类型
-	 */
-	private String columnType;
-
-	/**
-	 * 是否可以为空
-	 */
-	private Boolean nullable;
-
-	/**
-	 * 是否隐藏
-	 */
-	private Boolean hidden;
-
-}

+ 0 - 69
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenConfig.java

@@ -1,69 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import lombok.Data;
-
-/**
- * @author LXQ
- * @date 2021/8/2 生成配置
- */
-@Data
-public class GenConfig {
-
-	/**
-	 * 数据源name
-	 */
-	private String dsName;
-
-	/**
-	 * 包名
-	 */
-	private String packageName;
-
-	/**
-	 * 作者
-	 */
-	private String author;
-
-	/**
-	 * 模块名称
-	 */
-	private String moduleName;
-
-	/**
-	 * 表前缀
-	 */
-	private String tablePrefix;
-
-	/**
-	 * 表名称
-	 */
-	private String tableName;
-
-	/**
-	 * 表备注
-	 */
-	private String comments;
-
-	/**
-	 * 代码风格 0 - avue 1 - element 2 - uview
-	 */
-	private String style;
-
-}

+ 0 - 114
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenDatasourceConf.java

@@ -1,114 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-
-/**
- * 数据源表
- *
- * @author LXQ
- * @date 2021-03-31 16:00:20
- */
-@Data
-@TableName("gen_datasource_conf")
-@EqualsAndHashCode(callSuper = true)
-public class GenDatasourceConf extends Model<GenDatasourceConf> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * 主键
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	private Long id;
-
-	/**
-	 * 名称
-	 */
-	private String name;
-
-	/**
-	 * 数据库类型
-	 */
-	private String dsType;
-
-	/**
-	 * 配置类型 (0 主机形式 | 1 url形式)
-	 */
-	private Integer confType;
-
-	/**
-	 * 主机地址
-	 */
-	private String host;
-
-	/**
-	 * 端口
-	 */
-	private Integer port;
-
-	/**
-	 * jdbc-url
-	 */
-	private String url;
-
-	/**
-	 * 实例
-	 */
-	private String instance;
-
-	/**
-	 * 数据库名称
-	 */
-	private String dsName;
-
-	/**
-	 * 用户名
-	 */
-	private String username;
-
-	/**
-	 * 密码
-	 */
-	private String password;
-
-	/**
-	 * 创建时间
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	private LocalDateTime createTime;
-
-	/**
-	 * 修改时间
-	 */
-	@TableField(fill = FieldFill.UPDATE)
-	private LocalDateTime updateTime;
-
-	/**
-	 * 0-正常,1-删除
-	 */
-	@TableLogic
-	@TableField(fill = FieldFill.INSERT)
-	private String delFlag;
-
-}

+ 0 - 103
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenFieldType.java

@@ -1,103 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-@Data
-@TableName("gen_field_type")
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "列属性")
-public class GenFieldType extends Model<GenFieldType> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * id
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	@Schema(description = "id")
-	private Long id;
-
-	/**
-	 * 字段类型
-	 */
-	@Schema(description = "字段类型")
-	private String columnType;
-
-	/**
-	 * 属性类型
-	 */
-	@Schema(description = "属性类型")
-	private String attrType;
-
-	/**
-	 * 属性包名
-	 */
-	@Schema(description = "属性包名")
-	private String packageName;
-
-	/**
-	 * 创建人
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "创建人")
-	private String createBy;
-
-	/**
-	 * 修改人
-	 */
-	@TableField(fill = FieldFill.UPDATE)
-	@Schema(description = "修改人")
-	private String updateBy;
-
-	/**
-	 * 创建时间
-	 */
-	@Schema(description = "创建时间")
-	@TableField(fill = FieldFill.INSERT)
-	private LocalDateTime createTime;
-
-	/**
-	 * 修改时间
-	 */
-	@Schema(description = "修改时间")
-	@TableField(fill = FieldFill.UPDATE)
-	private LocalDateTime updateTime;
-
-	/**
-	 * 删除标识(0-正常,1-删除)
-	 */
-	@TableLogic
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "删除标记,1:已删除,0:正常")
-	private String delFlag;
-
-}

+ 0 - 98
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenGroupEntity.java

@@ -1,98 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-
-/**
- * 模板分组
- *
- * @author PIG
- * @date 2023-02-21 20:01:53
- */
-@Data
-@TableName("gen_group")
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "模板分组")
-public class GenGroupEntity extends Model<GenGroupEntity> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * id
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	@Schema(description = "id")
-	private Long id;
-
-	/**
-	 * 分组名称
-	 */
-	@Schema(description = "分组名称")
-	private String groupName;
-
-	/**
-	 * 分组描述
-	 */
-	@Schema(description = "分组描述")
-	@TableField(fill = FieldFill.INSERT)
-	private String groupDesc;
-
-	/**
-	 * 创建人
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "创建人")
-	private String createBy;
-
-	/**
-	 * 修改人
-	 */
-	@TableField(fill = FieldFill.UPDATE)
-	@Schema(description = "修改人")
-	private String updateBy;
-
-	/**
-	 * 创建时间
-	 */
-	@Schema(description = "创建时间")
-	@TableField(fill = FieldFill.INSERT)
-	private LocalDateTime createTime;
-
-	/**
-	 * 修改时间
-	 */
-	@Schema(description = "修改时间")
-	@TableField(fill = FieldFill.UPDATE)
-	private LocalDateTime updateTime;
-
-	/**
-	 * 删除标识(0-正常,1-删除)
-	 */
-	@TableLogic
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "删除标记,1:已删除,0:正常")
-	private String delFlag;
-
-}

+ 0 - 172
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTable.java

@@ -1,172 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:34:55
- */
-@Data
-@TableName("gen_table")
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "列属性")
-public class GenTable extends Model<GenTable> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * id
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	@Schema(description = "id")
-	private Long id;
-
-	/**
-	 * 数据源名称
-	 */
-	@Schema(description = "数据源名称")
-	private String dsName;
-
-	/**
-	 * 数据源类型
-	 */
-	@Schema(description = "数据源类型")
-	private String dbType;
-
-	/**
-	 * 表名
-	 */
-	@Schema(description = "表名")
-	private String tableName;
-
-	/**
-	 * 类名
-	 */
-	@Schema(description = "类名")
-	private String className;
-
-	/**
-	 * 说明
-	 */
-	@Schema(description = "说明")
-	private String tableComment;
-
-	/**
-	 * 作者
-	 */
-	@Schema(description = "作者")
-	private String author;
-
-	/**
-	 * 邮箱
-	 */
-	@Schema(description = "邮箱")
-	private String email;
-
-	/**
-	 * 项目包名
-	 */
-	@Schema(description = "项目包名")
-	private String packageName;
-
-	/**
-	 * 项目版本号
-	 */
-	@Schema(description = "项目版本号")
-	private String version;
-
-	/**
-	 * 生成方式 0:zip压缩包 1:自定义目录
-	 */
-	@Schema(description = "生成方式  0:zip压缩包   1:自定义目录")
-	private String generatorType;
-
-	/**
-	 * 后端生成路径
-	 */
-	@Schema(description = "后端生成路径")
-	private String backendPath;
-
-	/**
-	 * 前端生成路径
-	 */
-	@Schema(description = "前端生成路径")
-	private String frontendPath;
-
-	/**
-	 * 模块名
-	 */
-	@Schema(description = "模块名")
-	private String moduleName;
-
-	/**
-	 * 功能名
-	 */
-	@Schema(description = "功能名")
-	private String functionName;
-
-	/**
-	 * 表单布局 1:一列 2:两列
-	 */
-	@Schema(description = "表单布局  1:一列   2:两列")
-	private Integer formLayout;
-
-	/**
-	 * 基类ID
-	 */
-	@Schema(description = "基类ID")
-	private Long baseclassId;
-
-	/**
-	 * 创建时间
-	 */
-	@Schema(description = "创建时间")
-	private LocalDateTime createTime;
-
-	/**
-	 * 代码生成风格
-	 */
-	private Long style;
-
-	/**
-	 * 字段列表
-	 */
-	@TableField(exist = false)
-	private List<GenTableColumnEntity> fieldList;
-
-	/**
-	 * 代码风格(模版分组信息)
-	 */
-	@TableField(exist = false)
-	private List<GenGroupEntity> groupList;
-
-}

+ 0 - 155
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTableColumnEntity.java

@@ -1,155 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * @author LXQ
- * @date 2023-02-06
- *
- * 记录表字段的配置信息
- */
-@Data
-@TableName("gen_table_column")
-@EqualsAndHashCode(callSuper = true)
-public class GenTableColumnEntity extends Model<GenDatasourceConf> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * 主键
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	private Long id;
-
-	/**
-	 * 数据源名
-	 */
-	private String dsName;
-
-	/**
-	 * 表名称
-	 */
-	private String tableName;
-
-	/**
-	 * 字段名称
-	 */
-	private String fieldName;
-
-	/**
-	 * 排序
-	 */
-	private Integer sort;
-
-	/**
-	 * 字段类型
-	 */
-	private String fieldType;
-
-	/**
-	 * 字段说明
-	 */
-	private String fieldComment;
-
-	/**
-	 * 属性名
-	 */
-	private String attrName;
-
-	/**
-	 * 属性类型
-	 */
-	private String attrType;
-
-	/**
-	 * 属性包名
-	 */
-	private String packageName;
-
-	/**
-	 * 自动填充
-	 */
-	private String autoFill;
-
-	/**
-	 * 主键 0:否 1:是
-	 */
-	private String primaryPk;
-
-	/**
-	 * 基类字段 0:否 1:是
-	 */
-	private String baseField;
-
-	/**
-	 * 表单项 0:否 1:是
-	 */
-	private String formItem;
-
-	/**
-	 * 表单必填 0:否 1:是
-	 */
-	private String formRequired;
-
-	/**
-	 * 表单类型
-	 */
-	private String formType;
-
-	/**
-	 * 表单效验
-	 */
-	private String formValidator;
-
-	/**
-	 * 列表项 0:否 1:是
-	 */
-	private String gridItem;
-
-	/**
-	 * 列表排序 0:否 1:是
-	 */
-	private String gridSort;
-
-	/**
-	 * 查询项 0:否 1:是
-	 */
-	private String queryItem;
-
-	/**
-	 * 查询方式
-	 */
-	private String queryType;
-
-	/**
-	 * 查询表单类型
-	 */
-	private String queryFormType;
-
-	/**
-	 * 字段字典类型
-	 */
-	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private String fieldDict;
-
-}

+ 0 - 109
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTemplateEntity.java

@@ -1,109 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.time.LocalDateTime;
-
-/**
- * 模板
- *
- * @author PIG
- * @date 2023-02-21 17:15:44
- */
-@Data
-@TableName("gen_template")
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "模板")
-public class GenTemplateEntity extends Model<GenTemplateEntity> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * 主键
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	@Schema(description = "主键")
-	private Long id;
-
-	/**
-	 * 模板名称
-	 */
-	@Schema(description = "模板名称")
-	private String templateName;
-
-	/**
-	 * 模板路径
-	 */
-	@Schema(description = "模板路径")
-	private String generatorPath;
-
-	/**
-	 * 模板描述
-	 */
-	@Schema(description = "模板描述")
-	private String templateDesc;
-
-	/**
-	 * 模板代码
-	 */
-	@Schema(description = "模板代码")
-	private String templateCode;
-
-	/**
-	 * 创建人
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "创建人")
-	private String createBy;
-
-	/**
-	 * 修改人
-	 */
-	@TableField(fill = FieldFill.UPDATE)
-	@Schema(description = "修改人")
-	private String updateBy;
-
-	/**
-	 * 创建时间
-	 */
-	@Schema(description = "创建时间")
-	@TableField(fill = FieldFill.INSERT)
-	private LocalDateTime createTime;
-
-	/**
-	 * 修改时间
-	 */
-	@Schema(description = "修改时间")
-	@TableField(fill = FieldFill.UPDATE)
-	private LocalDateTime updateTime;
-
-	/**
-	 * 删除标识(0-正常,1-删除)
-	 */
-	@TableLogic
-	@TableField(fill = FieldFill.INSERT)
-	@Schema(description = "删除标记,1:已删除,0:正常")
-	private String delFlag;
-
-}

+ 0 - 54
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/GenTemplateGroupEntity.java

@@ -1,54 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-/**
- * 模板分组关联表
- *
- * @author PIG
- * @date 2023-02-22 09:25:15
- */
-@Data
-@TableName("gen_template_group")
-@Accessors(chain = true)
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "模板分组关联表")
-public class GenTemplateGroupEntity extends Model<GenTemplateGroupEntity> {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * 分组id
-	 */
-	@Schema(description = "分组id")
-	private Long groupId;
-
-	/**
-	 * 模板id
-	 */
-	@Schema(description = "模板id")
-	private Long templateId;
-
-}

+ 0 - 66
kxs-codegen/src/main/java/com/kxs/codegen/biz/entity/TableEntity.java

@@ -1,66 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.entity;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author LXQ
- * @date 2021/07/29 表属性: https://blog.csdn.net/lkforce/article/details/79557482
- */
-@Data
-public class TableEntity {
-
-	/**
-	 * 名称
-	 */
-	private String tableName;
-
-	/**
-	 * 备注
-	 */
-	private String comments;
-
-	/**
-	 * 主键
-	 */
-	private ColumnEntity pk;
-
-	/**
-	 * 列名
-	 */
-	private List<ColumnEntity> columns;
-
-	/**
-	 * 驼峰类型
-	 */
-	private String caseClassName;
-
-	/**
-	 * 普通类型
-	 */
-	private String lowerClassName;
-
-	/**
-	 * 数据库类型 (用于根据数据库个性化)
-	 */
-	private String dbType;
-
-}

+ 0 - 32
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenDatasourceConfMapper.java

@@ -1,32 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenDatasourceConf;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 数据源表
- *
- * @author LXQ
- * @date 2021-03-31 16:00:20
- */
-@Mapper
-public interface GenDatasourceConfMapper extends BaseMapper<GenDatasourceConf> {
-
-}

+ 0 - 39
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenDynamicMapper.java

@@ -1,39 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-
-/**
- * 动态查询
- *
- * @author LXQ
- * @date 2022-07-09
- */
-@Mapper
-public interface GenDynamicMapper {
-
-	@InterceptorIgnore(tenantLine = "true")
-	List<LinkedHashMap<String, Object>> dynamicQuerySql(@Param("value") String sq);
-
-}

+ 0 - 44
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenFieldTypeMapper.java

@@ -1,44 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenFieldType;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.Set;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-@Mapper
-public interface GenFieldTypeMapper extends BaseMapper<GenFieldType> {
-
-	/**
-	 * 根据tableId,获取包列表
-	 * @param dsName 数据源名称
-	 * @param tableName 表名称
-	 * @return 返回包列表
-	 */
-	Set<String> getPackageByTableId(@Param("dsName") String dsName, @Param("tableName") String tableName);
-
-}

+ 0 - 37
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenGroupMapper.java

@@ -1,37 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import com.kxs.codegen.biz.util.vo.GroupVo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 模板分组
- *
- * @author PIG
- * @date 2023-02-21 20:01:53
- */
-@Mapper
-public interface GenGroupMapper extends BaseMapper<GenGroupEntity> {
-
-	GroupVo getGroupVoById(@Param("id") Long id);
-
-}

+ 0 - 33
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTableColumnMapper.java

@@ -1,33 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-@Mapper
-public interface GenTableColumnMapper extends BaseMapper<GenTableColumnEntity> {
-
-}

+ 0 - 33
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTableMapper.java

@@ -1,33 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenTable;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:34:55
- */
-@Mapper
-public interface GenTableMapper extends BaseMapper<GenTable> {
-
-}

+ 0 - 33
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTemplateGroupMapper.java

@@ -1,33 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenTemplateGroupEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 模板分组关联表
- *
- * @author PIG
- * @date 2023-02-22 09:25:15
- */
-@Mapper
-public interface GenTemplateGroupMapper extends BaseMapper<GenTemplateGroupEntity> {
-
-}

+ 0 - 42
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GenTemplateMapper.java

@@ -1,42 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * 模板
- *
- * @author PIG
- * @date 2023-02-21 17:15:44
- */
-@Mapper
-public interface GenTemplateMapper extends BaseMapper<GenTemplateEntity> {
-
-	/**
-	 * 根据groupId查询 模板
-	 * @param groupId
-	 * @return
-	 */
-	List<GenTemplateEntity> listTemplateById(Long groupId);
-
-}

+ 0 - 97
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GeneratorMapper.java

@@ -1,97 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.kxs.codegen.biz.entity.ColumnEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 代码生成器
- *
- * @author LXQ
- * @date 2021-07-30
- */
-public interface GeneratorMapper extends BaseMapper<ColumnEntity> {
-
-	/**
-	 * 查询全部的表
-	 * @return
-	 */
-	@InterceptorIgnore(tenantLine = "true")
-	List<Map<String, Object>> queryTable();
-
-	/**
-	 * 分页查询表格
-	 * @param page 分页信息
-	 * @param tableName 表名称
-	 * @return
-	 */
-	@InterceptorIgnore(tenantLine = "true")
-	IPage<Map<String, Object>> queryTable(Page page, @Param("tableName") String tableName);
-
-	/**
-	 * 查询表信息
-	 * @param tableName 表名称
-	 * @param dsName 数据源名称
-	 * @return
-	 */
-	@DS("#last")
-	@InterceptorIgnore(tenantLine = "true")
-	Map<String, String> queryTable(@Param("tableName") String tableName, String dsName);
-
-	/**
-	 * 分页查询表分页信息
-	 * @param page
-	 * @param tableName
-	 * @param dsName
-	 * @return
-	 */
-	@DS("#last")
-	@InterceptorIgnore(tenantLine = "true")
-	IPage<ColumnEntity> selectTableColumn(Page page, @Param("tableName") String tableName,
-			@Param("dsName") String dsName);
-
-	/**
-	 * 查询表全部列信息
-	 * @param tableName
-	 * @param dsName
-	 * @return
-	 */
-	@DS("#last")
-	@InterceptorIgnore(tenantLine = "true")
-	List<ColumnEntity> selectTableColumn(@Param("tableName") String tableName, @Param("dsName") String dsName);
-
-	/**
-	 * 查询表全部列信息
-	 * @param tableName 表名称
-	 * @param dsName 数据源名称
-	 * @return
-	 */
-	@DS("#last")
-	@InterceptorIgnore(tenantLine = "true")
-	List<Map<String, String>> selectMapTableColumn(@Param("tableName") String tableName, String dsName);
-
-}

+ 0 - 31
kxs-codegen/src/main/java/com/kxs/codegen/biz/mapper/GeneratorMysqlMapper.java

@@ -1,31 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.mapper;
-
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 支持 mysql 代码生成器
- *
- * @author LXQ
- * @date 2021-12-11
- */
-@Mapper
-public interface GeneratorMysqlMapper extends GeneratorMapper {
-
-}

+ 0 - 65
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenDatasourceConfService.java

@@ -1,65 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenDatasourceConf;
-
-/**
- * 数据源表
- *
- * @author LXQ
- * @date 2021-03-31 16:00:20
- */
-public interface GenDatasourceConfService extends IService<GenDatasourceConf> {
-
-	/**
-	 * 保存数据源并且加密
-	 * @param genDatasourceConf
-	 * @return
-	 */
-	Boolean saveDsByEnc(GenDatasourceConf genDatasourceConf);
-
-	/**
-	 * 更新数据源
-	 * @param genDatasourceConf
-	 * @return
-	 */
-	Boolean updateDsByEnc(GenDatasourceConf genDatasourceConf);
-
-	/**
-	 * 更新动态数据的数据源列表
-	 * @param datasourceConf
-	 * @return
-	 */
-	void addDynamicDataSource(GenDatasourceConf datasourceConf);
-
-	/**
-	 * 校验数据源配置是否有效
-	 * @param datasourceConf 数据源信息
-	 * @return 有效/无效
-	 */
-	Boolean checkDataSource(GenDatasourceConf datasourceConf);
-
-	/**
-	 * 通过数据源名称删除
-	 * @param dsIds 数据源ID
-	 * @return
-	 */
-	Boolean removeByDsId(Long[] dsIds);
-
-}

+ 0 - 41
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenFieldTypeService.java

@@ -1,41 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenFieldType;
-
-import java.util.Set;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-public interface GenFieldTypeService extends IService<GenFieldType> {
-
-	/**
-	 * 根据tableId,获取包列表
-	 * @param dsName 数据源名称
-	 * @param tableName 表名称
-	 * @return 返回包列表
-	 */
-	Set<String> getPackageByTableId(String dsName, String tableName);
-
-}

+ 0 - 53
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenGroupService.java

@@ -1,53 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import com.kxs.codegen.biz.util.vo.GroupVo;
-import com.kxs.codegen.biz.util.vo.TemplateGroupDTO;
-
-/**
- * 模板分组
- *
- * @author PIG
- * @date 2023-02-21 20:01:53
- */
-public interface GenGroupService extends IService<GenGroupEntity> {
-
-	void saveGenGroup(TemplateGroupDTO genTemplateGroup);
-
-	/**
-	 * 删除分组关系
-	 * @param ids
-	 */
-	void delGroupAndTemplate(Long[] ids);
-
-	/**
-	 * 查询group数据
-	 * @param id
-	 */
-	GroupVo getGroupVoById(Long id);
-
-	/**
-	 * 更新group数据
-	 * @param groupVo
-	 */
-	void updateGroupAndTemplateById(GroupVo groupVo);
-
-}

+ 0 - 47
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTableColumnService.java

@@ -1,47 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-
-import java.util.List;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-public interface GenTableColumnService extends IService<GenTableColumnEntity> {
-
-	/**
-	 * 初始化字段列表
-	 * @param tableFieldList 表字段列表
-	 */
-	void initFieldList(List<GenTableColumnEntity> tableFieldList);
-
-	/**
-	 * 更新表字段
-	 * @param dsName 数据源名称
-	 * @param tableName 表名称
-	 * @param tableFieldList 表字段列表
-	 */
-	void updateTableField(String dsName, String tableName, List<GenTableColumnEntity> tableFieldList);
-
-}

+ 0 - 73
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTableService.java

@@ -1,73 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenTable;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:34:55
- */
-public interface GenTableService extends IService<GenTable> {
-
-	/**
-	 * 获取默认配置信息
-	 * @return 默认配置信息
-	 */
-	Map<String, Object> getGeneratorConfig();
-
-	/**
-	 * 分页查询表格列表
-	 * @param page 分页对象
-	 * @param table 查询条件
-	 * @return 表格列表分页结果
-	 */
-	IPage list(Page<GenTable> page, GenTable table);
-
-	/**
-	 * 根据数据源名称和表名查询或构建表格
-	 * @param dsName 数据源名称
-	 * @param tableName 表名
-	 * @return 查询到的表格信息
-	 */
-	GenTable queryOrBuildTable(String dsName, String tableName);
-
-	/**
-	 * 查询指定数据源下的所有表格
-	 * @param dsName 数据源名称
-	 * @return 所有表格的列表
-	 */
-	List<Map<String, Object>> queryDsAllTable(String dsName);
-
-	/**
-	 * 查询指定数据源和表名的列信息
-	 * @param dsName 数据源名称
-	 * @param tableName 表名
-	 * @return 列信息列表
-	 */
-	List<Map<String, String>> queryColumn(String dsName, String tableName);
-
-}

+ 0 - 31
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTemplateGroupService.java

@@ -1,31 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenTemplateGroupEntity;
-
-/**
- * 模板分组关联表
- *
- * @author PIG
- * @date 2023-02-22 09:25:15
- */
-public interface GenTemplateGroupService extends IService<GenTemplateGroupEntity> {
-
-}

+ 0 - 31
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GenTemplateService.java

@@ -1,31 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-
-/**
- * 模板
- *
- * @author PIG
- * @date 2023-02-21 17:15:44
- */
-public interface GenTemplateService extends IService<GenTemplateEntity> {
-
-}

+ 0 - 50
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/GeneratorService.java

@@ -1,50 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service;
-
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipOutputStream;
-
-/**
- * @author LXQ
- * @date 2021/7/29
- */
-public interface GeneratorService {
-
-	/**
-	 * 生成代码zip写出
-	 * @param tableId 表
-	 * @param zip 输出流
-	 */
-	void downloadCode(Long tableId, ZipOutputStream zip);
-
-	/**
-	 * 预览代码
-	 * @param tableId 表
-	 * @return [{模板名称:渲染结果}]
-	 */
-	List<Map<String, String>> preview(Long tableId);
-
-	/**
-	 * 目标目录写入渲染结果
-	 * @param tableId 表
-	 */
-	void generatorCode(Long tableId);
-
-}

+ 0 - 172
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenDatasourceConfServiceImpl.java

@@ -1,172 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
-import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
-import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
-import com.baomidou.dynamic.datasource.creator.druid.DruidConfig;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenDatasourceConf;
-import com.kxs.codegen.biz.mapper.GenDatasourceConfMapper;
-import com.kxs.codegen.biz.service.GenDatasourceConfService;
-import com.kxs.common.core.util.SpringContextHolder;
-import com.kxs.common.datasource.enums.DsConfTypeEnum;
-import com.kxs.common.datasource.enums.DsJdbcUrlEnum;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.jasypt.encryption.StringEncryptor;
-import org.springframework.stereotype.Service;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-
-/**
- * 数据源表
- *
- * @author LXQ
- * @date 2021-03-31 16:00:20
- */
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfMapper, GenDatasourceConf>
-		implements GenDatasourceConfService {
-
-	private final StringEncryptor stringEncryptor;
-
-	private final DefaultDataSourceCreator druidDataSourceCreator;
-
-	/**
-	 * 保存数据源并且加密
-	 * @param conf
-	 * @return
-	 */
-	@Override
-	public Boolean saveDsByEnc(GenDatasourceConf conf) {
-		// 校验配置合法性
-		if (!checkDataSource(conf)) {
-			return Boolean.FALSE;
-		}
-
-		// 添加动态数据源
-		addDynamicDataSource(conf);
-
-		// 更新数据库配置
-		conf.setPassword(stringEncryptor.encrypt(conf.getPassword()));
-		this.baseMapper.insert(conf);
-		return Boolean.TRUE;
-	}
-
-	/**
-	 * 更新数据源
-	 * @param conf 数据源信息
-	 * @return
-	 */
-	@Override
-	public Boolean updateDsByEnc(GenDatasourceConf conf) {
-		if (!checkDataSource(conf)) {
-			return Boolean.FALSE;
-		}
-		// 先移除
-		DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
-		dynamicRoutingDataSource.removeDataSource(baseMapper.selectById(conf.getId()).getName());
-
-		// 再添加
-		addDynamicDataSource(conf);
-
-		// 更新数据库配置
-		if (StrUtil.isNotBlank(conf.getPassword())) {
-			conf.setPassword(stringEncryptor.encrypt(conf.getPassword()));
-		}
-		this.baseMapper.updateById(conf);
-		return Boolean.TRUE;
-	}
-
-	/**
-	 * 通过数据源名称删除
-	 * @param dsIds 数据源ID
-	 * @return
-	 */
-	@Override
-	public Boolean removeByDsId(Long[] dsIds) {
-		DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
-		this.baseMapper.selectBatchIds(CollUtil.toList(dsIds))
-			.forEach(ds -> dynamicRoutingDataSource.removeDataSource(ds.getName()));
-		this.baseMapper.deleteBatchIds(CollUtil.toList(dsIds));
-		return Boolean.TRUE;
-	}
-
-	/**
-	 * 添加动态数据源
-	 * @param conf 数据源信息
-	 */
-	@Override
-	public void addDynamicDataSource(GenDatasourceConf conf) {
-		DataSourceProperty dataSourceProperty = new DataSourceProperty();
-		dataSourceProperty.setPoolName(conf.getName());
-		dataSourceProperty.setUrl(conf.getUrl());
-		dataSourceProperty.setUsername(conf.getUsername());
-		dataSourceProperty.setPassword(conf.getPassword());
-
-		// 增加 ValidationQuery 参数
-		DruidConfig druidConfig = new DruidConfig();
-		dataSourceProperty.setDruid(druidConfig);
-		DataSource dataSource = druidDataSourceCreator.createDataSource(dataSourceProperty);
-
-		DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class);
-		dynamicRoutingDataSource.addDataSource(dataSourceProperty.getPoolName(), dataSource);
-	}
-
-	/**
-	 * 校验数据源配置是否有效
-	 * @param conf 数据源信息
-	 * @return 有效/无效
-	 */
-	@Override
-	public Boolean checkDataSource(GenDatasourceConf conf) {
-		String url;
-		// JDBC 配置形式
-		if (DsConfTypeEnum.JDBC.getType().equals(conf.getConfType())) {
-			url = conf.getUrl();
-		}
-		else if (DsJdbcUrlEnum.MSSQL.getDbName().equals(conf.getDsType())) {
-			// 主机形式 sql server 特殊处理
-			DsJdbcUrlEnum urlEnum = DsJdbcUrlEnum.get(conf.getDsType());
-			url = String.format(urlEnum.getUrl(), conf.getHost(), conf.getPort(), conf.getDsName());
-		}
-		else {
-			DsJdbcUrlEnum urlEnum = DsJdbcUrlEnum.get(conf.getDsType());
-			url = String.format(urlEnum.getUrl(), conf.getHost(), conf.getPort(), conf.getDsName());
-		}
-
-		conf.setUrl(url);
-
-		try (Connection connection = DriverManager.getConnection(url, conf.getUsername(), conf.getPassword())) {
-		}
-		catch (SQLException e) {
-			log.error("数据源配置 {} , 获取链接失败", conf.getName(), e);
-			throw new RuntimeException("数据库配置错误,链接失败");
-		}
-		return Boolean.TRUE;
-	}
-
-}

+ 0 - 51
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenFieldTypeServiceImpl.java

@@ -1,51 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenFieldType;
-import com.kxs.codegen.biz.mapper.GenFieldTypeMapper;
-import com.kxs.codegen.biz.service.GenFieldTypeService;
-import org.springframework.stereotype.Service;
-
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:16:01
- */
-@Service
-public class GenFieldTypeServiceImpl extends ServiceImpl<GenFieldTypeMapper, GenFieldType>
-		implements GenFieldTypeService {
-
-	/**
-	 * 根据tableId,获取包列表
-	 * @param dsName 数据源名称
-	 * @param tableName 表名称
-	 * @return 返回包列表
-	 */
-	@Override
-	public Set<String> getPackageByTableId(String dsName, String tableName) {
-		Set<String> importList = baseMapper.getPackageByTableId(dsName, tableName);
-		return importList.stream().filter(StrUtil::isNotBlank).collect(Collectors.toSet());
-	}
-
-}

+ 0 - 116
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenGroupServiceImpl.java

@@ -1,116 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import com.kxs.codegen.biz.entity.GenTemplateGroupEntity;
-import com.kxs.codegen.biz.mapper.GenGroupMapper;
-import com.kxs.codegen.biz.service.GenGroupService;
-import com.kxs.codegen.biz.service.GenTemplateGroupService;
-import com.kxs.codegen.biz.util.vo.GroupVo;
-import com.kxs.codegen.biz.util.vo.TemplateGroupDTO;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * 模板分组
- *
- * @author PIG
- * @date 2023-02-21 20:01:53
- */
-@Slf4j
-@Service
-@AllArgsConstructor
-public class GenGroupServiceImpl extends ServiceImpl<GenGroupMapper, GenGroupEntity> implements GenGroupService {
-
-	private final GenTemplateGroupService genTemplateGroupService;
-
-	/**
-	 * 新增模板分组
-	 * @param genTemplateGroup
-	 */
-	@Override
-	public void saveGenGroup(TemplateGroupDTO genTemplateGroup) {
-		// 1.保存group
-		GenGroupEntity groupEntity = new GenGroupEntity();
-		BeanUtil.copyProperties(genTemplateGroup, groupEntity);
-		baseMapper.insert(groupEntity);
-		// 2.保存关系
-		List<GenTemplateGroupEntity> goals = new LinkedList<>();
-		for (Long TemplateId : genTemplateGroup.getTemplateId()) {
-			GenTemplateGroupEntity templateGroup = new GenTemplateGroupEntity();
-			templateGroup.setTemplateId(TemplateId).setGroupId(groupEntity.getId());
-			goals.add(templateGroup);
-		}
-		genTemplateGroupService.saveBatch(goals);
-
-	}
-
-	/**
-	 * 按照ids删除
-	 * @param ids groupIds
-	 */
-	@Override
-	public void delGroupAndTemplate(Long[] ids) {
-		// 删除分组
-		this.removeBatchByIds(CollUtil.toList(ids));
-		// 删除关系
-		genTemplateGroupService
-			.remove(Wrappers.<GenTemplateGroupEntity>lambdaQuery().in(GenTemplateGroupEntity::getGroupId, ids));
-	}
-
-	/**
-	 * 按照id查询
-	 * @param id
-	 * @return
-	 */
-	@Override
-	public GroupVo getGroupVoById(Long id) {
-		return baseMapper.getGroupVoById(id);
-	}
-
-	/**
-	 * 根据id更新
-	 * @param groupVo
-	 */
-	@Override
-	public void updateGroupAndTemplateById(GroupVo groupVo) {
-		// 1.更新自身
-		GenGroupEntity groupEntity = new GenGroupEntity();
-		BeanUtil.copyProperties(groupVo, groupEntity);
-		this.updateById(groupEntity);
-		// 2.更新模板
-		// 2.1根据id删除之前的模板
-		genTemplateGroupService.remove(
-				Wrappers.<GenTemplateGroupEntity>lambdaQuery().eq(GenTemplateGroupEntity::getGroupId, groupVo.getId()));
-		// 2.2根据ids创建新的模板分组赋值
-		List<GenTemplateGroupEntity> goals = new LinkedList<>();
-		for (Long templateId : groupVo.getTemplateId()) {
-			goals.add(new GenTemplateGroupEntity().setGroupId(groupVo.getId()).setTemplateId(templateId));
-		}
-		genTemplateGroupService.saveBatch(goals);
-	}
-
-}

+ 0 - 88
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTableColumnServiceImpl.java

@@ -1,88 +0,0 @@
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.text.NamingCase;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenFieldType;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-import com.kxs.codegen.biz.mapper.GenFieldTypeMapper;
-import com.kxs.codegen.biz.mapper.GenTableColumnMapper;
-import com.kxs.codegen.biz.service.GenTableColumnService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-
-/**
- * 表字段信息管理
- *
- * @author LXQ
- * @date 2021/5/18
- */
-@Service
-@RequiredArgsConstructor
-public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumnEntity>
-		implements GenTableColumnService {
-
-	private final GenFieldTypeMapper fieldTypeMapper;
-
-	/**
-	 * 初始化表单字段列表,主要是将数据库表中的字段转化为表单需要的字段数据格式,并为审计字段排序
-	 * @param tableFieldList 表单字段列表
-	 */
-	public void initFieldList(List<GenTableColumnEntity> tableFieldList) {
-		// 字段类型、属性类型映射
-		List<GenFieldType> list = fieldTypeMapper.selectList(Wrappers.emptyWrapper());
-		Map<String, GenFieldType> fieldTypeMap = new LinkedHashMap<>(list.size());
-		list.forEach(
-				fieldTypeMapping -> fieldTypeMap.put(fieldTypeMapping.getColumnType().toLowerCase(), fieldTypeMapping));
-
-		// 索引计数器
-		AtomicInteger index = new AtomicInteger(0);
-		tableFieldList.forEach(field -> {
-			// 将字段名转化为驼峰格式
-			field.setAttrName(NamingCase.toCamelCase(field.getFieldName()));
-
-			// 获取字段对应的类型
-			GenFieldType fieldTypeMapping = fieldTypeMap.getOrDefault(field.getFieldType().toLowerCase(), null);
-			if (fieldTypeMapping == null) {
-				// 没找到对应的类型,则为Object类型
-				field.setAttrType("Object");
-			}
-			else {
-				field.setAttrType(fieldTypeMapping.getAttrType());
-				field.setPackageName(fieldTypeMapping.getPackageName());
-			}
-
-			// 设置查询类型和表单查询类型都为“=”
-			field.setQueryType("=");
-			field.setQueryFormType("text");
-
-			// 设置表单类型为文本框类型
-			field.setFormType("text");
-
-			// 保证审计字段最后显示
-			field.setSort(Objects.isNull(field.getSort()) ? index.getAndIncrement() : field.getSort());
-		});
-	}
-
-	/**
-	 * 更新指定数据源和表名的表单字段信息
-	 * @param dsName 数据源名称
-	 * @param tableName 表名
-	 * @param tableFieldList 表单字段列表
-	 */
-	@Override
-	public void updateTableField(String dsName, String tableName, List<GenTableColumnEntity> tableFieldList) {
-		AtomicInteger sort = new AtomicInteger();
-		this.updateBatchById(tableFieldList.stream()
-			.peek(field -> field.setSort(sort.getAndIncrement()))
-			.collect(Collectors.toList()));
-	}
-
-}

+ 0 - 208
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTableServiceImpl.java

@@ -1,208 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.io.resource.ClassPathResource;
-import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.text.NamingCase;
-import cn.hutool.core.util.EnumUtil;
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import com.kxs.codegen.biz.entity.GenTable;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-import com.kxs.codegen.biz.mapper.GenTableMapper;
-import com.kxs.codegen.biz.mapper.GeneratorMapper;
-import com.kxs.codegen.biz.service.GenTableColumnService;
-import com.kxs.codegen.biz.service.GenTableService;
-import com.kxs.codegen.biz.util.BoolFillEnum;
-import com.kxs.codegen.biz.util.CommonColumnFiledEnum;
-import com.kxs.codegen.biz.util.GenKit;
-import com.kxs.codegen.biz.util.GeneratorTypeEnum;
-import com.kxs.codegen.biz.service.GenGroupService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * 列属性
- *
- * @author skyx code generator
- * @date 2023-02-06 20:34:55
- */
-@Service
-@RequiredArgsConstructor
-public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> implements GenTableService {
-
-	/**
-	 * 默认配置信息
-	 */
-	private static final String CONFIG_PATH = "template/config.json";
-
-	private final GenTableColumnService columnService;
-
-	private final GeneratorMapper generatorMapper;
-
-	private final GenGroupService genGroupService;
-
-	/**
-	 * 获取配置信息
-	 * @return
-	 */
-	@Override
-	public Map<String, Object> getGeneratorConfig() {
-		ClassPathResource classPathResource = new ClassPathResource(CONFIG_PATH);
-		JSONObject jsonObject = JSONUtil.parseObj(IoUtil.readUtf8(classPathResource.getStream()));
-		return jsonObject.getRaw();
-	}
-
-	@Override
-	public List<Map<String, Object>> queryDsAllTable(String dsName) {
-		GeneratorMapper mapper = GenKit.getMapper(dsName);
-		// 手动切换数据源
-		DynamicDataSourceContextHolder.push(dsName);
-		return mapper.queryTable();
-	}
-
-	@Override
-	public List<Map<String, String>> queryColumn(String dsName, String tableName) {
-		GeneratorMapper mapper = GenKit.getMapper(dsName);
-		return mapper.selectMapTableColumn(tableName, dsName);
-	}
-
-	@Override
-	public IPage list(Page<GenTable> page, GenTable table) {
-		GeneratorMapper mapper = GenKit.getMapper(table.getDsName());
-		// 手动切换数据源
-		DynamicDataSourceContextHolder.push(table.getDsName());
-		return mapper.queryTable(page, table.getTableName());
-	}
-
-	/**
-	 * 获取表信息
-	 * @param dsName
-	 * @param tableName
-	 * @return
-	 */
-	@Override
-	public GenTable queryOrBuildTable(String dsName, String tableName) {
-		GenTable genTable = baseMapper.selectOne(
-				Wrappers.<GenTable>lambdaQuery().eq(GenTable::getTableName, tableName).eq(GenTable::getDsName, dsName));
-		// 如果 genTable 为空, 执行导入
-		if (Objects.isNull(genTable)) {
-			genTable = this.tableImport(dsName, tableName);
-		}
-
-		List<GenTableColumnEntity> fieldList = columnService.list(Wrappers.<GenTableColumnEntity>lambdaQuery()
-			.eq(GenTableColumnEntity::getDsName, dsName)
-			.eq(GenTableColumnEntity::getTableName, tableName)
-			.orderByAsc(GenTableColumnEntity::getSort));
-		genTable.setFieldList(fieldList);
-
-		// 查询模板分组信息
-		List<GenGroupEntity> groupEntities = genGroupService.list();
-		genTable.setGroupList(groupEntities);
-		return genTable;
-	}
-
-	@Transactional(rollbackFor = Exception.class)
-	public GenTable tableImport(String dsName, String tableName) {
-		GeneratorMapper mapper = GenKit.getMapper(dsName);
-		// 手动切换数据源
-		DynamicDataSourceContextHolder.push(dsName);
-
-		// 查询表是否存在
-		GenTable table = new GenTable();
-
-		// 从数据库获取表信息
-		Map<String, String> queryTable = mapper.queryTable(tableName, dsName);
-
-		// 获取默认表配置信息 ()
-		Map<String, Object> generatorConfig = getGeneratorConfig();
-		JSONObject project = (JSONObject) generatorConfig.get("project");
-		JSONObject developer = (JSONObject) generatorConfig.get("developer");
-
-		table.setPackageName(project.getStr("packageName"));
-		table.setVersion(project.getStr("version"));
-		table.setBackendPath(project.getStr("backendPath"));
-		table.setFrontendPath(project.getStr("frontendPath"));
-		table.setAuthor(developer.getStr("author"));
-		table.setEmail(developer.getStr("email"));
-		table.setTableName(tableName);
-		table.setDsName(dsName);
-		table.setTableComment(MapUtil.getStr(queryTable, "tableComment"));
-		table.setDbType(MapUtil.getStr(queryTable, "dbType"));
-		table.setFormLayout(2);
-		table.setGeneratorType(GeneratorTypeEnum.ZIP_DOWNLOAD.getValue());
-		table.setClassName(NamingCase.toPascalCase(tableName));
-		table.setModuleName(GenKit.getModuleName(table.getPackageName()));
-		table.setFunctionName(GenKit.getFunctionName(tableName));
-		table.setCreateTime(LocalDateTime.now());
-		this.save(table);
-
-		// 获取原生字段数据
-		List<Map<String, String>> queryColumnList = mapper.selectMapTableColumn(tableName, dsName);
-		List<GenTableColumnEntity> tableFieldList = new ArrayList<>();
-
-		for (Map<String, String> columnMap : queryColumnList) {
-			String columnName = MapUtil.getStr(columnMap, "columnName");
-			GenTableColumnEntity genTableColumnEntity = new GenTableColumnEntity();
-			genTableColumnEntity.setTableName(tableName);
-			genTableColumnEntity.setDsName(dsName);
-			genTableColumnEntity.setFieldName(MapUtil.getStr(columnMap, "columnName"));
-			genTableColumnEntity.setFieldComment(MapUtil.getStr(columnMap, "comments"));
-			genTableColumnEntity.setFieldType(MapUtil.getStr(columnMap, "dataType"));
-			String columnKey = MapUtil.getStr(columnMap, "columnKey");
-			genTableColumnEntity.setAutoFill("DEFAULT");
-			genTableColumnEntity.setPrimaryPk((StringUtils.isNotBlank(columnKey) && "PRI".equalsIgnoreCase(columnKey))
-					? BoolFillEnum.TRUE.getValue() : BoolFillEnum.FALSE.getValue());
-			genTableColumnEntity.setAutoFill("DEFAULT");
-			genTableColumnEntity.setFormItem(BoolFillEnum.TRUE.getValue());
-			genTableColumnEntity.setGridItem(BoolFillEnum.TRUE.getValue());
-
-			// 审计字段处理
-			if (EnumUtil.contains(CommonColumnFiledEnum.class, columnName)) {
-				CommonColumnFiledEnum commonColumnFiledEnum = CommonColumnFiledEnum.valueOf(columnName);
-				genTableColumnEntity.setFormItem(commonColumnFiledEnum.getFormItem());
-				genTableColumnEntity.setGridItem(commonColumnFiledEnum.getGridItem());
-				genTableColumnEntity.setAutoFill(commonColumnFiledEnum.getAutoFill());
-				genTableColumnEntity.setSort(commonColumnFiledEnum.getSort());
-			}
-			tableFieldList.add(genTableColumnEntity);
-		}
-		// 初始化字段数据
-		columnService.initFieldList(tableFieldList);
-		// 保存列数据
-		columnService.saveOrUpdateBatch(tableFieldList);
-		table.setFieldList(tableFieldList);
-		return table;
-	}
-
-}

+ 0 - 35
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTemplateGroupServiceImpl.java

@@ -1,35 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenTemplateGroupEntity;
-import com.kxs.codegen.biz.mapper.GenTemplateGroupMapper;
-import com.kxs.codegen.biz.service.GenTemplateGroupService;
-import org.springframework.stereotype.Service;
-
-/**
- * 模板分组关联表
- *
- * @author PIG
- * @date 2023-02-22 09:25:15
- */
-@Service
-public class GenTemplateGroupServiceImpl extends ServiceImpl<GenTemplateGroupMapper, GenTemplateGroupEntity>
-		implements GenTemplateGroupService {
-
-}

+ 0 - 35
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GenTemplateServiceImpl.java

@@ -1,35 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-package com.kxs.codegen.biz.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-import com.kxs.codegen.biz.mapper.GenTemplateMapper;
-import com.kxs.codegen.biz.service.GenTemplateService;
-import org.springframework.stereotype.Service;
-
-/**
- * 模板
- *
- * @author PIG
- * @date 2023-02-21 11:08:43
- */
-@Service
-public class GenTemplateServiceImpl extends ServiceImpl<GenTemplateMapper, GenTemplateEntity>
-		implements GenTemplateService {
-
-}

+ 0 - 253
kxs-codegen/src/main/java/com/kxs/codegen/biz/service/impl/GeneratorServiceImpl.java

@@ -1,253 +0,0 @@
-/*
- *    Copyright (c) 2021-2025, LXQ All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: LXQ (609827073@qq.com)
- */
-
-package com.kxs.codegen.biz.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.BooleanUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONObject;
-import com.kxs.codegen.biz.entity.GenTable;
-import com.kxs.codegen.biz.entity.GenTableColumnEntity;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-import com.kxs.codegen.biz.service.*;
-import com.kxs.codegen.biz.util.VelocityKit;
-import com.kxs.codegen.biz.util.vo.GroupVo;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- * @author LXQ
- * @date 2021-07-30
- * <p>
- * 代码生成器
- */
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class GeneratorServiceImpl implements GeneratorService {
-
-	private final GenTableColumnService columnService;
-
-	private final GenFieldTypeService fieldTypeService;
-
-	private final GenTableService tableService;
-
-	private final GenGroupService genGroupService;
-
-	/**
-	 * 生成代码zip写出
-	 * @param tableId 表
-	 * @param zip 输出流
-	 */
-	@Override
-	@SneakyThrows
-	public void downloadCode(Long tableId, ZipOutputStream zip) {
-		// 数据模型
-		Map<String, Object> dataModel = getDataModel(tableId);
-
-		Long style = (Long) dataModel.get("style");
-
-		GroupVo groupVo = genGroupService.getGroupVoById(style);
-		List<GenTemplateEntity> templateList = groupVo.getTemplateList();
-
-		Map<String, Object> generatorConfig = tableService.getGeneratorConfig();
-		JSONObject project = (JSONObject) generatorConfig.get("project");
-		String frontendPath = project.getStr("frontendPath");
-		String backendPath = project.getStr("backendPath");
-
-		for (GenTemplateEntity template : templateList) {
-			String templateCode = template.getTemplateCode();
-			String generatorPath = template.getGeneratorPath();
-
-			dataModel.put("frontendPath", frontendPath);
-			dataModel.put("backendPath", backendPath);
-			String content = VelocityKit.renderStr(templateCode, dataModel);
-			String path = VelocityKit.renderStr(generatorPath, dataModel);
-
-			// 添加到zip
-			zip.putNextEntry(new ZipEntry(path));
-			IoUtil.writeUtf8(zip, false, content);
-			zip.flush();
-			zip.closeEntry();
-		}
-
-	}
-
-	/**
-	 * 表达式优化的预览代码方法
-	 * @param tableId 表
-	 * @return [{模板名称:渲染结果}]
-	 */
-	@Override
-	@SneakyThrows
-	public List<Map<String, String>> preview(Long tableId) {
-		// 数据模型
-		Map<String, Object> dataModel = getDataModel(tableId);
-
-		Long style = (Long) dataModel.get("style");
-
-		// 获取模板列表,Lambda 表达式简化代码
-		List<GenTemplateEntity> templateList = genGroupService.getGroupVoById(style).getTemplateList();
-
-		Map<String, Object> generatorConfig = tableService.getGeneratorConfig();
-		JSONObject project = (JSONObject) generatorConfig.get("project");
-		String frontendPath = project.getStr("frontendPath");
-		String backendPath = project.getStr("backendPath");
-
-		return templateList.stream().map(template -> {
-			String templateCode = template.getTemplateCode();
-			String generatorPath = template.getGeneratorPath();
-
-			// 预览模式下, 使用相对路径展示
-			dataModel.put("frontendPath", frontendPath);
-			dataModel.put("backendPath", backendPath);
-			String content = VelocityKit.renderStr(templateCode, dataModel);
-			String path = VelocityKit.renderStr(generatorPath, dataModel);
-
-			// 使用 map 简化代码
-			return new HashMap<String, String>(4) {
-				{
-					put("code", content);
-					put("codePath", path);
-				}
-			};
-		}).collect(Collectors.toList());
-	}
-
-	/**
-	 * 目标目录写入渲染结果方法
-	 * @param tableId 表
-	 */
-	@Override
-	public void generatorCode(Long tableId) {
-		// 数据模型
-		Map<String, Object> dataModel = getDataModel(tableId);
-		Long style = (Long) dataModel.get("style");
-
-		// 获取模板列表,Lambda 表达式简化代码
-		List<GenTemplateEntity> templateList = genGroupService.getGroupVoById(style).getTemplateList();
-
-		templateList.forEach(template -> {
-			String templateCode = template.getTemplateCode();
-			String generatorPath = template.getGeneratorPath();
-			String content = VelocityKit.renderStr(templateCode, dataModel);
-			String path = VelocityKit.renderStr(generatorPath, dataModel);
-			FileUtil.writeUtf8String(content, path);
-		});
-	}
-
-	/**
-	 * 通过 Lambda 表达式优化的获取数据模型方法
-	 * @param tableId 表格 ID
-	 * @return 数据模型 Map 对象
-	 */
-	private Map<String, Object> getDataModel(Long tableId) {
-		// 获取表格信息
-		GenTable table = tableService.getById(tableId);
-		// 获取字段列表
-		List<GenTableColumnEntity> fieldList = columnService.lambdaQuery()
-			.eq(GenTableColumnEntity::getDsName, table.getDsName())
-			.eq(GenTableColumnEntity::getTableName, table.getTableName())
-			.orderByAsc(GenTableColumnEntity::getSort)
-			.list();
-
-		table.setFieldList(fieldList);
-
-		// 创建数据模型对象
-		Map<String, Object> dataModel = new HashMap<>();
-
-		// 填充数据模型
-		dataModel.put("dbType", table.getDbType());
-		dataModel.put("package", table.getPackageName());
-		dataModel.put("packagePath", table.getPackageName().replace(".", File.separator));
-		dataModel.put("version", table.getVersion());
-		dataModel.put("moduleName", table.getModuleName());
-		dataModel.put("ModuleName", StrUtil.upperFirst(table.getModuleName()));
-		dataModel.put("functionName", table.getFunctionName());
-		dataModel.put("FunctionName", StrUtil.upperFirst(table.getFunctionName()));
-		dataModel.put("formLayout", table.getFormLayout());
-		dataModel.put("style", table.getStyle());
-		dataModel.put("author", table.getAuthor());
-		dataModel.put("datetime", DateUtil.now());
-		dataModel.put("date", DateUtil.today());
-		setFieldTypeList(dataModel, table);
-
-		// 获取导入的包列表
-		Set<String> importList = fieldTypeService.getPackageByTableId(table.getDsName(), table.getTableName());
-		dataModel.put("importList", importList);
-		dataModel.put("tableName", table.getTableName());
-		dataModel.put("tableComment", table.getTableComment());
-		dataModel.put("className", StrUtil.lowerFirst(table.getClassName()));
-		dataModel.put("ClassName", table.getClassName());
-		dataModel.put("fieldList", table.getFieldList());
-
-		dataModel.put("backendPath", table.getBackendPath());
-		dataModel.put("frontendPath", table.getFrontendPath());
-		return dataModel;
-	}
-
-	/**
-	 * 将表字段按照类型分组并存储到数据模型中
-	 * @param dataModel 存储数据的 Map 对象
-	 * @param table 表信息对象
-	 */
-	private void setFieldTypeList(Map<String, Object> dataModel, GenTable table) {
-		// 按字段类型分组,使用 Map 存储不同类型的字段列表
-		Map<Boolean, List<GenTableColumnEntity>> typeMap = table.getFieldList()
-			.stream()
-			.collect(Collectors.partitioningBy(columnEntity -> BooleanUtil.toBoolean(columnEntity.getPrimaryPk())));
-
-		// 从分组后的 Map 中获取不同类型的字段列表
-		List<GenTableColumnEntity> primaryList = typeMap.get(true);
-		List<GenTableColumnEntity> formList = typeMap.get(false)
-			.stream()
-			.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getFormItem()))
-			.collect(Collectors.toList());
-		List<GenTableColumnEntity> gridList = typeMap.get(false)
-			.stream()
-			.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getGridItem()))
-			.collect(Collectors.toList());
-		List<GenTableColumnEntity> queryList = typeMap.get(false)
-			.stream()
-			.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getQueryItem()))
-			.collect(Collectors.toList());
-
-		if (CollUtil.isNotEmpty(primaryList)) {
-			dataModel.put("pk", primaryList.get(0));
-		}
-		dataModel.put("primaryList", primaryList);
-		dataModel.put("formList", formList);
-		dataModel.put("gridList", gridList);
-		dataModel.put("queryList", queryList);
-	}
-
-}

+ 0 - 26
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/BoolFillEnum.java

@@ -1,26 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * boolean 类型枚举
- *
- */
-
-@Getter
-@RequiredArgsConstructor
-public enum BoolFillEnum {
-
-	/**
-	 * true
-	 */
-	TRUE("1"),
-	/**
-	 * false
-	 */
-	FALSE("0");
-
-	private final String value;
-
-}

+ 0 - 62
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/CommonColumnFiledEnum.java

@@ -1,62 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * @author LXQ
- * @date 2023/3/12
- * <p>
- * 通用字段的填充策略和显示策略
- */
-@Getter
-@AllArgsConstructor
-public enum CommonColumnFiledEnum {
-
-	/**
-	 * create_by 字段
-	 */
-	create_by("0", "0", "INSERT", 100),
-
-	/**
-	 * create_time 字段
-	 */
-	create_time("0", "0", "INSERT", 101),
-	/**
-	 * update_by 字段
-	 */
-	update_by("0", "0", "INSERT_UPDATE", 102),
-	/**
-	 * update_time 字段
-	 */
-	update_time("0", "0", "INSERT_UPDATE", 103),
-	/**
-	 * del_flag 字段
-	 */
-	del_flag("0", "0", "DEFAULT", 104),
-	/**
-	 * tenant_id 字段
-	 */
-	tenant_id("0", "0", "DEFAULT", 105);
-
-	/**
-	 * 表单是否默认显示
-	 */
-	private String formItem;
-
-	/**
-	 * 表格是否默认显示
-	 */
-	private String gridItem;
-
-	/**
-	 * 自动填充策略
-	 */
-	private String autoFill;
-
-	/**
-	 * 排序值
-	 */
-	private Integer sort;
-
-}

+ 0 - 32
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/DictTool.java

@@ -1,32 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * @author LXQ
- * @date 2023/2/7
- */
-public class DictTool {
-
-	/**
-	 * 将字段列表转换为带有双引号的逗号分隔的字符串
-	 * @return 带有双引号的逗号分隔的字符串
-	 */
-	public static String quotation(List<String> fields) {
-
-		return CollUtil.join(new HashSet<>(fields), StrUtil.COMMA, s -> String.format("'%s'", s));
-	}
-
-	/**
-	 * 将字段列表转换为逗号分隔的字符串
-	 * @return 逗号分隔的字符串
-	 */
-	public static String format(List<String> fields) {
-		return CollUtil.join(new HashSet<>(fields), StrUtil.COMMA);
-	}
-
-}

+ 0 - 75
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/GenKit.java

@@ -1,75 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.kxs.codegen.biz.entity.GenDatasourceConf;
-import com.kxs.codegen.biz.mapper.GenDatasourceConfMapper;
-import com.kxs.codegen.biz.mapper.GeneratorMapper;
-import com.kxs.common.core.util.SpringContextHolder;
-import com.kxs.common.datasource.enums.DsJdbcUrlEnum;
-import lombok.experimental.UtilityClass;
-import org.springframework.context.ApplicationContext;
-
-import java.util.Map;
-
-/**
- * 代码生成工具类
- *
- * @author LXQ
- * @date 2023/2/16
- */
-@UtilityClass
-public class GenKit {
-
-	/**
-	 * 获取功能名 sys_a_b sysAb
-	 * @param tableName 表名
-	 * @return 功能名
-	 */
-	public String getFunctionName(String tableName) {
-		return StrUtil.toCamelCase(tableName);
-	}
-
-	/**
-	 * 获取模块名称
-	 * @param packageName 包名
-	 * @return 功能名
-	 */
-	public String getModuleName(String packageName) {
-		return StrUtil.subAfter(packageName, ".", true);
-	}
-
-	/**
-	 * 获取数据源对应方言的mapper
-	 * @param dsName 数据源名称
-	 * @return GeneratorMapper
-	 */
-	public GeneratorMapper getMapper(String dsName) {
-		// 获取目标数据源数据库类型
-		GenDatasourceConfMapper datasourceConfMapper = SpringContextHolder.getBean(GenDatasourceConfMapper.class);
-		GenDatasourceConf datasourceConf = datasourceConfMapper
-			.selectOne(Wrappers.<GenDatasourceConf>lambdaQuery().eq(GenDatasourceConf::getName, dsName));
-
-		String dbConfType;
-		// 默认MYSQL 数据源
-		if (datasourceConf == null) {
-			dbConfType = DsJdbcUrlEnum.MYSQL.getDbName();
-		}
-		else {
-			dbConfType = datasourceConf.getDsType();
-		}
-		// 获取全部数据实现
-		ApplicationContext context = SpringContextHolder.getApplicationContext();
-		Map<String, GeneratorMapper> beansOfType = context.getBeansOfType(GeneratorMapper.class);
-
-		// 根据数据类型选择mapper
-		for (String key : beansOfType.keySet()) {
-			if (StrUtil.containsIgnoreCase(key, dbConfType)) {
-				return beansOfType.get(key);
-			}
-		}
-
-		throw new IllegalArgumentException("dsName 不合法: " + dsName);
-	}
-
-}

+ 0 - 21
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/GeneratorTypeEnum.java

@@ -1,21 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-@Getter
-@RequiredArgsConstructor
-public enum GeneratorTypeEnum {
-
-	/**
-	 * zip压缩包 0
-	 */
-	ZIP_DOWNLOAD("0"),
-	/**
-	 * 自定义目录 1
-	 */
-	CUSTOM_DIRECTORY("1");
-
-	private final String value;
-
-}

+ 0 - 35
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/NamingCaseTool.java

@@ -1,35 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import cn.hutool.core.text.NamingCase;
-
-/**
- * 命名规则处理,针对驼峰,下划线等处理
- *
- * @author LXQ
- * @date 2023/1/31
- */
-public class NamingCaseTool {
-
-	/**
-	 * 传入字段获取的get方法
-	 * @param in 字段名称
-	 * @return
-	 */
-	public static String getProperty(String in) {
-		return String.format("get%s", NamingCase.toPascalCase(in));
-	}
-
-	public static String setProperty(String in) {
-		return String.format("set%s", NamingCase.toPascalCase(in));
-	}
-
-	/**
-	 * 首字母大写
-	 * @param in 字段
-	 * @return 首字母大写
-	 */
-	public static String pascalCase(String in) {
-		return String.format(NamingCase.toPascalCase(in));
-	}
-
-}

+ 0 - 69
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/VelocityKit.java

@@ -1,69 +0,0 @@
-package com.kxs.codegen.biz.util;
-
-import cn.hutool.core.util.CharsetUtil;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.tools.generic.DateTool;
-import org.apache.velocity.tools.generic.MathTool;
-import org.springframework.stereotype.Service;
-
-import java.io.StringWriter;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Properties;
-
-/**
- * 模板引擎工具类
- *
- * @author LXQ
- * @date 2023/2/7
- */
-@Service
-public class VelocityKit {
-
-	/**
-	 * Velocity 模板渲染方法
-	 * @param template 模板
-	 * @param map 数据模型
-	 * @return 渲染结果
-	 */
-	public static String render(String template, Map<String, Object> map) {
-		// 设置velocity资源加载器
-		Properties prop = new Properties();
-		prop.put("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
-		Velocity.init(prop);
-
-		VelocityContext context = new VelocityContext(map);
-		// 函数库,使用 Lambda 表达式简化代码
-		Optional.of(new MathTool()).ifPresent(mt -> context.put("math", mt));
-		Optional.of(new DateTool()).ifPresent(dt -> context.put("dateTool", dt));
-		Optional.of(new DictTool()).ifPresent(dt -> context.put("dict", dt));
-		Optional.of(new NamingCaseTool()).ifPresent(nct -> context.put("str", nct));
-
-		// 渲染模板,使用 Lambda 表达式简化代码
-		StringWriter sw = new StringWriter();
-		Optional.ofNullable(Velocity.getTemplate(template, CharsetUtil.UTF_8)).ifPresent(tpl -> tpl.merge(context, sw));
-		return sw.toString();
-	}
-
-	/**
-	 * 渲染文本
-	 * @param str
-	 * @param dataModel 数据
-	 * @return
-	 */
-	public static String renderStr(String str, Map<String, Object> dataModel) {
-		// 设置velocity资源加载器
-		Velocity.init();
-		StringWriter stringWriter = new StringWriter();
-		VelocityContext context = new VelocityContext(dataModel);
-		// 函数库
-		context.put("math", new MathTool());
-		context.put("dateTool", new DateTool());
-		context.put("dict", new DictTool());
-		context.put("str", new NamingCaseTool());
-		Velocity.evaluate(context, stringWriter, "renderStr", str);
-		return stringWriter.toString();
-	}
-
-}

+ 0 - 45
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/GroupVo.java

@@ -1,45 +0,0 @@
-package com.kxs.codegen.biz.util.vo;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.kxs.codegen.biz.entity.GenTemplateEntity;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class GroupVo {
-
-	/**
-	 * id
-	 */
-	@TableId(type = IdType.ASSIGN_ID)
-	@Schema(description = "id")
-	private Long id;
-
-	/**
-	 * 分组名称
-	 */
-	@Schema(description = "分组名称")
-	private String groupName;
-
-	/**
-	 * 分组描述
-	 */
-	@Schema(description = "分组描述")
-	private String groupDesc;
-
-	/**
-	 * 模板ids
-	 */
-	@Schema(description = "拥有的模板列表")
-	private Long[] templateId;
-
-	/**
-	 * 模板列表
-	 */
-	@Schema(description = "拥有的模板列表")
-	private List<GenTemplateEntity> templateList;
-
-}

+ 0 - 22
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/SqlDto.java

@@ -1,22 +0,0 @@
-package com.kxs.codegen.biz.util.vo;
-
-import lombok.Data;
-
-/**
- * @author LXQ
- * @date 2022/5/2
- */
-@Data
-public class SqlDto {
-
-	/**
-	 * 数据源ID
-	 */
-	private String dsName;
-
-	/**
-	 * sql脚本
-	 */
-	private String sql;
-
-}

+ 0 - 21
kxs-codegen/src/main/java/com/kxs/codegen/biz/util/vo/TemplateGroupDTO.java

@@ -1,21 +0,0 @@
-package com.kxs.codegen.biz.util.vo;
-
-import com.kxs.codegen.biz.entity.GenGroupEntity;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.List;
-
-@Data
-@Schema(description = "模板传输对象")
-@EqualsAndHashCode(callSuper = true)
-public class TemplateGroupDTO extends GenGroupEntity {
-
-	/**
-	 * 模板id集合
-	 */
-	@Schema(description = "模板id集合")
-	private List<Long> templateId;
-
-}

+ 0 - 51
kxs-codegen/src/main/resources/application.yml

@@ -1,51 +0,0 @@
-server:
-  port: 4002
-
-spring:
-  profiles:
-    active: dev
-  application:
-    name: kxs-codegen
-  cache:
-    type: REDIS
-    redis:
-      time-to-live: 1h # 设置过期时间为 1 小时
-  data:
-    redis:
-      host: localhost
-      repositories:
-        enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度\
-  datasource:
-    type: com.zaxxer.hikari.HikariDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    username: root
-    password: root
-    url: jdbc:mysql://localhost:3306/kxs_codeGen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
-
-  # Servlet 配置
-  servlet:
-    # 文件上传相关配置项
-    multipart:
-      max-file-size: 16MB # 单个文件大小
-      max-request-size: 32MB # 设置总上传的文件大小
-
-
-
-
-# mybaits-plus配置
-mybatis-plus:
-  mapper-locations: classpath*:/mapper/*.xml
-  global-config:
-    banner: false # 关闭控制台的 Banner 打印
-    db-config:
-      id-type: auto
-      table-underline: true
-      logic-delete-value: 1  # 逻辑已删除值(默认为 1)
-      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
-  type-handlers-package: com.kxs.common.mybatis.handler
-  configuration:
-    map-underscore-to-camel-case: true
-    shrink-whitespaces-in-sql: true
-
-
-

+ 0 - 88
kxs-codegen/src/main/resources/logback-spring.xml

@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~    Copyright (c) 2021-2025, LXQ All rights reserved.
-  ~
-  ~ Redistribution and use in source and binary forms, with or without
-  ~ modification, are permitted provided that the following conditions are met:
-  ~
-  ~ Redistributions of source code must retain the above copyright notice,
-  ~ this list of conditions and the following disclaimer.
-  ~ Redistributions in binary form must reproduce the above copyright
-  ~ notice, this list of conditions and the following disclaimer in the
-  ~ documentation and/or other materials provided with the distribution.
-  ~ Neither the name of the com developer nor the names of its
-  ~ contributors may be used to endorse or promote products derived from
-  ~ this software without specific prior written permission.
-  ~ Author: LXQ (609827073@qq.com)
-  -->
-
-<!--
-    小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
-    <properties>
-        <log-path>/Users/lxq</log-path>
-    </properties>
-    1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
-    2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
--->
-<configuration debug="false" scan="false">
-	<property name="log.path" value="logs/${project.artifactId}"/>
-	<!-- 彩色日志格式 -->
-	<property name="CONSOLE_LOG_PATTERN"
-			  value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
-	<!-- 彩色日志依赖的渲染类 -->
-	<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
-	<conversionRule conversionWord="wex"
-					converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
-	<conversionRule conversionWord="wEx"
-					converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
-	<!-- Console log output -->
-	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-		<encoder>
-			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
-		</encoder>
-	</appender>
-
-	<!-- Log file debug output -->
-	<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
-		<file>${log.path}/debug.log</file>
-		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
-			<maxFileSize>50MB</maxFileSize>
-			<maxHistory>30</maxHistory>
-		</rollingPolicy>
-		<encoder>
-			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
-		</encoder>
-	</appender>
-
-	<!-- Log file error output -->
-	<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
-		<file>${log.path}/error.log</file>
-		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
-			<maxFileSize>50MB</maxFileSize>
-			<maxHistory>30</maxHistory>
-		</rollingPolicy>
-		<encoder>
-			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
-		</encoder>
-		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-			<level>ERROR</level>
-		</filter>
-	</appender>
-
-	<logger name="org.activiti.engine.impl.db" level="DEBUG">
-		<appender-ref ref="debug"/>
-	</logger>
-
-	<!--nacos 心跳 INFO 屏蔽-->
-	<logger name="com.alibaba.nacos" level="OFF">
-		<appender-ref ref="error"/>
-	</logger>
-	<!-- Level: FATAL 0  ERROR 3  WARN 4  INFO 6  DEBUG 7 -->
-	<root level="INFO">
-		<appender-ref ref="console"/>
-		<appender-ref ref="debug"/>
-		<appender-ref ref="error"/>
-	</root>
-</configuration>

+ 0 - 41
kxs-codegen/src/main/resources/mapper/GenFieldTypeMapper.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~
-  ~      Copyright (c) 2021-2025, LXQ All rights reserved.
-  ~
-  ~  Redistribution and use in source and binary forms, with or without
-  ~  modification, are permitted provided that the following conditions are met:
-  ~
-  ~ Redistributions of source code must retain the above copyright notice,
-  ~  this list of conditions and the following disclaimer.
-  ~  Redistributions in binary form must reproduce the above copyright
-  ~  notice, this list of conditions and the following disclaimer in the
-  ~  documentation and/or other materials provided with the distribution.
-  ~  Neither the name of the com developer nor the names of its
-  ~  contributors may be used to endorse or promote products derived from
-  ~  this software without specific prior written permission.
-  ~  Author: LXQ (609827073@qq.com)
-  ~
-  -->
-
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GenFieldTypeMapper">
-
-    <resultMap id="fieldTypeMap" type="com.kxs.codegen.biz.entity.GenFieldType">
-        <id property="id" column="id"/>
-        <result property="columnType" column="column_type"/>
-        <result property="attrType" column="attr_type"/>
-        <result property="packageName" column="package_name"/>
-        <result property="createTime" column="create_time"/>
-    </resultMap>
-
-    <select id="getPackageByTableId" resultType="String">
-        select t1.package_name
-        from gen_field_type t1,
-        gen_table_column t2
-        where t1.attr_type = t2.attr_type
-        and t2.ds_name = #{dsName} and t2.table_name = #{tableName}
-    </select>
-</mapper>

+ 0 - 26
kxs-codegen/src/main/resources/mapper/GenGroupMapper.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GenGroupMapper">
-
-  <resultMap id="genGroupMap" type="com.kxs.codegen.biz.util.vo.GroupVo">
-        <id property="id" column="group_id"/>
-        <result property="groupName" column="group_name"/>
-        <result property="groupDesc" column="group_desc"/>
-	    <collection property="templateList" ofType="com.kxs.codegen.biz.entity.GenTemplateEntity"
-                    select="com.kxs.codegen.biz.mapper.GenTemplateMapper.listTemplateById" column="group_id">
-	    </collection>
-  </resultMap>
-
-	<select id="getGroupVoById" resultMap="genGroupMap">
-	    SELECT
-        g.id as group_id ,
-        g.group_name ,
-        g.group_desc
-		FROM
-		gen_group g
-		WHERE g.id = #{id}
-
-	</select>
-
-</mapper>

+ 0 - 45
kxs-codegen/src/main/resources/mapper/GenTableMapper.xml

@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~
-  ~      Copyright (c) 2021-2025, LXQ All rights reserved.
-  ~
-  ~  Redistribution and use in source and binary forms, with or without
-  ~  modification, are permitted provided that the following conditions are met:
-  ~
-  ~ Redistributions of source code must retain the above copyright notice,
-  ~  this list of conditions and the following disclaimer.
-  ~  Redistributions in binary form must reproduce the above copyright
-  ~  notice, this list of conditions and the following disclaimer in the
-  ~  documentation and/or other materials provided with the distribution.
-  ~  Neither the name of the com developer nor the names of its
-  ~  contributors may be used to endorse or promote products derived from
-  ~  this software without specific prior written permission.
-  ~  Author: LXQ (609827073@qq.com)
-  ~
-  -->
-
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GenTableMapper">
-
-  <resultMap id="tableMap" type="com.kxs.codegen.biz.entity.GenTable">
-        <id property="id" column="id"/>
-        <result property="tableName" column="table_name"/>
-        <result property="className" column="class_name"/>
-        <result property="tableComment" column="table_comment"/>
-        <result property="author" column="author"/>
-        <result property="email" column="email"/>
-        <result property="packageName" column="package_name"/>
-        <result property="version" column="version"/>
-        <result property="generatorType" column="generator_type"/>
-        <result property="backendPath" column="backend_path"/>
-        <result property="frontendPath" column="frontend_path"/>
-        <result property="moduleName" column="module_name"/>
-        <result property="functionName" column="function_name"/>
-        <result property="formLayout" column="form_layout"/>
-        <result property="datasourceId" column="datasource_id"/>
-        <result property="baseclassId" column="baseclass_id"/>
-        <result property="createTime" column="create_time"/>
-  </resultMap>
-</mapper>

+ 0 - 10
kxs-codegen/src/main/resources/mapper/GenTemplateGroupMapper.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GenTemplateGroupMapper">
-
-  <resultMap id="genTemplateGroupMap" type="com.kxs.codegen.biz.entity.GenTemplateGroupEntity">
-        <id property="groupId" column="group_id"/>
-        <id property="templateId" column="template_id"/>
-  </resultMap>
-</mapper>

+ 0 - 22
kxs-codegen/src/main/resources/mapper/GenTemplateMapper.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GenTemplateMapper">
-
-  <resultMap id="genTemplateMap" type="com.kxs.codegen.biz.entity.GenTemplateEntity">
-        <id property="id" column="id"/>
-        <result property="templateName" column="template_name"/>
-        <result property="generatorPath" column="generator_path"/>
-        <result property="templateDesc" column="template_desc"/>
-	  <result property="templateCode" column="template_code"/>
-  </resultMap>
-	<select id="listTemplateById" resultType="com.kxs.codegen.biz.entity.GenTemplateEntity">
-		SELECT
-		     t.id as id,t.template_name,t.generator_path,t.template_desc,t.template_code
-		FROM gen_template t ,
-			 gen_template_group tg
-		WHERE t.id = tg.template_id
-		  AND t.del_flag = '0'
-		  and tg.group_id = #{groupId}
-	</select>
-</mapper>

+ 0 - 48
kxs-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml

@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.kxs.codegen.biz.mapper.GeneratorMysqlMapper">
-
-	<select id="queryTable" resultType="map">
-		SELECT
-			'mysql' AS dbType,
-			table_name AS tableName,
-			ENGINE,
-			table_comment AS tableComment,
-			create_time AS createTime
-		FROM
-			information_schema.TABLES
-		WHERE
-			table_schema = (
-			SELECT DATABASE
-			())
-			<if test="tableName != null and tableName.trim() != ''">
-				and table_name = #{tableName}
-			</if>
-			order by create_time desc
-	</select>
-
-	<sql id="queryColumn">
-		SELECT
-			column_name columnName,
-			data_type dataType,
-			column_comment comments,
-			column_key columnKey,
-			extra,
-			is_nullable AS isNullable,
-			column_type AS columnType
-		FROM
-			information_schema.COLUMNS
-		WHERE
-			table_name = #{tableName} and table_schema = (select database()) order by ordinal_position
-	</sql>
-
-	<select id="selectTableColumn" resultType="com.kxs.codegen.biz.entity.ColumnEntity">
-		<include refid="queryColumn"/>
-	</select>
-
-	<select id="selectMapTableColumn" resultType="map">
-		<include refid="queryColumn"/>
-	</select>
-
-</mapper>

+ 0 - 12
kxs-codegen/src/main/resources/template/config.json

@@ -1,12 +0,0 @@
-{
-  "project": {
-    "packageName": "com.kxs",
-    "version": "1.0.0",
-    "backendPath": "kxs",
-    "frontendPath": "kxs-admin-ui"
-  },
-  "developer": {
-    "author": "kxs",
-    "email": "609827073@qq.com"
-  }
-}

+ 0 - 4
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/config/JacksonConfiguration.java

@@ -3,7 +3,6 @@ package com.kxs.common.core.config;
 import cn.hutool.core.date.DatePattern;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import com.kxs.common.core.jackson.SkyJavaTimeModule;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -12,11 +11,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
 import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
 import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
 import org.springframework.context.annotation.Bean;
-import org.springframework.core.convert.converter.Converter;
 
-import java.time.LocalDateTime;
 import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
 import java.util.Locale;
 import java.util.TimeZone;
 

+ 4 - 2
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/CommonConstants.java

@@ -57,12 +57,12 @@ public interface CommonConstants {
 	/**
 	 * 成功标记
 	 */
-	Integer SUCCESS = 0;
+	Integer SUCCESS = 1;
 
 	/**
 	 * 失败标记
 	 */
-	Integer FAIL = 1;
+	Integer FAIL = 0;
 
 	/**
 	 * 当前页
@@ -79,4 +79,6 @@ public interface CommonConstants {
 	 */
 	String REQUEST_START_TIME = "REQUEST-START-TIME";
 
+	String KXS_USER_NUMBER_PREFIX = "K";
+
 }

+ 38 - 0
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/enums/UserStatusEnum.java

@@ -0,0 +1,38 @@
+package com.kxs.common.core.constant.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * <p>
+ * 社交登录类型
+ *
+ * @author 没秃顶的码农
+ * @date 2023/10/27
+ */
+@Getter
+@RequiredArgsConstructor
+public enum UserStatusEnum {
+
+	/**
+	 * 账号密码登录
+	 */
+	REMOVE(0, "注销"),
+	NORMAL(1, "正常"),
+
+	/**
+	 * 验证码登录
+	 */
+	LOCKED(2, "锁定");
+
+	/**
+	 * 类型
+	 */
+	private final Integer code;
+
+	/**
+	 * 描述
+	 */
+	private final String description;
+
+}

+ 1 - 2
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/exception/GlobalBizExceptionHandler.java

@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
-import java.nio.file.AccessDeniedException;
 import java.util.List;
 
 /**
@@ -85,7 +84,7 @@ public class GlobalBizExceptionHandler {
 
 	/**
 	 * validation Exception
-	 * @param exception
+	 * @param exception e
 	 * @return R
 	 */
 	@ExceptionHandler({ MethodArgumentNotValidException.class })

+ 1 - 1
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/jackson/SkyJavaTimeModule.java

@@ -19,7 +19,7 @@ import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 
 /**
- * java 8 时间默认序列化
+ * 时间默认序列化
  *
  * @author 没秃顶的码农
  * @date 2023/11/08

+ 2 - 2
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/R.java

@@ -26,7 +26,7 @@ public class R<T> implements Serializable {
 
 	@Getter
 	@Setter
-	private int code;
+	private int status;
 
 	@Getter
 	@Setter
@@ -70,7 +70,7 @@ public class R<T> implements Serializable {
 
 	public static <T> R<T> restResult(T data, int code, String msg) {
 		R<T> apiResult = new R<>();
-		apiResult.setCode(code);
+		apiResult.setStatus(code);
 		apiResult.setData(data);
 		apiResult.setMsg(msg);
 		return apiResult;

+ 6 - 6
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/RetOps.java

@@ -37,7 +37,7 @@ import java.util.function.Predicate;
 public class RetOps<T> {
 
 	/** 状态码为成功 */
-	public static final Predicate<R<?>> CODE_SUCCESS = r -> CommonConstants.SUCCESS == r.getCode();
+	public static final Predicate<R<?>> CODE_SUCCESS = r -> CommonConstants.SUCCESS == r.getStatus();
 
 	/** 数据有值 */
 	public static final Predicate<R<?>> HAS_DATA = r -> ObjectUtil.isNotEmpty(r.getData());
@@ -77,7 +77,7 @@ public class RetOps<T> {
 	 * @return 返回code的值
 	 */
 	public int getCode() {
-		return original.getCode();
+		return original.getStatus();
 	}
 
 	/**
@@ -111,7 +111,7 @@ public class RetOps<T> {
 	 * @return 返回ture表示相等
 	 */
 	public boolean codeEquals(int value) {
-		return original.getCode() == value;
+		return original.getStatus() == value;
 	}
 
 	/**
@@ -205,7 +205,7 @@ public class RetOps<T> {
 	 * @return 返回新实例,以便于继续进行链式操作
 	 */
 	public <U> RetOps<U> map(Function<? super T, ? extends U> mapper) {
-		R<U> result = R.restResult(mapper.apply(original.getData()), original.getCode(), original.getMsg());
+		R<U> result = R.restResult(mapper.apply(original.getData()), original.getStatus(), original.getMsg());
 		return of(result);
 	}
 
@@ -221,7 +221,7 @@ public class RetOps<T> {
 	 * @see RetOps#DATA_AVAILABLE
 	 */
 	public <U> RetOps<U> mapIf(Predicate<? super R<T>> predicate, Function<? super T, ? extends U> mapper) {
-		R<U> result = R.restResult(mapper.apply(original.getData()), original.getCode(), original.getMsg());
+		R<U> result = R.restResult(mapper.apply(original.getData()), original.getStatus(), original.getMsg());
 		return of(result);
 	}
 
@@ -242,7 +242,7 @@ public class RetOps<T> {
 	 * @param codes 错误代码集合,匹配任意一个则调用消费函数
 	 */
 	public void useDataOnCode(Consumer<? super T> consumer, int... codes) {
-		useDataIf(o -> Arrays.stream(codes).filter(c -> original.getCode() == c).findFirst().isPresent(), consumer);
+		useDataIf(o -> Arrays.stream(codes).filter(c -> original.getStatus() == c).findFirst().isPresent(), consumer);
 	}
 
 	/**

+ 5 - 6
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/SpringContextHolder.java

@@ -1,6 +1,7 @@
 
 package com.kxs.common.core.util;
 
+import lombok.Getter;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.DisposableBean;
@@ -21,14 +22,12 @@ import org.springframework.stereotype.Service;
 @Lazy(false)
 public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
 
-	private static ApplicationContext applicationContext = null;
-
 	/**
-	 * 取得存储在静态变量中的ApplicationContext.
+	 * -- GETTER --
+	 *  取得存储在静态变量中的ApplicationContext.
 	 */
-	public static ApplicationContext getApplicationContext() {
-		return applicationContext;
-	}
+	@Getter
+	private static ApplicationContext applicationContext = null;
 
 	/**
 	 * 实现ApplicationContextAware接口, 注入Context到静态变量中.

+ 0 - 2
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/util/WebUtils.java

@@ -33,8 +33,6 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 
 	private final String BASIC_ = "Basic ";
 
-	private final String UNKNOWN = "unknown";
-
 	/**
 	 * 判断是否ajax请求 spring ajax 返回含有 ResponseBody 或者 RestController注解
 	 * @param handlerMethod HandlerMethod

+ 1 - 0
kxs-common/kxs-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -4,3 +4,4 @@ com.kxs.common.core.config.RestTemplateConfiguration
 com.kxs.common.core.util.SpringContextHolder
 com.kxs.common.core.config.WebMvcConfiguration
 com.kxs.common.core.config.JacksonConfiguration
+com.kxs.common.core.exception.GlobalBizExceptionHandler

+ 0 - 36
kxs-common/kxs-common-datasource/pom.xml

@@ -1,36 +0,0 @@
-<?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>
-        <groupId>com.kxs</groupId>
-        <artifactId>kxs-common</artifactId>
-        <version>1.1.0</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>com.kxs</groupId>
-    <artifactId>kxs-common-datasource</artifactId>
-
-    <packaging>jar</packaging>
-
-    <description>kxs 动态切换数据源</description>
-
-    <dependencies>
-        <!--mybatis-->
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>jakarta.servlet</groupId>
-            <artifactId>jakarta.servlet-api</artifactId>
-        </dependency>
-        <!--配置文件加解密-->
-        <dependency>
-            <groupId>com.github.ulisesbocchio</groupId>
-            <artifactId>jasypt-spring-boot-starter</artifactId>
-            <version>3.0.5</version>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 91
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/DynamicDataSourceAutoConfiguration.java

@@ -1,91 +0,0 @@
-package com.kxs.common.datasource;
-
-import com.baomidou.dynamic.datasource.creator.DataSourceCreator;
-import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
-import com.baomidou.dynamic.datasource.creator.hikaricp.HikariDataSourceCreator;
-import com.baomidou.dynamic.datasource.processor.DsJakartaHeaderProcessor;
-import com.baomidou.dynamic.datasource.processor.DsJakartaSessionProcessor;
-import com.baomidou.dynamic.datasource.processor.DsProcessor;
-import com.baomidou.dynamic.datasource.processor.DsSpelExpressionProcessor;
-import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
-import com.kxs.common.datasource.config.ClearTtlDataSourceFilter;
-import com.kxs.common.datasource.config.DataSourceProperties;
-import com.kxs.common.datasource.config.JdbcDynamicDataSourceProvider;
-import com.kxs.common.datasource.config.LastParamDsProcessor;
-import org.jasypt.encryption.StringEncryptor;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.expression.BeanFactoryResolver;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author LXQ
- * @date 2021-02-06
- * <p>
- * 动态数据源切换配置
- */
-@Configuration(proxyBeanMethods = false)
-@AutoConfigureAfter(DataSourceAutoConfiguration.class)
-@EnableConfigurationProperties(DataSourceProperties.class)
-public class DynamicDataSourceAutoConfiguration {
-
-	/**
-	 * 动态数据源提供者
-	 * @param defaultDataSourceCreator 默认数据源创建器
-	 * @param stringEncryptor 字符串加密器
-	 * @param properties 数据源配置属性
-	 * @return 动态数据源提供者
-	 */
-	@Bean
-	public DynamicDataSourceProvider dynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator,
-			StringEncryptor stringEncryptor, DataSourceProperties properties) {
-		return new JdbcDynamicDataSourceProvider(defaultDataSourceCreator, stringEncryptor, properties);
-	}
-
-	/**
-	 * 获取数据源处理器
-	 * @return 数据源处理器
-	 */
-	@Bean
-	public DsProcessor dsProcessor(BeanFactory beanFactory) {
-		DsProcessor lastParamDsProcessor = new LastParamDsProcessor();
-		DsProcessor headerProcessor = new DsJakartaHeaderProcessor();
-		DsProcessor sessionProcessor = new DsJakartaSessionProcessor();
-		DsSpelExpressionProcessor spelExpressionProcessor = new DsSpelExpressionProcessor();
-		spelExpressionProcessor.setBeanResolver(new BeanFactoryResolver(beanFactory));
-		lastParamDsProcessor.setNextProcessor(headerProcessor);
-		headerProcessor.setNextProcessor(sessionProcessor);
-		sessionProcessor.setNextProcessor(spelExpressionProcessor);
-		return lastParamDsProcessor;
-	}
-
-	/**
-	 * 默认数据源创建器
-	 * @param hikariDataSourceCreator Hikari数据源创建器
-	 * @return 默认数据源创建器
-	 */
-	@Bean
-	public DefaultDataSourceCreator defaultDataSourceCreator(HikariDataSourceCreator hikariDataSourceCreator) {
-		DefaultDataSourceCreator defaultDataSourceCreator = new DefaultDataSourceCreator();
-		List<DataSourceCreator> creators = new ArrayList<>();
-		creators.add(hikariDataSourceCreator);
-		defaultDataSourceCreator.setCreators(creators);
-		return defaultDataSourceCreator;
-	}
-
-	/**
-	 * 清除Ttl数据源过滤器
-	 * @return 清除Ttl数据源过滤器
-	 */
-	@Bean
-	public ClearTtlDataSourceFilter clearTtlDsFilter() {
-		return new ClearTtlDataSourceFilter();
-	}
-
-}

+ 0 - 21
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/annotation/EnableDynamicDataSource.java

@@ -1,21 +0,0 @@
-package com.kxs.common.datasource.annotation;
-
-import com.kxs.common.datasource.DynamicDataSourceAutoConfiguration;
-import org.springframework.context.annotation.Import;
-
-import java.lang.annotation.*;
-
-/**
- * @author Lucky
- * @date 2021-05-18
- * <p>
- * 开启动态数据源
- */
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@Import(DynamicDataSourceAutoConfiguration.class)
-public @interface EnableDynamicDataSource {
-
-}

+ 0 - 30
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/ClearTtlDataSourceFilter.java

@@ -1,30 +0,0 @@
-package com.kxs.common.datasource.config;
-
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import jakarta.servlet.*;
-import org.springframework.core.Ordered;
-
-import java.io.IOException;
-
-/**
- * @author LXQ
- * @date 2021/12/11
- * <p>
- * 清空上文的DS 设置避免污染当前线程
- */
-public class ClearTtlDataSourceFilter extends GenericFilter implements Ordered {
-
-	@Override
-	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
-			throws IOException, ServletException {
-		DynamicDataSourceContextHolder.clear();
-		filterChain.doFilter(servletRequest, servletResponse);
-		DynamicDataSourceContextHolder.clear();
-	}
-
-	@Override
-	public int getOrder() {
-		return Integer.MIN_VALUE;
-	}
-
-}

+ 0 - 40
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/DataSourceProperties.java

@@ -1,40 +0,0 @@
-package com.kxs.common.datasource.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * @author LXQ
- * @date 2021-05-14
- * <p>
- */
-@Data
-@ConfigurationProperties("spring.datasource")
-public class DataSourceProperties {
-
-	/**
-	 * 用户名
-	 */
-	private String username;
-
-	/**
-	 * 密码
-	 */
-	private String password;
-
-	/**
-	 * jdbcurl
-	 */
-	private String url;
-
-	/**
-	 * 驱动类型
-	 */
-	private String driverClassName;
-
-	/**
-	 * 查询数据源的SQL
-	 */
-	private String queryDsSql = "select * from gen_datasource_conf where del_flag = 0";
-
-}

+ 0 - 85
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/JdbcDynamicDataSourceProvider.java

@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2021 sky4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.kxs.common.datasource.config;
-
-import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
-import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
-import com.baomidou.dynamic.datasource.provider.AbstractJdbcDataSourceProvider;
-import com.kxs.common.datasource.support.DataSourceConstants;
-import org.jasypt.encryption.StringEncryptor;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author LXQ
- * @date 2021/2/6
- * <p>
- * 从数据源中获取 配置信息
- */
-public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvider {
-
-	private final DataSourceProperties properties;
-
-	private final StringEncryptor stringEncryptor;
-
-	public JdbcDynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator,
-			StringEncryptor stringEncryptor, DataSourceProperties properties) {
-		super(defaultDataSourceCreator, properties.getDriverClassName(), properties.getUrl(), properties.getUsername(),
-				properties.getPassword());
-		this.stringEncryptor = stringEncryptor;
-		this.properties = properties;
-	}
-
-	/**
-	 * 执行语句获得数据源参数
-	 * @param statement 语句
-	 * @return 数据源参数
-	 * @throws SQLException sql异常
-	 */
-	@Override
-	protected Map<String, DataSourceProperty> executeStmt(Statement statement) throws SQLException {
-		ResultSet rs = statement.executeQuery(properties.getQueryDsSql());
-
-		Map<String, DataSourceProperty> map = new HashMap<>(8);
-		while (rs.next()) {
-			String name = rs.getString(DataSourceConstants.DS_NAME);
-			String username = rs.getString(DataSourceConstants.DS_USER_NAME);
-			String password = rs.getString(DataSourceConstants.DS_USER_PWD);
-			String url = rs.getString(DataSourceConstants.DS_JDBC_URL);
-			DataSourceProperty property = new DataSourceProperty();
-			property.setUsername(username);
-			property.setLazy(true);
-			property.setPassword(stringEncryptor.decrypt(password));
-			property.setUrl(url);
-			map.put(name, property);
-		}
-
-		// 添加默认主数据源
-		DataSourceProperty property = new DataSourceProperty();
-		property.setUsername(properties.getUsername());
-		property.setPassword(properties.getPassword());
-		property.setUrl(properties.getUrl());
-		property.setLazy(true);
-		map.put(DataSourceConstants.DS_MASTER, property);
-		return map;
-	}
-
-}

+ 0 - 60
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/config/LastParamDsProcessor.java

@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2021 sky4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.kxs.common.datasource.config;
-
-import com.baomidou.dynamic.datasource.processor.DsProcessor;
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import org.aopalliance.intercept.MethodInvocation;
-
-/**
- * @author LXQ
- * @date 2021/2/6
- * <p>
- * 参数数据源解析 @DS("#last)
- */
-public class LastParamDsProcessor extends DsProcessor {
-
-	private static final String LAST_PREFIX = "#last";
-
-	/**
-	 * 抽象匹配条件 匹配才会走当前执行器否则走下一级执行器
-	 * @param key DS注解里的内容
-	 * @return 是否匹配
-	 */
-	@Override
-	public boolean matches(String key) {
-		if (key.startsWith(LAST_PREFIX)) {
-			// https://github.com/baomidou/dynamic-datasource-spring-boot-starter/issues/213
-			DynamicDataSourceContextHolder.clear();
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * 抽象最终决定数据源
-	 * @param invocation 方法执行信息
-	 * @param key DS注解里的内容
-	 * @return 数据源名称
-	 */
-	@Override
-	public String doDetermineDatasource(MethodInvocation invocation, String key) {
-		Object[] arguments = invocation.getArguments();
-		return String.valueOf(arguments[arguments.length - 1]);
-	}
-
-}

+ 0 - 30
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/enums/DsConfTypeEnum.java

@@ -1,30 +0,0 @@
-package com.kxs.common.datasource.enums;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * @author LXQ
- * @date 2021/12/11
- * <p>
- * 数据源配置类型
- */
-@Getter
-@AllArgsConstructor
-public enum DsConfTypeEnum {
-
-	/**
-	 * 主机链接
-	 */
-	HOST(0, "主机链接"),
-
-	/**
-	 * JDBC链接
-	 */
-	JDBC(1, "JDBC链接");
-
-	private final Integer type;
-
-	private final String description;
-
-}

+ 0 - 72
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/enums/DsJdbcUrlEnum.java

@@ -1,72 +0,0 @@
-package com.kxs.common.datasource.enums;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.Arrays;
-
-/**
- * @author LXQ
- * @date 2021/12/11
- * <p>
- * jdbc-url
- */
-@Getter
-@AllArgsConstructor
-public enum DsJdbcUrlEnum {
-
-	/**
-	 * mysql 数据库
-	 */
-	MYSQL("mysql",
-			"jdbc:mysql://%s:%s/%s?characterEncoding=utf8"
-					+ "&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true"
-					+ "&useLegacyDatetimeCode=false&allowMultiQueries=true&allowPublicKeyRetrieval=true",
-			"select 1", "mysql8 链接"),
-
-	/**
-	 * pg 数据库
-	 */
-	PG("pg", "jdbc:postgresql://%s:%s/%s", "select 1", "postgresql 链接"),
-
-	/**
-	 * SQL SERVER
-	 */
-	MSSQL("mssql", "jdbc:sqlserver://%s:%s;database=%s;characterEncoding=UTF-8", "select 1", "sqlserver 链接"),
-
-	/**
-	 * oracle
-	 */
-	ORACLE("oracle", "jdbc:oracle:thin:@%s:%s:%s", "select 1 from dual", "oracle 链接"),
-
-	/**
-	 * db2
-	 */
-	DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"),
-
-	/**
-	 * 达梦
-	 */
-	DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接"),
-
-	/**
-	 * pg 数据库
-	 */
-	HIGHGO("highgo", "jdbc:highgo://%s:%s/%s", "select 1", "highgo 链接");
-
-	private final String dbName;
-
-	private final String url;
-
-	private final String validationQuery;
-
-	private final String description;
-
-	public static DsJdbcUrlEnum get(String dsType) {
-		return Arrays.stream(DsJdbcUrlEnum.values())
-			.filter(dsJdbcUrlEnum -> dsType.equals(dsJdbcUrlEnum.getDbName()))
-			.findFirst()
-			.get();
-	}
-
-}

+ 0 - 57
kxs-common/kxs-common-datasource/src/main/java/com/kxs/common/datasource/support/DataSourceConstants.java

@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2021 sky4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.kxs.common.datasource.support;
-
-/**
- * @author LXQ
- * @date 2021-04-01
- * <p>
- * 数据源相关常量
- */
-public interface DataSourceConstants {
-
-	/**
-	 * 数据源名称
-	 */
-	String DS_NAME = "name";
-
-	/**
-	 * 默认数据源(master)
-	 */
-	String DS_MASTER = "master";
-
-	/**
-	 * jdbcurl
-	 */
-	String DS_JDBC_URL = "url";
-
-	/**
-	 * 用户名
-	 */
-	String DS_USER_NAME = "username";
-
-	/**
-	 * 密码
-	 */
-	String DS_USER_PWD = "password";
-
-	/**
-	 * 驱动包名称
-	 */
-	String DS_DRIVER_CLASS_NAME = "driver_class_name";
-
-}

+ 3 - 2
kxs-common/kxs-common-log/src/main/java/com/kxs/common/log/aspect/SysLogAspect.java

@@ -1,6 +1,7 @@
 
 package com.kxs.common.log.aspect;
 
+import cn.hutool.core.text.CharSequenceUtil;
 import cn.hutool.core.util.StrUtil;
 import com.kxs.common.core.util.SpringContextHolder;
 import com.kxs.common.log.event.SysLogEvent;
@@ -37,7 +38,7 @@ public class SysLogAspect {
 		String value = sysLog.value();
 		String expression = sysLog.expression();
 		// 当前表达式存在 SPEL,会覆盖 value 的值
-		if (StrUtil.isNotBlank(expression)) {
+		if (CharSequenceUtil.isNotBlank(expression)) {
 			// 解析SPEL
 			MethodSignature signature = (MethodSignature) point.getSignature();
 			EvaluationContext context = SysLogUtils.getContext(point.getArgs(), signature.getMethod());
@@ -53,7 +54,7 @@ public class SysLogAspect {
 		SysLogEventSource logVo = SysLogUtils.getSysLog();
 		logVo.setTitle(value);
 		// 获取请求body参数
-		if (StrUtil.isBlank(logVo.getParams())) {
+		if (CharSequenceUtil.isBlank(logVo.getParams())) {
 			logVo.setBody(point.getArgs());
 		}
 		// 发送异步日志事件

+ 3 - 3
kxs-common/kxs-common-log/src/main/java/com/kxs/common/log/event/SysLogListener.java

@@ -1,6 +1,6 @@
 package com.kxs.common.log.event;
 
-import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.text.CharSequenceUtil;
 import com.fasterxml.jackson.annotation.JsonFilter;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ser.FilterProvider;
@@ -33,7 +33,7 @@ import java.util.Objects;
 public class SysLogListener implements InitializingBean {
 
 	// new 一个 避免日志脱敏策略影响全局ObjectMapper
-	private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+	private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
 	private final RemoteLogService remoteLogService;
 
@@ -51,7 +51,7 @@ public class SysLogListener implements InitializingBean {
 		// json 格式刷参数放在异步中处理,提升性能
 		if (Objects.nonNull(source.getBody())) {
 			String params = OBJECT_MAPPER.writeValueAsString(source.getBody());
-			sysLog.setParams(StrUtil.subPre(params, logProperties.getMaxLength()));
+			sysLog.setParams(CharSequenceUtil.subPre(params, logProperties.getMaxLength()));
 		}
 		log.info("保存日志:{}", sysLog);
 		remoteLogService.saveLog(sysLog, SecurityConstants.FROM_IN);

+ 0 - 1
kxs-common/kxs-common-log/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -1,2 +1 @@
 com.kxs.common.log.LogAutoConfiguration
-com.kxs.system.api.feign.config.AdminFeignClientConfiguration

+ 4 - 0
kxs-common/kxs-common-security/pom.xml

@@ -57,5 +57,9 @@
             <groupId>com.kxs</groupId>
             <artifactId>kxs-common-log</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.kxs</groupId>
+            <artifactId>kxs-user-api</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 1 - 1
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/ResourceAuthExceptionEntryPoint.java

@@ -34,7 +34,7 @@ public class ResourceAuthExceptionEntryPoint implements AuthenticationEntryPoint
 		response.setCharacterEncoding(CommonConstants.UTF8);
 		response.setContentType(CommonConstants.CONTENT_TYPE);
 		R<String> result = new R<>();
-		result.setCode(CommonConstants.FAIL);
+		result.setStatus(CommonConstants.FAIL);
 		response.setStatus(HttpStatus.UNAUTHORIZED.value());
 		if (authException != null) {
 			result.setMsg("error");

+ 3 - 3
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/SkyCustomOpaqueTokenIntrospector.java

@@ -1,6 +1,6 @@
 package com.kxs.common.security.component;
 
-import com.kxs.common.security.model.KxsUser;
+import com.kxs.common.security.model.KxsSecurityUser;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.core.Authentication;
@@ -46,10 +46,10 @@ public class SkyCustomOpaqueTokenIntrospector implements OpaqueTokenIntrospector
 			Object principal = Objects.requireNonNull(oldAuthorization).getAttributes().get(Principal.class.getName());
 			Authentication authentication = (Authentication) principal;
 
-			return (KxsUser) authentication.getPrincipal();
+			return (KxsSecurityUser) authentication.getPrincipal();
 		}
 		catch (UsernameNotFoundException notFoundException) {
-			log.warn("用户不存在 {}", notFoundException.getLocalizedMessage());
+			log.warn("用户不存在 {}", notFoundException.getLocalizedMessage());
 			throw notFoundException;
 		}
 		catch (Exception ex) {

+ 2 - 1
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/SkySecurityInnerAspect.java

@@ -1,5 +1,6 @@
 package com.kxs.common.security.component;
 
+import cn.hutool.core.text.CharSequenceUtil;
 import cn.hutool.core.util.StrUtil;
 import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.common.core.exception.AccessDeniedBizException;
@@ -37,7 +38,7 @@ public class SkySecurityInnerAspect implements Ordered {
 			inner = AnnotationUtils.findAnnotation(clazz, Inner.class);
 		}
 		String header = request.getHeader(SecurityConstants.FROM);
-		if (inner.value() && !StrUtil.equals(SecurityConstants.FROM_IN, header)) {
+		if (inner.value() && !CharSequenceUtil.equals(SecurityConstants.FROM_IN, header)) {
 			log.warn("访问接口 {} 没有权限", point.getSignature().getName());
 			throw new AccessDeniedBizException("Access is denied");
 		}

+ 74 - 0
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/model/KxsSecurityUser.java

@@ -0,0 +1,74 @@
+package com.kxs.common.security.model;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Getter;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.SpringSecurityCoreVersion;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal;
+
+import java.io.Serial;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * kxs用户
+ *
+ * @author 没秃顶的码农
+ * @date 2023/10/28
+ */
+public class KxsSecurityUser extends User implements OAuth2AuthenticatedPrincipal {
+
+	@Serial
+	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
+
+	/**
+	 * 扩展属性,方便存放oauth 上下文相关信息
+	 */
+	private final Map<String, Object> attributes = new HashMap<>();
+
+	/**
+	 * 用户ID
+	 */
+	@Getter
+	@JsonSerialize(using = ToStringSerializer.class)
+	private final Long id;
+
+	/**
+	 * 手机号
+	 */
+	@Getter
+	private final String phone;
+
+	/**
+	 * 盐值
+	 */
+	@Getter
+	private final String salt;
+
+	public KxsSecurityUser(Long id, String username, String password, String phone, String salt, boolean enabled, boolean accountNonExpired,
+						   boolean credentialsNonExpired, boolean accountNonLocked,
+						   Collection<? extends GrantedAuthority> authorities) {
+		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
+		this.id = id;
+		this.phone = phone;
+		this.salt = salt;
+	}
+
+	/**
+	 * Get the OAuth 2.0 token attributes
+	 * @return the OAuth 2.0 token attributes
+	 */
+	@Override
+	public Map<String, Object> getAttributes() {
+		return this.attributes;
+	}
+
+	@Override
+	public String getName() {
+		return this.getUsername();
+	}
+
+}

+ 66 - 0
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsAppUserServiceImpl.java

@@ -0,0 +1,66 @@
+package com.kxs.common.security.service;
+
+
+import com.kxs.common.core.constant.SecurityConstants;
+import com.kxs.common.core.constant.enums.ErrorTypeEnum;
+import com.kxs.common.core.constant.enums.UserStatusEnum;
+import com.kxs.common.core.util.R;
+import com.kxs.common.core.util.RetOps;
+import com.kxs.common.security.model.KxsSecurityUser;
+import com.kxs.user.api.feign.RemoteKxsUserService;
+import com.kxs.user.api.model.KxsUser;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+/**
+ * 客小爽 app用户服务实现
+ *
+ * @author Lxq
+ * @date 2023-12-06
+ */
+@Slf4j
+@RequiredArgsConstructor
+public class KxsAppUserServiceImpl implements KxsUserDetailsService{
+
+    private final RemoteKxsUserService remoteKxsUserService;
+
+    @Override
+    @SneakyThrows
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+
+        R<KxsUser> result = remoteKxsUserService.loadUserByPhone(username, SecurityConstants.FROM_IN);
+        KxsUser custom = RetOps.of(result)
+                .getData()
+                .orElseThrow(() -> new UsernameNotFoundException(ErrorTypeEnum.BAD_CREDENTIALS.getDescription()));
+
+        if(custom.getStatus() == 0 ){
+            throw new UsernameNotFoundException(ErrorTypeEnum.BAD_CREDENTIALS.getDescription());
+        }
+        // 构造security用户
+        return new KxsSecurityUser(Long.valueOf(custom.getId()), custom.getPhone(), SecurityConstants.BCRYPT + custom.getPassword(), custom.getPhone(), custom.getSalt(), true, true,
+                true, !custom.getStatus().equals(UserStatusEnum.LOCKED.getCode()), AuthorityUtils.NO_AUTHORITIES);
+
+    }
+
+    /**
+     * 是否支持此客户端校验
+     * @param clientId 目标客户端
+     * @param grantType  授权类型
+     * @return true/false
+     */
+    @Override
+    public boolean support(String clientId, String grantType) {
+        return "kxs_app".equals(clientId);
+    }
+
+    @Override
+    public int getOrder() {
+        return Integer.MIN_VALUE + 1;
+    }
+
+
+}

+ 0 - 2
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsUserDetailsService.java

@@ -1,8 +1,6 @@
 package com.kxs.common.security.service;
 
-import com.kxs.common.security.model.KxsUser;
 import org.springframework.core.Ordered;
-import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 
 /**

+ 5 - 12
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/service/KxsUserDetailsServiceImpl.java

@@ -8,8 +8,7 @@ import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.common.core.constant.enums.ErrorTypeEnum;
 import com.kxs.common.core.util.R;
 import com.kxs.common.core.util.RetOps;
-import com.kxs.common.security.model.KxsUser;
-import com.kxs.system.api.dto.UserDTO;
+import com.kxs.common.security.model.KxsSecurityUser;
 import com.kxs.system.api.dto.UserInfo;
 import com.kxs.system.api.feign.RemoteUserService;
 import com.kxs.system.api.model.SysUser;
@@ -18,12 +17,10 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.cache.Cache;
 import org.springframework.cache.CacheManager;
-import org.springframework.context.annotation.Primary;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.AuthorityUtils;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.stereotype.Service;
 
 import java.util.*;
 
@@ -35,9 +32,7 @@ import java.util.*;
  * @author 没秃顶的码农 hccake
  */
 @Slf4j
-@Primary
 @RequiredArgsConstructor
-@Service
 public class KxsUserDetailsServiceImpl implements KxsUserDetailsService {
 
 	private final RemoteUserService remoteUserService;
@@ -54,12 +49,10 @@ public class KxsUserDetailsServiceImpl implements KxsUserDetailsService {
 	public UserDetails loadUserByUsername(String username) {
 		Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
 		if (cache != null && cache.get(username) != null) {
-			return (KxsUser) Objects.requireNonNull(cache.get(username)).get();
+			return (KxsSecurityUser) Objects.requireNonNull(cache.get(username)).get();
 		}
 
-		UserDTO userDTO = new UserDTO();
-		userDTO.setUsername(username);
-		R<UserInfo> result = remoteUserService.info(userDTO, SecurityConstants.FROM_IN);
+		R<UserInfo> result = remoteUserService.info(username, SecurityConstants.FROM_IN);
 
 		UserInfo info = RetOps.of(result)
 			.getData()
@@ -102,8 +95,8 @@ public class KxsUserDetailsServiceImpl implements KxsUserDetailsService {
 		SysUser user = info.getSysUser();
 
 		// 构造security用户
-		return new KxsUser(user.getUserId(), user.getUsername(), SecurityConstants.BCRYPT + user.getPassword(),
-				user.getPhone(), true, true, true, CharSequenceUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL),
+		return new KxsSecurityUser(user.getUserId(), user.getUsername(), SecurityConstants.BCRYPT + user.getPassword(),
+				user.getPhone(), null, true, true, true, CharSequenceUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL),
 				authorities);
 	}
 

+ 1 - 1
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java

@@ -17,7 +17,7 @@ import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
- * @author jumuning
+ * @author LXQ
  * @date 2022-06-02
  *
  * 自定义模式认证转换器

Some files were not shown because too many files changed in this diff