mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-04 20:36:24 +08:00
ref 脚手架删除代码生成模块, 调整遗漏包名和多余依赖
This commit is contained in:
@@ -1,32 +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>cn.bootx.platform</groupId>
|
||||
<artifactId>bootx-common-starters</artifactId>
|
||||
<version>1.3.6.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>common-starter-code-gen</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- 数据库 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-mybatis-plus</artifactId>
|
||||
</dependency>
|
||||
<!-- 模板引擎 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,19 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@ComponentScan
|
||||
@MapperScan(annotationClass = Mapper.class)
|
||||
@AutoConfiguration
|
||||
public class CodeGenAutoConfiguration {
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.code;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.BizException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 数据库字段类型与java类型映射
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/2/17
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CodeGenColumnTypeEnum {
|
||||
|
||||
TINYINT("tinyint", "Integer", "number"), SMALLINT("smallint", "Integer", "number"),
|
||||
MEDIUMINT("mediumint", "Integer", "number"), INT("int", "Integer", "number"),
|
||||
INTEGER("integer", "Integer", "number"), BIGINT("bigint", "Long", "string"), FLOAT("float", "Float", "number"),
|
||||
DOUBLE("double", "Double", "number"), DECIMAL("decimal", "BigDecimal", "number"), BIT("bit", "Boolean", "boolean"),
|
||||
CHAR("char", "String", "string"), VARCHAR("varchar", "String", "string"),
|
||||
VARBINARY("VARBINARY", "byte[]", "unknown"), TINYTEXT("tinytext", "String", "string"),
|
||||
TEXT("text", "String", "string"), MEDIUMTEXT("mediumtext", "String", "string"),
|
||||
LONGTEXT("longtext", "String", "string"), DATE("date", "LocalDate", "string"),
|
||||
DATETIME("datetime", "LocalDateTime", "string"), TIME("time", "LocalTime", "string"),
|
||||
TIMESTAMP("timestamp", "LocalDateTime", "string");
|
||||
|
||||
private final String columnType;
|
||||
|
||||
private final String javaType;
|
||||
|
||||
private final String tsType;
|
||||
|
||||
/**
|
||||
* 数据库类型转换成java类型
|
||||
*/
|
||||
public static String convertJavaType(String columnType) {
|
||||
return Arrays.stream(CodeGenColumnTypeEnum.values())
|
||||
.filter(e -> Objects.equals(columnType, e.getColumnType()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new BizException("不支持的数据库字段类型"))
|
||||
.getJavaType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库类型转换成TS类型
|
||||
*/
|
||||
public static String convertTsType(String columnType) {
|
||||
return Arrays.stream(CodeGenColumnTypeEnum.values())
|
||||
.filter(e -> Objects.equals(columnType, e.getColumnType()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new BizException("不支持的数据库字段类型"))
|
||||
.getTsType();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.code;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.BizException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 代码生成模板枚举
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/2/17
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CodeGenTemplateVmEnum {
|
||||
|
||||
ENTITY("entity", "codegen/template/java/entity.java.vm", ".java"),
|
||||
MAPPER("mapper", "codegen/template/java/mapper.java.vm", "Mapper.java"),
|
||||
MANAGER("manager", "codegen/template/java/manager.java.vm", "Manager.java"),
|
||||
SERVICE("service", "codegen/template/java/service.java.vm", "Service.java"),
|
||||
CONTROLLER("controller", "codegen/template/java/controller.java.vm", "Controller.java"),
|
||||
DTO("dto", "codegen/template/java/dto.java.vm", "Dto.java"),
|
||||
PARAM("param", "codegen/template/java/param.java.vm", "Param.java"),
|
||||
CONVERT("convert", "codegen/template/java/convert.java.vm", "Convert.java"),
|
||||
API_V3("api_v3", "codegen/template/vue3/api.ts.vm", ".api.ts"),
|
||||
LIST_V3("list_v3", "codegen/template/vue3/list.vue.vm", "List.vue"),
|
||||
EDIT_V3("edit_v3", "codegen/template/vue3/edit.vue.vm", "Edit.vue");
|
||||
|
||||
/** 名称 */
|
||||
private final String name;
|
||||
|
||||
/** 模板地址 */
|
||||
private final String path;
|
||||
|
||||
/** 文件名 */
|
||||
private final String fileSuffixName;
|
||||
|
||||
public static CodeGenTemplateVmEnum findByName(String name) {
|
||||
return Arrays.stream(CodeGenTemplateVmEnum.values())
|
||||
.filter(e -> Objects.equals(name, e.getName()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new BizException("不支持的模板类型"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.controller;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.bootx.platform.starter.code.gen.dto.CodeGenPreview;
|
||||
import cn.bootx.platform.starter.code.gen.param.CodeGenParam;
|
||||
import cn.bootx.platform.starter.code.gen.service.CodeGeneratorService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/2/17
|
||||
*/
|
||||
@Tag(name = "代码生成")
|
||||
@RestController
|
||||
@RequestMapping("/gen/code")
|
||||
@RequiredArgsConstructor
|
||||
public class CodeGeneratorController {
|
||||
|
||||
private final CodeGeneratorService generatorService;
|
||||
|
||||
@Operation(summary = "预览生成代码")
|
||||
@PostMapping("/codeGenPreview")
|
||||
public ResResult<List<CodeGenPreview>> codeGenPreview(@RequestBody CodeGenParam param) {
|
||||
return Res.ok(generatorService.codeGenPreview(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "下载生成代码")
|
||||
@PostMapping("/genCodeZip")
|
||||
public ResponseEntity<byte[]> genCodeZip(@RequestBody CodeGenParam param) {
|
||||
return generatorService.genCodeZip(param);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.controller;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.PageResult;
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.starter.code.gen.dto.TableGenParamDto;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseColumn;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseTable;
|
||||
import cn.bootx.platform.starter.code.gen.service.DatabaseTableService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Tag(name = "数据库表信息")
|
||||
@RestController
|
||||
@RequestMapping("/gen/table")
|
||||
@RequiredArgsConstructor
|
||||
public class DatabaseTableController {
|
||||
|
||||
private final DatabaseTableService databaseTableService;
|
||||
|
||||
@Operation(summary = "表列表")
|
||||
@GetMapping("/findAll")
|
||||
public ResResult<List<DatabaseTable>> findAll() {
|
||||
return Res.ok(databaseTableService.findAll());
|
||||
}
|
||||
|
||||
@Operation(summary = "表列表分页")
|
||||
@GetMapping("/page")
|
||||
public ResResult<PageResult<DatabaseTable>> page(@ParameterObject PageParam pageParam,
|
||||
@ParameterObject DatabaseTable param,
|
||||
@ParameterObject String dataSourceCode)
|
||||
{
|
||||
return Res.ok(databaseTableService.page(pageParam, param,dataSourceCode));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取表信息")
|
||||
@GetMapping("/findByTableName")
|
||||
public ResResult<DatabaseTable> findByTableName(String tableName) {
|
||||
return Res.ok(databaseTableService.findByTableName(tableName));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取数据表行信息")
|
||||
@GetMapping("/findColumnByTableName")
|
||||
public ResResult<List<DatabaseColumn>> findColumnByTableName(String tableName) {
|
||||
return Res.ok(databaseTableService.findColumnByTableName(tableName));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取表相关的代码生成参数信息")
|
||||
@GetMapping("/getTableGenParam")
|
||||
public ResResult<TableGenParamDto> getTableGenParam(String dataSourceCode, String tableName) {
|
||||
return Res.ok(databaseTableService.getTableGenParam(dataSourceCode,tableName));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.dao;
|
||||
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseColumn;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseTable;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 表信息查询
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface DatabaseTableMapper {
|
||||
|
||||
/**
|
||||
* 查询表信息 列表
|
||||
*/
|
||||
@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables"
|
||||
+ " where table_schema = (select database()) ${ew.customSqlSegment}")
|
||||
List<DatabaseTable> findAll(@Param(Constants.WRAPPER) Wrapper<?> wrapper);
|
||||
|
||||
/**
|
||||
* 查询表信息 分页
|
||||
*/
|
||||
@Select("select * from (select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables"
|
||||
+ " where table_schema = (select database())) as t ${ew.customSqlSegment}")
|
||||
Page<DatabaseTable> page(Page<DatabaseTable> mpPage, @Param(Constants.WRAPPER) Wrapper<?> wrapper);
|
||||
|
||||
/**
|
||||
* 查询表信息 详情
|
||||
*/
|
||||
@Select("select table_name, engine, table_comment, create_time from information_schema.tables"
|
||||
+ " where table_schema = (select database()) and table_name = #{tableName}")
|
||||
Optional<DatabaseTable> findByTableName(@Param("tableName") String tableName);
|
||||
|
||||
/**
|
||||
* 查询表信息 详细结构
|
||||
*/
|
||||
@Select("select column_name, data_type, column_comment, column_key, extra from information_schema.columns"
|
||||
+ " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
|
||||
List<DatabaseColumn> findColumnByTableName(@Param("tableName") String tableName);
|
||||
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.domain;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代码生成所需的参数数据
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/8/1
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CodeGenData {
|
||||
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
|
||||
/** 小驼峰的实体名称 */
|
||||
private String entityLowName;
|
||||
|
||||
/** 大驼峰的实体名称 */
|
||||
private String entityUpName;
|
||||
|
||||
/** 中划线类型的实体名称 */
|
||||
private String entityDashName;
|
||||
|
||||
/** 基类 */
|
||||
private String baseClass;
|
||||
|
||||
/** 编辑窗类型 */
|
||||
private String editType;
|
||||
|
||||
/** 编辑窗类型 */
|
||||
private String deleteType;
|
||||
|
||||
/** 核心包名(service/entity/dao等所在的包) */
|
||||
private String corePack;
|
||||
|
||||
/** param参数类包名 */
|
||||
private String paramPack;
|
||||
|
||||
/** dto参数类包名 */
|
||||
private String dtoPack;
|
||||
|
||||
/** 控制器包名 */
|
||||
private String controllerPack;
|
||||
|
||||
/** 请求地址 */
|
||||
private String requestPath;
|
||||
|
||||
/** 前端接口文件所在目录 */
|
||||
private String vueApiPath;
|
||||
|
||||
/** 创建人 */
|
||||
private String author;
|
||||
|
||||
/** 创建时间 */
|
||||
private String datetime = DateUtil.formatDate(new Date());
|
||||
|
||||
/** 备注 */
|
||||
private String comments;
|
||||
|
||||
/** 行信息 */
|
||||
private List<CodeGenColumnData> columns;
|
||||
|
||||
/**
|
||||
* 行信息
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/8/1
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class CodeGenColumnData {
|
||||
|
||||
/** 列名称 */
|
||||
private String name;
|
||||
|
||||
/** 类型 */
|
||||
private String sqlType;
|
||||
|
||||
/** java类型 */
|
||||
private String javaType;
|
||||
|
||||
/** ts类型 */
|
||||
private String tsType;
|
||||
|
||||
/** 备注 */
|
||||
private String comments;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 代码预览
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/2/18
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "代码预览")
|
||||
public class CodeGenPreview {
|
||||
|
||||
@Schema(description = "代码名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "代码内容")
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 代码生成相关参数信息
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/8/2
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "代码生成相关参数信息")
|
||||
public class TableGenParamDto {
|
||||
|
||||
@Schema(description = "实体类名称(大驼峰)")
|
||||
private String entityName;
|
||||
|
||||
@Schema(description = "功能模块名称(全小写)")
|
||||
private String module;
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 代码生成配置
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/6/13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "代码生成配置")
|
||||
public class CodeGenConfig {
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 数据库行信息
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DatabaseColumn {
|
||||
|
||||
/** 行名称 */
|
||||
private String columnName;
|
||||
|
||||
/** 数据类型 */
|
||||
private String dataType;
|
||||
|
||||
/** 行描述 */
|
||||
private String columnComment;
|
||||
|
||||
/** 主键类型 */
|
||||
private String columnKey;
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 表信息
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@FieldNameConstants
|
||||
public class DatabaseTable {
|
||||
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
|
||||
/** 引擎类型 */
|
||||
private String engine;
|
||||
|
||||
/** 表表述 */
|
||||
private String tableComment;
|
||||
|
||||
/** 创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.param;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 代码生成参数
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/2/18
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "代码生成参数")
|
||||
public class CodeGenParam {
|
||||
|
||||
@Schema(description = "数据库源")
|
||||
private String dataSourceCode;
|
||||
|
||||
@Schema(description = "表名")
|
||||
private String tableName;
|
||||
|
||||
@Schema(description = "生成对象名称")
|
||||
private String entityName;
|
||||
|
||||
@Schema(description = "基于什么类型的基类")
|
||||
private String baseEntity;
|
||||
|
||||
@Schema(description = "编辑窗类型")
|
||||
private String editType;
|
||||
|
||||
@Schema(description = "编辑窗类型")
|
||||
private String deleteType;
|
||||
|
||||
@Schema(description = "vue版本")
|
||||
private String vueVersion;
|
||||
|
||||
@Schema(description = "core目录(service/entity/dao等所在的包)")
|
||||
private String corePack;
|
||||
|
||||
@Schema(description = "param参数类包名")
|
||||
private String paramPack;
|
||||
|
||||
@Schema(description = "dto参数类包名")
|
||||
private String dtoPack;
|
||||
|
||||
@Schema(description = "控制器包名")
|
||||
private String controllerPack;
|
||||
|
||||
@Schema(description = "请求地址")
|
||||
private String requestPath;
|
||||
|
||||
@Schema(description = "前端接口文件所在目录")
|
||||
private String vueApiPath;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String author;
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.service;
|
||||
|
||||
import cn.bootx.platform.common.core.code.CommonCode;
|
||||
import cn.bootx.platform.starter.code.gen.code.CodeGenColumnTypeEnum;
|
||||
import cn.bootx.platform.starter.code.gen.code.CodeGenTemplateVmEnum;
|
||||
import cn.bootx.platform.starter.code.gen.domain.CodeGenData;
|
||||
import cn.bootx.platform.starter.code.gen.domain.CodeGenData.CodeGenColumnData;
|
||||
import cn.bootx.platform.starter.code.gen.dto.CodeGenPreview;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseColumn;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseTable;
|
||||
import cn.bootx.platform.starter.code.gen.param.CodeGenParam;
|
||||
import cn.bootx.platform.starter.code.gen.util.CodeGenUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.text.NamingCase;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 代码生成模板
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CodeGeneratorService {
|
||||
|
||||
private final DatabaseTableService databaseTableService;
|
||||
|
||||
/** 生成实体类时要过滤掉的字段(继承自基类) */
|
||||
private final List<String> entityFilterFields = Arrays.asList(CommonCode.ID, CommonCode.CREATOR,
|
||||
CommonCode.CREATE_TIME, CommonCode.LAST_MODIFIER, CommonCode.LAST_MODIFIED_TIME, CommonCode.VERSION,
|
||||
CommonCode.DELETED);
|
||||
|
||||
// 初始化Velocity
|
||||
static {
|
||||
// 设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||
Velocity.init(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成实体类
|
||||
*/
|
||||
public List<CodeGenPreview> codeGenPreview(CodeGenParam codeGenParam) {
|
||||
// 获取生成代码所用的数据
|
||||
Map<String, Object> map = this.getCodeGenInfo(codeGenParam);
|
||||
// 遍历生成代码预览
|
||||
return Arrays.stream(CodeGenTemplateVmEnum.values())
|
||||
.filter(o -> filterVue(o, codeGenParam.getVueVersion()))
|
||||
.map(vmEnum -> {
|
||||
VelocityContext context = new VelocityContext(map);
|
||||
StringWriter sw = new StringWriter();
|
||||
Template template = Velocity.getTemplate(vmEnum.getPath(), CharsetUtil.UTF_8);
|
||||
template.merge(context, sw);
|
||||
return new CodeGenPreview().setName(vmEnum.getName()).setContent(sw.toString());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤vue文件
|
||||
*/
|
||||
private boolean filterVue(CodeGenTemplateVmEnum vmEnum, String vueVersion) {
|
||||
if (Objects.equals(vueVersion, "v3")) {
|
||||
// vue3时不生成vue2的代码
|
||||
return !StrUtil.endWith(vmEnum.getName(), "v2");
|
||||
}
|
||||
else {
|
||||
// vue2时不生成vue3的代码
|
||||
return !StrUtil.endWith(vmEnum.getName(), "v3");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生成代码所用的数据
|
||||
*/
|
||||
private Map<String, Object> getCodeGenInfo(CodeGenParam codeGenParam) {
|
||||
DatabaseTable databaseTable = databaseTableService.findByTableName(codeGenParam.getTableName());
|
||||
List<DatabaseColumn> databaseColumns = databaseTableService.findColumnByTableName(codeGenParam.getTableName());
|
||||
|
||||
// 数据库字段
|
||||
List<CodeGenColumnData> columns = databaseColumns.stream()
|
||||
.map(databaseColumn -> new CodeGenColumnData().setComments(databaseColumn.getColumnComment())
|
||||
.setJavaType(CodeGenColumnTypeEnum.convertJavaType(databaseColumn.getDataType()))
|
||||
.setTsType(CodeGenColumnTypeEnum.convertTsType(databaseColumn.getDataType()))
|
||||
.setName(NamingCase.toCamelCase(databaseColumn.getColumnName())))
|
||||
.filter(codeGenColumn -> !entityFilterFields.contains(codeGenColumn.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
CodeGenData codeGenData = new CodeGenData().setTableName(databaseTable.getTableName())
|
||||
.setEntityUpName(codeGenParam.getEntityName())
|
||||
.setEntityLowName(StrUtil.lowerFirst(codeGenParam.getEntityName()))
|
||||
.setEntityDashName(NamingCase.toKebabCase(codeGenParam.getEntityName()))
|
||||
.setBaseClass(codeGenParam.getBaseEntity())
|
||||
.setCorePack(codeGenParam.getCorePack())
|
||||
.setEditType(codeGenParam.getEditType())
|
||||
.setDeleteType(codeGenParam.getDeleteType())
|
||||
.setParamPack(codeGenParam.getParamPack())
|
||||
.setDtoPack(codeGenParam.getDtoPack())
|
||||
.setControllerPack(codeGenParam.getControllerPack())
|
||||
.setRequestPath(codeGenParam.getRequestPath())
|
||||
.setVueApiPath(codeGenParam.getVueApiPath())
|
||||
.setAuthor(codeGenParam.getAuthor())
|
||||
.setComments(databaseTable.getTableComment())
|
||||
.setColumns(columns);
|
||||
|
||||
return BeanUtil.beanToMap(codeGenData, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码文件压缩包
|
||||
*/
|
||||
@SneakyThrows
|
||||
@DS("#codeGenParam.getDataSourceCode()")
|
||||
public ResponseEntity<byte[]> genCodeZip(CodeGenParam codeGenParam) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
// 将代码放入压缩包内
|
||||
for (CodeGenPreview codeGenPreview : this.codeGenPreview(codeGenParam)) {
|
||||
// 添加到zip
|
||||
CodeGenTemplateVmEnum vmEnum = CodeGenTemplateVmEnum.findByName(codeGenPreview.getName());
|
||||
String fileName = codeGenParam.getEntityName() + vmEnum.getFileSuffixName();
|
||||
// js后缀特殊处理
|
||||
if (vmEnum.getFileSuffixName().equals(".js") || vmEnum.getFileSuffixName().equals(".ts")) {
|
||||
fileName = StrUtil.lowerFirst(CodeGenUtil.tableToJava(fileName));
|
||||
}
|
||||
zip.putNextEntry(new ZipEntry(fileName));
|
||||
IOUtils.write(codeGenPreview.getContent(), zip, CharsetUtil.UTF_8);
|
||||
zip.flush();
|
||||
zip.closeEntry();
|
||||
}
|
||||
IoUtil.close(zip);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
headers.setContentDispositionFormData("attachment", new String(
|
||||
(codeGenParam.getTableName() + ".zip").getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
|
||||
return new ResponseEntity<>(outputStream.toByteArray(), headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.rest.PageResult;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.starter.code.gen.dao.DatabaseTableMapper;
|
||||
import cn.bootx.platform.starter.code.gen.dto.TableGenParamDto;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseColumn;
|
||||
import cn.bootx.platform.starter.code.gen.entity.DatabaseTable;
|
||||
import cn.bootx.platform.starter.code.gen.util.CodeGenUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据库信息服务类型
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/1/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DatabaseTableService {
|
||||
|
||||
private final DatabaseTableMapper databaseTableMapper;
|
||||
private final DataSource bigScreen;
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*/
|
||||
public List<DatabaseTable> findAll() {
|
||||
QueryWrapper<DatabaseTable> wrapper = new QueryWrapper<>();
|
||||
return databaseTableMapper.findAll(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@DS("#dataSourceName")
|
||||
public PageResult<DatabaseTable> page(PageParam pageParam, DatabaseTable param, String dataSourceName) {
|
||||
val mpPage = MpUtil.getMpPage(pageParam, DatabaseTable.class);
|
||||
QueryWrapper<DatabaseTable> wrapper = new QueryWrapper<>();
|
||||
|
||||
wrapper.like(StrUtil.isNotBlank(param.getTableName()), DatabaseTable.Fields.tableName, param.getTableName())
|
||||
.like(StrUtil.isNotBlank(param.getTableComment()), DatabaseTable.Fields.tableComment,
|
||||
param.getTableComment())
|
||||
.orderByDesc(DatabaseTable.Fields.createTime, DatabaseTable.Fields.tableName);
|
||||
|
||||
return MpUtil.convert2PageResult(databaseTableMapper.page(mpPage, wrapper)) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表信息
|
||||
*/
|
||||
public DatabaseTable findByTableName(String tableName) {
|
||||
return databaseTableMapper.findByTableName(tableName).orElseThrow(DataNotExistException::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据表列信息
|
||||
*/
|
||||
public List<DatabaseColumn> findColumnByTableName(String tableName) {
|
||||
return databaseTableMapper.findColumnByTableName(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表相关的代码生成参数信息
|
||||
*/
|
||||
@DS("#dataSourceCode")
|
||||
public TableGenParamDto getTableGenParam(String dataSourceCode, String tableName) {
|
||||
DatabaseTable databaseTable = this.findByTableName(tableName);
|
||||
String entityName = CodeGenUtil.tableToJava(databaseTable.getTableName());
|
||||
return new TableGenParamDto().setEntityName(entityName).setModule(entityName.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package cn.bootx.platform.starter.code.gen.util;
|
||||
|
||||
import cn.hutool.core.text.NamingCase;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* 代码生成工具类
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2022/8/2
|
||||
*/
|
||||
@UtilityClass
|
||||
public class CodeGenUtil {
|
||||
|
||||
/**
|
||||
* 表名转换成Java类名 大驼峰
|
||||
*/
|
||||
public String tableToJava(String tableName) {
|
||||
// 自动去除表前缀
|
||||
return NamingCase.toPascalCase(tableName.substring(tableName.indexOf("_") + 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
cn.bootx.platform.starter.code.gen.CodeGenAutoConfiguration
|
||||
@@ -1,74 +0,0 @@
|
||||
package ${controllerPack};
|
||||
|
||||
import cn.bootx.platform.common.core.rest.PageResult;
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import ${corePack}.service.${entityUpName}Service;
|
||||
import ${dtoPack}.${entityUpName}Dto;
|
||||
import ${paramPack}.${entityUpName}Param;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Tag(name ="${comments}")
|
||||
@RestController
|
||||
@RequestMapping("${requestPath}")
|
||||
@RequiredArgsConstructor
|
||||
public class ${entityUpName}Controller {
|
||||
private final ${entityUpName}Service ${entityLowName}Service;
|
||||
|
||||
@Operation( summary = "添加")
|
||||
@PostMapping(value = "/add")
|
||||
public ResResult<Void> add(@RequestBody ${entityUpName}Param param){
|
||||
${entityLowName}Service.add(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@Operation( summary = "修改")
|
||||
@PostMapping(value = "/update")
|
||||
public ResResult<Void> update(@RequestBody ${entityUpName}Param param){
|
||||
${entityLowName}Service.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@Operation( summary = "删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public ResResult<Void> delete(Long id){
|
||||
${entityLowName}Service.delete(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除")
|
||||
@DeleteMapping("/deleteBatch")
|
||||
public ResResult<Void> deleteBatch(@RequestBody List<Long> ids) {
|
||||
${entityLowName}Service.deleteBatch(ids);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@Operation( summary = "通过ID查询")
|
||||
@GetMapping(value = "/findById")
|
||||
public ResResult<${entityUpName}Dto> findById(Long id){
|
||||
return Res.ok(${entityLowName}Service.findById(id));
|
||||
}
|
||||
|
||||
@Operation( summary = "查询所有")
|
||||
@GetMapping(value = "/findAll")
|
||||
public ResResult<List<${entityUpName}Dto>> findAll(){
|
||||
return Res.ok(${entityLowName}Service.findAll());
|
||||
}
|
||||
|
||||
@Operation( summary = "分页查询")
|
||||
@GetMapping(value = "/page")
|
||||
public ResResult<PageResult<${entityUpName}Dto>> page(PageParam pageParam, ${entityUpName}Param query){
|
||||
return Res.ok(${entityLowName}Service.page(pageParam,query));
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package ${corePack}.convert;
|
||||
|
||||
import ${corePack}.entity.${entityUpName};
|
||||
import ${dtoPack}.${entityUpName}Dto;
|
||||
import ${paramPack}.${entityUpName}Param;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${entityUpName}Convert {
|
||||
${entityUpName}Convert CONVERT = Mappers.getMapper(${entityUpName}Convert.class);
|
||||
|
||||
${entityUpName} convert(${entityUpName}Param in);
|
||||
|
||||
${entityUpName}Dto convert(${entityUpName} in);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package ${dtoPack};
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Schema(title = "${comments}")
|
||||
@Accessors(chain = true)
|
||||
public class ${entityUpName}Dto extends BaseDto {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
@Schema(description = "$column.comments")
|
||||
private $column.javaType $column.name;
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package ${corePack}.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.${baseClass};
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import ${dtoPack}.${entityUpName}Dto;
|
||||
import ${paramPack}.${entityUpName}Param;
|
||||
import ${corePack}.convert.${entityUpName}Convert;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("${tableName}")
|
||||
public class ${entityUpName} extends ${baseClass} implements EntityBaseFunction<${entityUpName}Dto>{
|
||||
|
||||
#foreach ($column in $columns)
|
||||
/** $column.comments */
|
||||
private $column.javaType $column.name;
|
||||
#end
|
||||
|
||||
/** 创建对象 */
|
||||
public static ${entityUpName} init(${entityUpName}Param in) {
|
||||
return ${entityUpName}Convert.CONVERT.convert(in);
|
||||
}
|
||||
|
||||
/** 转换成dto */
|
||||
@Override
|
||||
public ${entityUpName}Dto toDto() {
|
||||
return ${entityUpName}Convert.CONVERT.convert(this);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package ${corePack}.dao;
|
||||
|
||||
import ${paramPack}.${entityUpName}Param;
|
||||
import ${corePack}.entity.${entityUpName};
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.common.query.generator.QueryGenerator;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ${entityUpName}Manager extends BaseManager<${entityUpName}Mapper, ${entityUpName}> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<${entityUpName}> page(PageParam pageParam, ${entityUpName}Param param) {
|
||||
Page<${entityUpName}> mpPage = MpUtil.getMpPage(pageParam, ${entityUpName}.class);
|
||||
QueryWrapper<${entityUpName}> wrapper = QueryGenerator.generator(param, this.getEntityClass());
|
||||
wrapper.select(this.getEntityClass(),MpUtil::excludeBigField)
|
||||
.orderByDesc(MpUtil.getColumnName(${entityUpName}::getId));
|
||||
return this.page(mpPage,wrapper);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package ${corePack}.dao;
|
||||
|
||||
import ${corePack}.entity.${entityUpName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${entityUpName}Mapper extends BaseMapper<${entityUpName}> {
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package ${paramPack};
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import cn.bootx.platform.common.core.annotation.QueryParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@QueryParam(type = QueryParam.CompareTypeEnum.LIKE)
|
||||
@Data
|
||||
@Schema(title = "${comments}")
|
||||
@Accessors(chain = true)
|
||||
public class ${entityUpName}Param {
|
||||
|
||||
@Schema(description= "主键")
|
||||
private Long id;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
@Schema(description = "$column.comments")
|
||||
private $column.javaType $column.name;
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package ${corePack}.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.rest.PageResult;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.core.util.ResultConvertUtil;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import ${dtoPack}.${entityUpName}Dto;
|
||||
import ${paramPack}.${entityUpName}Param;
|
||||
import ${corePack}.convert.${entityUpName}Convert;
|
||||
import ${corePack}.entity.${entityUpName};
|
||||
import ${corePack}.dao.${entityUpName}Manager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
* @author ${author}
|
||||
* @since ${datetime}
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ${entityUpName}Service {
|
||||
private final ${entityUpName}Manager ${entityLowName}Manager;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public void add(${entityUpName}Param param){
|
||||
${entityUpName} ${entityLowName} = ${entityUpName}.init(param);
|
||||
${entityLowName}Manager.save(${entityLowName});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public void update(${entityUpName}Param param){
|
||||
${entityUpName} ${entityLowName} = ${entityLowName}Manager.findById(param.getId()).orElseThrow(DataNotExistException::new);
|
||||
|
||||
BeanUtil.copyProperties(param,${entityLowName}, CopyOptions.create().ignoreNullValue());
|
||||
${entityLowName}Manager.updateById(${entityLowName});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public PageResult<${entityUpName}Dto> page(PageParam pageParam,${entityUpName}Param query){
|
||||
return MpUtil.convert2DtoPageResult(${entityLowName}Manager.page(pageParam,query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条
|
||||
*/
|
||||
public ${entityUpName}Dto findById(Long id){
|
||||
return ${entityLowName}Manager.findById(id).map(${entityUpName}::toDto).orElseThrow(DataNotExistException::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部
|
||||
*/
|
||||
public List<${entityUpName}Dto> findAll(){
|
||||
return ResultConvertUtil.dtoListConvert(${entityLowName}Manager.findAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public void delete(Long id){
|
||||
${entityLowName}Manager.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
public void deleteBatch(List<Long> ids){
|
||||
${entityLowName}Manager.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
import { defHttp } from '/@/utils/http/axios'
|
||||
import { PageResult, Result } from '/#/axios'
|
||||
import { BaseEntity } from '/#/web'
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
export function page(params) {
|
||||
return defHttp.get<Result<PageResult<${entityUpName}>>>({
|
||||
url: '${requestPath}/page',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*/
|
||||
export function findAll() {
|
||||
return defHttp.get<Result<${entityUpName}[]>>({
|
||||
url: '${requestPath}/findAll',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条
|
||||
*/
|
||||
export function get(id) {
|
||||
return defHttp.get<Result<${entityUpName}>>({
|
||||
url: '${requestPath}/findById',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
export function add(obj: ${entityUpName}) {
|
||||
return defHttp.post({
|
||||
url: '${requestPath}/add',
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
export function update(obj: ${entityUpName}) {
|
||||
return defHttp.post({
|
||||
url: '${requestPath}/update',
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
export function del(id) {
|
||||
return defHttp.delete({
|
||||
url: '${requestPath}/delete',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
export function deleteBatch(ids) {
|
||||
return defHttp.delete({
|
||||
url: '${requestPath}/template/delete',
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
*/
|
||||
export interface ${entityUpName} extends BaseEntity {
|
||||
#foreach ($column in $columns)
|
||||
// $column.comments
|
||||
$column.name?: $column.tsType
|
||||
#end
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
<template>
|
||||
#if($editType == "modal")
|
||||
<basic-modal
|
||||
v-bind="$attrs"
|
||||
:loading="confirmLoading"
|
||||
:title="title"
|
||||
:width="modalWidth"
|
||||
:visible="visible"
|
||||
:mask-closable="showable"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
#end
|
||||
#if($editType == "drawer")
|
||||
<basic-drawer
|
||||
showFooter
|
||||
v-bind="$attrs"
|
||||
:title="title"
|
||||
:width="modalWidth"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
@close="handleCancel"
|
||||
>
|
||||
#end
|
||||
#if($editType == "drawer")
|
||||
<a-spin :spinning="confirmLoading">
|
||||
#end
|
||||
<a-form
|
||||
class="small-from-item"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:validate-trigger="['blur', 'change']"
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-item label="主键" name="id" :hidden="true">
|
||||
<a-input v-model:value="form.id" :disabled="showable" />
|
||||
</a-form-item>
|
||||
#foreach ($column in $columns)
|
||||
<a-form-item label="$column.comments" name="$column.name">
|
||||
<a-input v-model:value="form.$column.name" :disabled="showable" placeholder="请输入$column.comments" />
|
||||
</a-form-item>
|
||||
#end
|
||||
</a-form>
|
||||
#if($editType == "drawer")
|
||||
</a-spin>
|
||||
#end
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button key="cancel" @click="handleCancel">取消</a-button>
|
||||
<a-button v-if="!showable" key="forward" :loading="confirmLoading" type="primary" @click="handleOk">保存</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
#if($editType == "modal")
|
||||
</basic-modal>
|
||||
#end
|
||||
#if($editType == "drawer")
|
||||
</basic-drawer>
|
||||
#end
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, reactive } from 'vue'
|
||||
import { $ref } from 'vue/macros'
|
||||
import useFormEdit from '/@/hooks/bootx/useFormEdit'
|
||||
import { add, get, update, ${entityUpName} } from './${entityUpName}.api'
|
||||
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
|
||||
import { FormEditType } from '/@/enums/formTypeEnum'
|
||||
#if($editType == "modal")
|
||||
import { BasicModal } from '/@/components/Modal'
|
||||
#end
|
||||
#if($editType == "drawer")
|
||||
import { BasicDrawer } from '/@/components/Drawer'
|
||||
#end
|
||||
const {
|
||||
initFormEditType,
|
||||
handleCancel,
|
||||
search,
|
||||
labelCol,
|
||||
wrapperCol,
|
||||
modalWidth,
|
||||
title,
|
||||
confirmLoading,
|
||||
visible,
|
||||
editable,
|
||||
showable,
|
||||
formEditType,
|
||||
} = useFormEdit()
|
||||
// 表单
|
||||
const formRef = $ref<FormInstance>()
|
||||
let form = $ref<${entityUpName}>({
|
||||
id: null,
|
||||
#foreach ($column in $columns)
|
||||
$column.name: null,
|
||||
#end
|
||||
})
|
||||
// 校验
|
||||
const rules = reactive({} as Record<string, Rule[]>)
|
||||
// 事件
|
||||
const emits = defineEmits(['ok'])
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
function init(id, editType: FormEditType) {
|
||||
initFormEditType(editType)
|
||||
resetForm()
|
||||
getInfo(id, editType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*/
|
||||
function getInfo(id, editType: FormEditType) {
|
||||
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
|
||||
confirmLoading.value = true
|
||||
get(id).then(({ data }) => {
|
||||
form = data
|
||||
confirmLoading.value = false
|
||||
})
|
||||
} else {
|
||||
confirmLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef?.validate().then(async () => {
|
||||
confirmLoading.value = true
|
||||
if (formEditType.value === FormEditType.Add) {
|
||||
await add(form)
|
||||
} else if (formEditType.value === FormEditType.Edit) {
|
||||
await update(form)
|
||||
}
|
||||
confirmLoading.value = false
|
||||
handleCancel()
|
||||
emits('ok')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
function resetForm() {
|
||||
nextTick(() => {
|
||||
formRef?.resetFields()
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
init,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -1,203 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="m-3 p-3 pt-5 bg-white">
|
||||
<b-query :query-params="model.queryParam" :fields="fields" @query="queryPage" @reset="resetQueryParams" />
|
||||
</div>
|
||||
<div class="m-3 p-3 bg-white">
|
||||
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
|
||||
<template #buttons>
|
||||
<a-space>
|
||||
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
|
||||
<a-dropdown v-if="batchOperateFlag">
|
||||
<a-button post-icon="ant-design:down-outlined"> 批量操作 </a-button>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item>
|
||||
<a-link @click="removeBatch">批量删除</a-link>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table
|
||||
row-id="id"
|
||||
ref="xTable"
|
||||
:data="pagination.records"
|
||||
:loading="loading"
|
||||
@checkbox-all="selectAllEvent"
|
||||
@checkbox-change="selectChangeEvent"
|
||||
>
|
||||
<vxe-column type="checkbox" width="50" />
|
||||
#foreach ($column in $columns)
|
||||
<vxe-column field="$column.name" title="$column.comments" />
|
||||
#end
|
||||
<vxe-column field="createTime" title="创建时间" />
|
||||
<vxe-column fixed="right" width="150" :showOverflow="false" title="操作">
|
||||
<template #default="{ row }">
|
||||
<span>
|
||||
<a-link @click="show(row)">查看</a-link>
|
||||
</span>
|
||||
<a-divider type="vertical" />
|
||||
<span>
|
||||
<a-link @click="edit(row)">编辑</a-link>
|
||||
</span>
|
||||
<a-divider type="vertical" />
|
||||
#if($deleteType == "confirm")
|
||||
<span>
|
||||
<a-link danger @click="remove(row)" >删除</a-link>
|
||||
</span>
|
||||
#end
|
||||
#if($deleteType == "popconfirm")
|
||||
<a-popconfirm title="是否删除" @confirm="remove(row)" okText="是" cancelText="否">
|
||||
<a-link danger>删除</a-link>
|
||||
</a-popconfirm>
|
||||
#end
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<vxe-pager
|
||||
size="medium"
|
||||
:loading="loading"
|
||||
:current-page="pagination.current"
|
||||
:page-size="pagination.size"
|
||||
:total="pagination.total"
|
||||
@page-change="handleTableChange"
|
||||
/>
|
||||
<${entityDashName}-edit ref="${entityLowName}Edit" @ok="queryPage" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { $ref } from 'vue/macros'
|
||||
import { del, deleteBatch, page } from './${entityUpName}.api'
|
||||
import useTablePage from '/@/hooks/bootx/useTablePage'
|
||||
import ${entityUpName}Edit from './${entityUpName}Edit.vue'
|
||||
import { VxeTableInstance, VxeToolbarInstance, VxeTable, VxeColumn, VxePager, VxeToolbar } from 'vxe-table'
|
||||
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
|
||||
import { FormEditType } from '/@/enums/formTypeEnum'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { QueryField } from '/@/components/Bootx/Query/Query'
|
||||
import ALink from '/@/components/Link/Link.vue'
|
||||
|
||||
// 使用hooks
|
||||
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, batchOperateFlag, model, loading } =
|
||||
useTablePage(queryPage)
|
||||
const { notification, createMessage, createConfirm } = useMessage()
|
||||
|
||||
// 查询条件
|
||||
const fields = [] as QueryField[]
|
||||
|
||||
const xTable = $ref<VxeTableInstance>()
|
||||
const xToolbar = $ref<VxeToolbarInstance>()
|
||||
const ${entityLowName}Edit = $ref<any>()
|
||||
|
||||
onMounted(() => {
|
||||
vxeBind()
|
||||
queryPage()
|
||||
})
|
||||
|
||||
/**
|
||||
* 初始化绑定
|
||||
*/
|
||||
function vxeBind() {
|
||||
xTable?.connect(xToolbar as VxeToolbarInstance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
function queryPage() {
|
||||
loading.value = true
|
||||
page({
|
||||
...model.queryParam,
|
||||
...pages,
|
||||
}).then(({ data }) => {
|
||||
pageQueryResHandel(data)
|
||||
})
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中全部
|
||||
*/
|
||||
function selectAllEvent() {
|
||||
const records = xTable?.getCheckboxRecords()
|
||||
batchOperateFlag.value = !!records?.length
|
||||
}
|
||||
/**
|
||||
* 选中事件
|
||||
*/
|
||||
function selectChangeEvent() {
|
||||
const records = xTable?.getCheckboxRecords()
|
||||
batchOperateFlag.value = !!records?.length
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
${entityLowName}Edit.init(null, FormEditType.Add)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
${entityLowName}Edit.init(record.id, FormEditType.Edit)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function show(record) {
|
||||
${entityLowName}Edit.init(record.id, FormEditType.Show)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function remove(record) {
|
||||
#if($deleteType == "confirm")
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '警告',
|
||||
content: '是否删除该数据',
|
||||
onOk: () => {
|
||||
del(record.id).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
},
|
||||
})
|
||||
#end
|
||||
#if($deleteType == "popconfirm")
|
||||
del(record.id).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
#end
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
function removeBatch() {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '警告',
|
||||
content: '是否删除选中的数据',
|
||||
onOk: () => {
|
||||
const ids = xTable?.getCheckboxRecords().map((o) => o.id)
|
||||
deleteBatch(ids).then(() => {
|
||||
createMessage.success('删除成功')
|
||||
queryPage()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -18,10 +18,5 @@
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>${oshi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-mongo</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<module>common-starter-audit-log</module>
|
||||
<module>common-starter-data-perm</module>
|
||||
<module>common-starter-file</module>
|
||||
<module>common-starter-code-gen</module>
|
||||
<module>common-starter-dingtalk</module>
|
||||
<module>common-starter-monitor</module>
|
||||
<module>common-starter-wechat</module>
|
||||
|
||||
@@ -168,12 +168,6 @@
|
||||
<artifactId>common-exception-handler</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mongo -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-mongo</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- 发号器 -->
|
||||
<dependency>
|
||||
|
||||
@@ -265,13 +265,6 @@
|
||||
<artifactId>common-log</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- mongo配置 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-mongo</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- mongo配置 -->
|
||||
<!-- 缓存 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
@@ -304,12 +297,6 @@
|
||||
<artifactId>common-starter-audit-log</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-starter-code-gen</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- 数据权限 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-demo</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-start</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
</dependency>
|
||||
<!-- 支付网关 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-gateway</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
<!-- 管理平台 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-admin</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
@@ -45,12 +45,6 @@
|
||||
<artifactId>common-starter-quartz</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-starter-code-gen</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
<!-- 系统监控 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
@@ -59,7 +53,7 @@
|
||||
</dependency>
|
||||
<!-- 支付演示模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-demo</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</parent>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependencies>
|
||||
<!-- 业务服务模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-service</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</parent>
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-service</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</parent>
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
<!-- 支付核心包-->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single-core</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -5,12 +5,10 @@ import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import lombok.Setter;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -27,7 +25,6 @@ public class DecryptTypeHandler extends BaseTypeHandler<String> {
|
||||
@Setter
|
||||
private static DataPermProperties dataPermProperties;
|
||||
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<groupId>cn.daxpay.single</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.0.6</version>
|
||||
|
||||
Reference in New Issue
Block a user