多模块重构 11:修改代码生成器的实现
This commit is contained in:
parent
8d59384904
commit
b0c25ea9f4
|
@ -1,11 +1,10 @@
|
|||
package cn.iocoder.yudao.adminserver;
|
||||
package cn.iocoder.yudao.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} 和 ${yudao.core-service.base-package}
|
||||
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}", "${yudao.core-service.base-package}",
|
||||
"${yudao.info.base-package2}"}) // TODO 芋艿:重构
|
||||
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package}
|
||||
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module"})
|
||||
public class AdminServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.adminserver.framework.monitor.config;
|
||||
package cn.iocoder.yudao.server.framework.monitor.config;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
* 使用 Spring Boot Admin 实现简单的监控平台
|
||||
*/
|
||||
package cn.iocoder.yudao.adminserver.framework.monitor;
|
||||
package cn.iocoder.yudao.server.framework.monitor;
|
|
@ -3,4 +3,4 @@
|
|||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
package cn.iocoder.yudao.adminserver.framework;
|
||||
package cn.iocoder.yudao.server.framework;
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.adminserver.framework.security;
|
||||
package cn.iocoder.yudao.server.framework.security;
|
||||
|
||||
import cn.iocoder.yudao.framework.web.config.WebProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
|
@ -163,16 +163,11 @@ logging:
|
|||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||
level:
|
||||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql: debug
|
||||
cn.iocoder.yudao.adminserver.modules.infra.dal.mysql: debug
|
||||
cn.iocoder.yudao.adminserver.modules.pay.dal.mysql: debug
|
||||
cn.iocoder.yudao.adminserver.modules.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.adminserver.modules.tool.dal.mysql: debug
|
||||
cn.iocoder.yudao.coreservice.modules.bpm.dal.mysql: debug
|
||||
cn.iocoder.yudao.coreservice.modules.infra.dal.mysql: debug
|
||||
cn.iocoder.yudao.coreservice.modules.pay.dal.mysql: debug
|
||||
cn.iocoder.yudao.coreservice.modules.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.coreservice.modules.tool.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.bpm.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.infra.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.pay.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.tool.dal.mysql: debug
|
||||
|
||||
--- #################### 微信公众号相关配置 ####################
|
||||
wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
|
||||
|
|
|
@ -40,17 +40,14 @@ mybatis-plus:
|
|||
id-type: AUTO # 自增 ID
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject, ${yudao.core-service.base-package}.modules.*.dal.dataobject
|
||||
type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
yudao:
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.yudao.adminserver
|
||||
base-package2: cn.iocoder.yudao.module
|
||||
core-service:
|
||||
base-package: cn.iocoder.yudao.coreservice
|
||||
base-package: cn.iocoder.yudao
|
||||
web:
|
||||
admin-api:
|
||||
prefix: /admin-api
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.adminserver;
|
||||
package cn.iocoder.yudao.server;
|
||||
|
||||
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.adminserver;
|
||||
package cn.iocoder.yudao.server;
|
||||
|
||||
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.iocoder.yudao.adminserver.framework.quartz.core;
|
||||
package cn.iocoder.yudao.server.framework.quartz.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.system.job.auth.SysUserSessionTimeoutJob;
|
||||
import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.iocoder.yudao.adminserver.framework.redis.core.stream;
|
||||
package cn.iocoder.yudao.server.framework.redis.core.stream;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.iocoder.yudao.adminserver.BaseRedisIntegrationTest;
|
||||
import cn.iocoder.yudao.server.BaseRedisIntegrationTest;
|
||||
import cn.iocoder.yudao.module.system.mq.consumer.mail.SysMailSendConsumer;
|
||||
import cn.iocoder.yudao.module.system.mq.consumer.sms.SysSmsSendConsumer;
|
||||
import cn.iocoder.yudao.module.system.mq.message.mail.SysMailSendMessage;
|
||||
|
|
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.service.sms;
|
|||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.iocoder.yudao.adminserver.BaseDbAndRedisIntegrationTest;
|
||||
import cn.iocoder.yudao.server.BaseDbAndRedisIntegrationTest;
|
||||
import cn.iocoder.yudao.module.system.mq.consumer.sms.SysSmsSendConsumer;
|
||||
import cn.iocoder.yudao.module.system.mq.producer.sms.SysSmsProducer;
|
||||
import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsChannelServiceImpl;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.tool.dal.mysql.codegen;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.tool.dal.dataobject.codegen.ToolSchemaColumnDO;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.tool.dal.mysql.codegen;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.tool.service.codegen;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.tool.dal.dataobject.codegen.ToolCodegenColumnDO;
|
||||
import cn.iocoder.yudao.module.tool.dal.dataobject.codegen.ToolCodegenTableDO;
|
||||
import cn.iocoder.yudao.module.tool.dal.mysql.codegen.ToolCodegenColumnMapper;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.tool.service.codegen;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.tool.service.codegen.impl.ToolCodegenSQLParser;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.tool.service.codegen;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.tool.service.codegen.impl.ToolCodegenServiceImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ export const DICT_TYPE = {
|
|||
|
||||
// ========== TOOL 模块 ==========
|
||||
TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type',
|
||||
TOOL_CODEGEN_SCENE: 'tool_codegen_scene',
|
||||
|
||||
// ========== BPM 模块 ==========
|
||||
BPM_MODEL_CATEGORY: 'bpm_model_category',
|
||||
|
|
|
@ -2,15 +2,20 @@
|
|||
<el-form ref="genInfoForm" :model="info" :rules="rules" label-width="150px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="tplCategory">
|
||||
<el-form-item prop="templateType">
|
||||
<span slot="label">生成模板</span>
|
||||
<el-select v-model="info.templateType" @change="tplSelectChange">
|
||||
<el-option
|
||||
v-for="dict in this.getDictDatas(DICT_TYPE.TOOL_CODEGEN_TEMPLATE_TYPE)"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
/>
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TOOL_CODEGEN_TEMPLATE_TYPE)"
|
||||
:key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="scene">
|
||||
<span slot="label">生成模板</span>
|
||||
<el-select v-model="info.scene">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TOOL_CODEGEN_SCENE)"
|
||||
:key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -249,6 +254,9 @@ export default {
|
|||
templateType: [
|
||||
{ required: true, message: "请选择生成模板", trigger: "blur" }
|
||||
],
|
||||
scene: [
|
||||
{ required: true, message: "请选择生成场景", trigger: "blur" }
|
||||
],
|
||||
// packageName: [
|
||||
// { required: true, message: "请输入生成包路径", trigger: "blur" }
|
||||
// ],
|
||||
|
|
|
@ -15,9 +15,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}",
|
||||
"${yudao.info.base-package2}"},
|
||||
annotationClass = Mapper.class,
|
||||
@MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class,
|
||||
lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
|
||||
public class YudaoMybatisAutoConfiguration {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormUpdateReqVO;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.server.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cn.iocoder.yudao.adminserver;
|
||||
package cn.iocoder.yudao.server;
|
||||
|
||||
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
|
@ -23,6 +23,11 @@
|
|||
<artifactId>yudao-module-tool-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.io.IoUtil;
|
|||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.tool.controller.admin.codegen.vo.CodegenDetailRespVO;
|
||||
import cn.iocoder.yudao.module.tool.controller.admin.codegen.vo.CodegenPreviewRespVO;
|
||||
import cn.iocoder.yudao.module.tool.controller.admin.codegen.vo.CodegenUpdateReqVO;
|
||||
|
@ -36,6 +37,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Api(tags = "管理后台 - 代码生成器")
|
||||
@RestController
|
||||
|
@ -88,7 +90,7 @@ public class CodegenController {
|
|||
@PostMapping("/create-list-from-db")
|
||||
@PreAuthorize("@ss.hasPermission('tool:codegen:create')")
|
||||
public CommonResult<List<Long>> createCodegenListFromDB(@RequestParam("tableNames") List<String> tableNames) {
|
||||
return success(codegenService.createCodegenListFromDB(tableNames));
|
||||
return success(codegenService.createCodegenListFromDB(getLoginUserId(), tableNames));
|
||||
}
|
||||
|
||||
@ApiOperation("基于 SQL 建表语句,创建代码生成器的表和字段定义")
|
||||
|
@ -96,7 +98,7 @@ public class CodegenController {
|
|||
@PostMapping("/create-list-from-sql")
|
||||
@PreAuthorize("@ss.hasPermission('tool:codegen:create')")
|
||||
public CommonResult<Long> createCodegenListFromSQL(@RequestParam("sql") String sql) {
|
||||
return success(codegenService.createCodegenListFromSQL(sql));
|
||||
return success(codegenService.createCodegenListFromSQL(getLoginUserId(), sql));
|
||||
}
|
||||
|
||||
@ApiOperation("更新数据库的表和字段定义")
|
||||
|
|
|
@ -16,6 +16,10 @@ public class CodegenTableBaseVO {
|
|||
@NotNull(message = "导入类型不能为空")
|
||||
private Integer importType;
|
||||
|
||||
@ApiModelProperty(value = "生成场景", required = true, example = "1", notes = "参见 CodegenSceneEnum 枚举")
|
||||
@NotNull(message = "导入类型不能为空")
|
||||
private Integer scene;
|
||||
|
||||
@ApiModelProperty(value = "表名称", required = true, example = "yudao")
|
||||
@NotNull(message = "表名称不能为空")
|
||||
private String tableName;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.tool.dal.dataobject.codegen;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.tool.enums.codegen.CodegenSceneEnum;
|
||||
import cn.iocoder.yudao.module.tool.enums.codegen.CodegenTemplateTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
@ -29,6 +30,12 @@ public class CodegenTableDO extends BaseDO {
|
|||
* 枚举 {@link CodegenTemplateTypeEnum}
|
||||
*/
|
||||
private Integer importType;
|
||||
/**
|
||||
* 生成场景
|
||||
*
|
||||
* 枚举 {@link CodegenSceneEnum}
|
||||
*/
|
||||
private Integer scene;
|
||||
|
||||
// ========== 表相关字段 ==========
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package cn.iocoder.yudao.module.tool.enums.codegen;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 代码生成的场景枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CodegenSceneEnum {
|
||||
|
||||
ADMIN(1, "管理后台", "admin"),
|
||||
APP(2, "用户 APP", "app");
|
||||
|
||||
/**
|
||||
* 场景
|
||||
*/
|
||||
private final Integer scene;
|
||||
/**
|
||||
* 场景名
|
||||
*/
|
||||
private final String name;
|
||||
/**
|
||||
* 基础包名
|
||||
*/
|
||||
private final String basePackage;
|
||||
|
||||
}
|
|
@ -20,26 +20,29 @@ public interface CodegenService {
|
|||
/**
|
||||
* 基于 SQL 建表语句,创建代码生成器的表定义
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param sql SQL 建表语句
|
||||
* @return 创建的表定义的编号
|
||||
*/
|
||||
Long createCodegenListFromSQL(String sql);
|
||||
Long createCodegenListFromSQL(Long userId, String sql);
|
||||
|
||||
/**
|
||||
* 基于数据库的表结构,创建代码生成器的表定义
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param tableName 表名称
|
||||
* @return 创建的表定义的编号
|
||||
*/
|
||||
Long createCodegen(String tableName);
|
||||
Long createCodegen(Long userId, String tableName);
|
||||
|
||||
/**
|
||||
* 基于 {@link #createCodegen(String)} 的批量创建
|
||||
* 基于 {@link #createCodegen(Long, String)} 的批量创建
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param tableNames 表名称数组
|
||||
* @return 创建的表定义的编号数组
|
||||
*/
|
||||
List<Long> createCodegenListFromDB(List<String> tableNames);
|
||||
List<Long> createCodegenListFromDB(Long userId, List<String> tableNames);
|
||||
|
||||
/**
|
||||
* 更新数据库的表和字段定义
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.tool.service.codegen;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.tool.framework.codegen.config.CodegenProperties;
|
||||
import cn.iocoder.yudao.module.tool.controller.admin.codegen.vo.CodegenUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.tool.controller.admin.codegen.vo.table.CodegenTablePageReqVO;
|
||||
|
@ -50,6 +51,9 @@ public class CodegenServiceImpl implements CodegenService {
|
|||
@Resource
|
||||
private CodegenColumnMapper codegenColumnMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private CodegenBuilder codegenBuilder;
|
||||
@Resource
|
||||
|
@ -58,7 +62,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||
@Resource
|
||||
private CodegenProperties codegenProperties;
|
||||
|
||||
private Long createCodegen0(CodegenImportTypeEnum importType,
|
||||
private Long createCodegen0(Long userId, CodegenImportTypeEnum importType,
|
||||
SchemaTableDO schemaTable, List<SchemaColumnDO> schemaColumns) {
|
||||
// 校验导入的表和字段非空
|
||||
if (schemaTable == null) {
|
||||
|
@ -75,6 +79,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||
// 构建 CodegenTableDO 对象,插入到 DB 中
|
||||
CodegenTableDO table = codegenBuilder.buildTable(schemaTable);
|
||||
table.setImportType(importType.getType());
|
||||
table.setAuthor(userApi.getUser(userId).getNickname());
|
||||
codegenTableMapper.insert(table);
|
||||
// 构建 CodegenColumnDO 数组,插入到 DB 中
|
||||
List<CodegenColumnDO> columns = codegenBuilder.buildColumns(schemaColumns);
|
||||
|
@ -86,7 +91,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Long createCodegenListFromSQL(String sql) {
|
||||
public Long createCodegenListFromSQL(Long userId, String sql) {
|
||||
// 从 SQL 中,获得数据库表结构
|
||||
SchemaTableDO schemaTable;
|
||||
List<SchemaColumnDO> schemaColumns;
|
||||
|
@ -98,26 +103,26 @@ public class CodegenServiceImpl implements CodegenService {
|
|||
throw exception(CODEGEN_PARSE_SQL_ERROR);
|
||||
}
|
||||
// 导入
|
||||
return this.createCodegen0(CodegenImportTypeEnum.SQL, schemaTable, schemaColumns);
|
||||
return this.createCodegen0(userId, CodegenImportTypeEnum.SQL, schemaTable, schemaColumns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createCodegen(String tableName) {
|
||||
public Long createCodegen(Long userId, String tableName) {
|
||||
// 获取当前schema
|
||||
String tableSchema = codegenProperties.getDbSchemas().iterator().next();
|
||||
// 从数据库中,获得数据库表结构
|
||||
SchemaTableDO schemaTable = schemaTableMapper.selectByTableSchemaAndTableName(tableSchema, tableName);
|
||||
List<SchemaColumnDO> schemaColumns = schemaColumnMapper.selectListByTableName(tableSchema, tableName);
|
||||
// 导入
|
||||
return this.createCodegen0(CodegenImportTypeEnum.DB, schemaTable, schemaColumns);
|
||||
return this.createCodegen0(userId, CodegenImportTypeEnum.DB, schemaTable, schemaColumns);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<Long> createCodegenListFromDB(List<String> tableNames) {
|
||||
public List<Long> createCodegenListFromDB(Long userId, List<String> tableNames) {
|
||||
List<Long> ids = new ArrayList<>(tableNames.size());
|
||||
// 遍历添加。虽然效率会低一点,但是没必要做成完全批量,因为不会这么大量
|
||||
tableNames.forEach(tableName -> ids.add(createCodegen(tableName)));
|
||||
tableNames.forEach(tableName -> ids.add(createCodegen(userId, tableName)));
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,18 +27,6 @@ import static cn.hutool.core.text.CharSequenceUtil.*;
|
|||
@Component
|
||||
public class CodegenBuilder {
|
||||
|
||||
/**
|
||||
* Module 名字的映射 TODO 后续梳理到配置类
|
||||
*
|
||||
* key:模块的完整名
|
||||
* value:模块的缩写名
|
||||
*/
|
||||
private static final Map<String, String> moduleNames = MapUtil.<String, String>builder()
|
||||
.put("system", "sys")
|
||||
.put("infra", "inf")
|
||||
.put("tool", "tool")
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射
|
||||
* 注意,字段的匹配以后缀的方式
|
||||
|
@ -125,8 +113,10 @@ public class CodegenBuilder {
|
|||
* @param table 表定义
|
||||
*/
|
||||
private void initTableDefault(CodegenTableDO table) {
|
||||
table.setModuleName(getFullModuleName(StrUtil.subBefore(table.getTableName(),
|
||||
'_', false))); // 第一个 _ 前缀的前面,作为 module 名字
|
||||
// 以 system_dept 举例子。moduleName 为 system、businessName 为 dept、className 为 SystemDept
|
||||
// 如果不希望 System 前缀,则可以手动在【代码生成 - 修改生成配置 - 基本信息】,将实体类名称改为 Dept 即可
|
||||
table.setModuleName(StrUtil.subBefore(table.getTableName(),
|
||||
'_', false)); // 第一个 _ 前缀的前面,作为 module 名字
|
||||
table.setBusinessName(toCamelCase(subAfter(table.getTableName(),
|
||||
'_', false))); // 第一步,第一个 _ 前缀的后面,作为 module 名字; 第二步,可能存在多个 _ 的情况,转换成驼峰
|
||||
table.setClassName(upperFirst(toCamelCase(table.getTableName()))); // 驼峰 + 首字母大写
|
||||
|
@ -208,27 +198,4 @@ public class CodegenBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得模块的缩略名
|
||||
*
|
||||
* @param fullModuleName 模块的完整名
|
||||
* @return 缩略名
|
||||
*/
|
||||
public String getSimpleModuleName(String fullModuleName) {
|
||||
return moduleNames.getOrDefault(fullModuleName, fullModuleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得模块的完整名
|
||||
*
|
||||
* @param shortModuleName 模块的缩略名
|
||||
* @return 完整名
|
||||
*/
|
||||
public String getFullModuleName(String shortModuleName) {
|
||||
return moduleNames.entrySet().stream()
|
||||
.filter(entry -> entry.getValue().equals(shortModuleName)) // 匹配
|
||||
.findFirst().map(Map.Entry::getKey) // 返回 key
|
||||
.orElse(shortModuleName); // 兜底返回 shortModuleName
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,38 +53,39 @@ public class CodegenEngine {
|
|||
* value:生成的路径
|
||||
*/
|
||||
private static final Map<String, String> TEMPLATES = MapUtil.<String, String>builder(new LinkedHashMap<>()) // 有序
|
||||
// Java Main
|
||||
// Java module-impl Main
|
||||
.put(javaTemplatePath("controller/vo/baseVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}BaseVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}BaseVO"))
|
||||
.put(javaTemplatePath("controller/vo/createReqVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}CreateReqVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}CreateReqVO"))
|
||||
.put(javaTemplatePath("controller/vo/pageReqVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}PageReqVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}PageReqVO"))
|
||||
.put(javaTemplatePath("controller/vo/respVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}RespVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}RespVO"))
|
||||
.put(javaTemplatePath("controller/vo/updateReqVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}UpdateReqVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}UpdateReqVO"))
|
||||
.put(javaTemplatePath("controller/vo/exportReqVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}ExportReqVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}ExportReqVO"))
|
||||
.put(javaTemplatePath("controller/vo/excelVO"),
|
||||
javaFilePath("controller/${table.businessName}/vo/${table.className}ExcelVO"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/vo/${table.className}ExcelVO"))
|
||||
.put(javaTemplatePath("controller/controller"),
|
||||
javaFilePath("controller/${table.businessName}/${table.className}Controller"))
|
||||
javaModuleImplMainFilePath("controller/${table.businessName}/${table.className}Controller"))
|
||||
.put(javaTemplatePath("convert/convert"),
|
||||
javaFilePath("convert/${table.businessName}/${table.className}Convert"))
|
||||
javaModuleImplMainFilePath("convert/${table.businessName}/${table.className}Convert"))
|
||||
.put(javaTemplatePath("dal/do"),
|
||||
javaFilePath("dal/dataobject/${table.businessName}/${table.className}DO"))
|
||||
javaModuleImplMainFilePath("dal/dataobject/${table.businessName}/${table.className}DO"))
|
||||
.put(javaTemplatePath("dal/mapper"),
|
||||
javaFilePath("dal/mysql/${table.businessName}/${table.className}Mapper"))
|
||||
.put(javaTemplatePath("enums/errorcode"),
|
||||
javaFilePath("enums/${simpleModuleName_upperFirst}ErrorCodeConstants"))
|
||||
javaModuleImplMainFilePath("dal/mysql/${table.businessName}/${table.className}Mapper"))
|
||||
.put(javaTemplatePath("service/serviceImpl"),
|
||||
javaFilePath("service/${table.businessName}/impl/${table.className}ServiceImpl"))
|
||||
javaModuleImplMainFilePath("service/${table.businessName}/${table.className}ServiceImpl"))
|
||||
.put(javaTemplatePath("service/service"),
|
||||
javaFilePath("service/${table.businessName}/${table.className}Service"))
|
||||
// Java Test
|
||||
javaModuleImplMainFilePath("service/${table.businessName}/${table.className}Service"))
|
||||
// Java module-impl Test
|
||||
.put(javaTemplatePath("test/serviceTest"),
|
||||
javaFilePath("service/${table.businessName}/${table.className}ServiceTest"))
|
||||
javaModuleImplTestFilePath("service/${table.businessName}/${table.className}ServiceTest"))
|
||||
// Java module-api Main
|
||||
.put(javaTemplatePath("enums/errorcode"),
|
||||
javaModuleApiMainFilePath("enums/ErrorCodeConstants"))
|
||||
// Vue
|
||||
.put(vueTemplatePath("views/index.vue"),
|
||||
vueFilePath("views/${table.moduleName}/${classNameVar}/index.vue"))
|
||||
|
@ -121,7 +122,7 @@ public class CodegenEngine {
|
|||
// 全局配置
|
||||
globalBindingMap.put("basePackage", codegenProperties.getBasePackage());
|
||||
globalBindingMap.put("baseFrameworkPackage", StrUtil.subBefore(codegenProperties.getBasePackage(),
|
||||
'.', true) + '.' + "framework");
|
||||
'.', true) + '.' + "framework"); // 用于后续获取测试类的 package 地址
|
||||
// 全局 Java Bean
|
||||
globalBindingMap.put("CommonResultClassName", CommonResult.class.getName());
|
||||
globalBindingMap.put("PageResultClassName", PageResult.class.getName());
|
||||
|
@ -149,13 +150,9 @@ public class CodegenEngine {
|
|||
bindingMap.put("table", table);
|
||||
bindingMap.put("columns", columns);
|
||||
bindingMap.put("primaryColumn", CollectionUtils.findFirst(columns, CodegenColumnDO::getPrimaryKey)); // 主键字段
|
||||
// moduleName 相关
|
||||
String simpleModuleName = codegenBuilder.getSimpleModuleName(table.getModuleName());
|
||||
bindingMap.put("simpleModuleName", simpleModuleName); // 将 system 转成 sys
|
||||
bindingMap.put("simpleModuleName_upperFirst", upperFirst(simpleModuleName)); // 将 sys 转成 Sys
|
||||
// className 相关
|
||||
// 去掉指定前缀 将 TestDictType 转换成 DictType. 因为在 create 等方法后,不需要带上 Test 前缀
|
||||
String simpleClassName = removePrefix(table.getClassName(), upperFirst(simpleModuleName));
|
||||
String simpleClassName = removePrefix(table.getClassName(), upperFirst(table.getModuleName()));
|
||||
bindingMap.put("simpleClassName", simpleClassName);
|
||||
bindingMap.put("simpleClassName_underlineCase", toUnderlineCase(simpleClassName)); // 将 DictType 转换成 dict_type
|
||||
bindingMap.put("classNameVar", lowerFirst(simpleClassName)); // 将 DictType 转换成 dictType,用于变量
|
||||
|
@ -177,8 +174,6 @@ public class CodegenEngine {
|
|||
private String formatFilePath(String filePath, Map<String, Object> bindingMap) {
|
||||
filePath = StrUtil.replace(filePath, "${basePackage}",
|
||||
getStr(bindingMap, "basePackage").replaceAll("\\.", "/"));
|
||||
filePath = StrUtil.replace(filePath, "${simpleModuleName_upperFirst}",
|
||||
getStr(bindingMap, "simpleModuleName_upperFirst"));
|
||||
filePath = StrUtil.replace(filePath, "${classNameVar}",
|
||||
getStr(bindingMap, "classNameVar"));
|
||||
|
||||
|
@ -194,8 +189,23 @@ public class CodegenEngine {
|
|||
return "codegen/java/" + path + ".vm";
|
||||
}
|
||||
|
||||
private static String javaFilePath(String path) {
|
||||
return "java/${basePackage}/modules/${table.moduleName}/" + path + ".java";
|
||||
private static String javaModuleImplMainFilePath(String path) {
|
||||
return javaModuleFilePath(path, "impl", "main");
|
||||
}
|
||||
|
||||
private static String javaModuleApiMainFilePath(String path) {
|
||||
return javaModuleFilePath(path, "api", "main");
|
||||
|
||||
}
|
||||
|
||||
private static String javaModuleImplTestFilePath(String path) {
|
||||
return javaModuleFilePath(path, "impl", "test");
|
||||
}
|
||||
|
||||
private static String javaModuleFilePath(String path, String module, String src) {
|
||||
return "yudao-module-${table.moduleName}/" + // 顶级模块
|
||||
"yudao-module-${table.moduleName}-" + module + "/" + // 子模块
|
||||
"src/" + src + "/java/${basePackage}/module/${table.moduleName}/" + path + ".java";
|
||||
}
|
||||
|
||||
private static String vueTemplatePath(String path) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName};
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -22,10 +22,10 @@ import ${ExcelUtilsClassName};
|
|||
import ${OperateLogClassName};
|
||||
import static ${OperateTypeEnumClassName}.*;
|
||||
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.modules.${table.moduleName}.convert.${table.businessName}.${table.className}Convert;
|
||||
import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.${table.className}Service;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.convert.${table.businessName}.${table.className}Convert;
|
||||
import ${basePackage}.module.${table.moduleName}.service.${table.businessName}.${table.className}Service;
|
||||
|
||||
@Api(tags = "${table.classComment}")
|
||||
@RestController
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.convert.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.convert.${table.businessName};
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -6,8 +6,8 @@ import ${PageResultClassName};
|
|||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
|
||||
/**
|
||||
* ${table.classComment} Convert
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName};
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
|
@ -1,13 +1,13 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.dal.mysql.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName};
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import ${PageResultClassName};
|
||||
import ${QueryWrapperClassName};
|
||||
import ${BaseMapperClassName};
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
|
||||
## 字段模板
|
||||
#macro(listCondition)
|
|
@ -1,9 +1,9 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.service.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${PageResultClassName};
|
||||
|
||||
/**
|
|
@ -1,20 +1,20 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.impl;
|
||||
package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${PageResultClassName};
|
||||
|
||||
import ${basePackage}.modules.${table.moduleName}.convert.${table.businessName}.${table.className}Convert;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper;
|
||||
import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.${table.className}Service;
|
||||
import ${basePackage}.module.${table.moduleName}.convert.${table.businessName}.${table.className}Convert;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper;
|
||||
import ${basePackage}.module.${table.moduleName}.service.${table.businessName}.${table.className}Service;
|
||||
|
||||
import static ${ServiceExceptionUtilClassName}.exception;
|
||||
import static ${basePackage}.modules.${table.moduleName}.enums.${simpleModuleName_upperFirst}ErrorCodeConstants.*;
|
||||
import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* ${table.classComment} Service 实现类
|
|
@ -1,4 +1,4 @@
|
|||
package ${basePackage}.modules.${table.moduleName}.service.${table.businessName};
|
||||
package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
@ -6,10 +6,10 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
|||
import javax.annotation.Resource;
|
||||
|
||||
import ${basePackage}.BaseDbUnitTest;
|
||||
import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.impl.${table.className}ServiceImpl;
|
||||
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.modules.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper;
|
||||
import ${basePackage}.module.${table.moduleName}.service.${table.businessName}.impl.${table.className}ServiceImpl;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper;
|
||||
import ${PageResultClassName};
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -17,7 +17,7 @@ import org.springframework.context.annotation.Import;
|
|||
import java.util.*;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static ${basePackage}.modules.${table.moduleName}.enums.${simpleModuleName_upperFirst}ErrorCodeConstants.*;
|
||||
import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*;
|
||||
import static ${baseFrameworkPackage}.test.core.util.AssertUtils.*;
|
||||
import static ${baseFrameworkPackage}.test.core.util.RandomUtils.*;
|
||||
import static ${ObjectUtilsClassName}.*;
|
|
@ -1,5 +1,5 @@
|
|||
-- 菜单 SQL
|
||||
INSERT INTO `sys_menu`(
|
||||
INSERT INTO `system_menu`(
|
||||
`name`, `permission`, `menu_type`, `sort`, `parent_id`,
|
||||
`path`, `icon`, `component`, `status`
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ SELECT @parentId := LAST_INSERT_ID();
|
|||
#set ($functionOps = ['query', 'create', 'update', 'delete', 'export'])
|
||||
#foreach ($functionName in $functionNames)
|
||||
#set ($index = $foreach.count - 1)
|
||||
INSERT INTO `sys_menu`(
|
||||
INSERT INTO `system_menu`(
|
||||
`name`, `permission`, `menu_type`, `sort`, `parent_id`,
|
||||
`path`, `icon`, `component`, `status`
|
||||
)
|
Loading…
Reference in New Issue