diff --git a/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java new file mode 100644 index 00000000..58cba8fc --- /dev/null +++ b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java @@ -0,0 +1,100 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *
+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *
+ * 1. This software is for development use only under a valid license + * from BladeX. + *
+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *
+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *
+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *
+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.test; + + +import org.springblade.develop.constant.DevelopConstant; +import org.springblade.develop.support.BladeFastCodeGenerator; + +/** + * .ver2 + */ +public class CodeGeneratorVer2 { + + /** + * 代码生成的系统类型(Boot/Cloud) + */ + public static String SYSTEM_NAME = DevelopConstant.CLOUD_NAME; + /** + * 代码生成的模块名 + */ + public static String CODE_NAME = "[检验项目]"; + /** + * 代码所在服务名 + */ + public static String SERVICE_NAME = "blade-desk"; + /** + * 代码生成的包名 + */ + public static String PACKAGE_NAME = "org.springblade.desk.quality"; + /** + * 需要去掉的表前缀 + */ + public static String[] TABLE_PREFIX = {"QA_"}; + /** + * 需要生成的表名(两者只能取其一) + */ + public static String[] INCLUDE_TABLES = {"QA_INSPECTION_ITEM"}; + /** + * 需要排除的表名(两者只能取其一) + */ + public static String[] EXCLUDE_TABLES = {}; + /** + * 是否包含基础业务字段 + */ + public static Boolean HAS_SUPER_ENTITY = Boolean.TRUE; + /** + * 基础业务字段 + */ + public static String[] SUPER_ENTITY_COLUMNS = + { + "id", + "create_time", + "create_user", + "create_dept", + "update_time", + "update_user", + "status", + "is_deleted" + }; + + /** + * RUN THIS + */ + public static void main(String[] args) { + BladeFastCodeGenerator generator = new BladeFastCodeGenerator(); + generator.setSystemName(SYSTEM_NAME); + generator.setCodeName(CODE_NAME); + generator.setServiceName(SERVICE_NAME); + generator.setPackageName(PACKAGE_NAME); + generator.setTablePrefix(TABLE_PREFIX); + generator.setIncludeTables(INCLUDE_TABLES); + generator.setExcludeTables(EXCLUDE_TABLES); + generator.setHasSuperEntity(HAS_SUPER_ENTITY); + generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS); + generator.run(); + } +} diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl index f7b1595c..af0abee1 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl @@ -1,27 +1,5 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *
- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *
- * 1. This software is for development use only under a valid license - * from BladeX. - *
- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *
- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *
- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
package ${package.Controller};
@@ -41,13 +19,13 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import ${packageName!}.pojo.entity.${entityKey!}Entity;
-import ${packageName!}.pojo.vo.${entityKey!}VO;
-import ${packageName!}.excel.${entityKey!}Excel;
+import ${packageName!}.pojo.entity.${entityKey!};
+import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
+import ${packageName!}.excel.gen.${entityKey!}GenExcel;
#if(hasWrapper) {
-import ${packageName!}.wrapper.${entityKey!}Wrapper;
+import ${packageName!}.wrapper.gen.${entityKey!}GenWrapper;
#}
-import ${packageName!}.service.${table.serviceName!};
+import ${packageName!}.service.gen.${table.serviceName!};
#if(isNotEmpty(superControllerClassPackage)){
import ${superControllerClassPackage!};
#}
@@ -79,7 +57,7 @@ public class ${table.controllerName!} extends ${superControllerClass!} {
public class ${table.controllerName!} {
#}
- private final ${table.serviceName!} ${entityKeyPath!}Service;
+ private final ${table.serviceName!} ${entityKeyPath!}GenService;
#if(hasWrapper){
/**
@@ -88,9 +66,9 @@ public class ${table.controllerName!} {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入${entityKeyPath!}")
- public R<${entityKey!}VO> detail(${entityKey!}Entity ${entityKeyPath!}) {
- ${entityKey!}Entity detail = ${entityKeyPath!}Service.getOne(Condition.getQueryWrapper(${entityKeyPath!}));
- return R.data(${entityKey!}Wrapper.build().entityVO(detail));
+ public R<${entityKey!}GenVO> detail(${entityKey!} ${entityKeyPath!}) {
+ ${entityKey!} detail = ${entityKeyPath!}GenService.getOne(Condition.getQueryWrapper(${entityKeyPath!}));
+ return R.data(${entityKey!}GenWrapper.build().entityVO(detail));
}
/**
@@ -99,9 +77,9 @@ public class ${table.controllerName!} {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入${entityKeyPath!}")
- public R
- * Use of this software is governed by the Commercial License Agreement
- * obtained after purchasing a license from BladeX.
- *
- * 1. This software is for development use only under a valid license
- * from BladeX.
- *
- * 2. Redistribution of this software's source code to any third party
- * without a commercial license is strictly prohibited.
- *
- * 3. Licensees may copyright their own code but cannot use segments
- * from this software for such purposes. Copyright of this software
- * remains with BladeX.
- *
- * Using this software signifies agreement to this License, and the software
- * must not be used for illegal purposes.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
- * not liable for any claims arising from secondary or illegal development.
- *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
package ${package.Entity!};
@@ -55,15 +33,15 @@ import java.io.Serial;
*/
@Data
@TableName("${table.name!}")
-@Schema(description = "${entity!}对象")
+@Schema(description = "${entityKey!} Entity对象")
#if(hasSuperEntity){
@EqualsAndHashCode(callSuper = true)
-public class ${entityKey!}Entity extends TenantEntity {
+public class ${entityKey!} extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
#}else{
-public class ${entityKey!}Entity implements Serializable {
+public class ${entityKey!} implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl
index 5a56c0dc..3a6c69f1 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl
+++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl
@@ -1,31 +1,9 @@
/**
- * BladeX Commercial License Agreement
- * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
- *
- * Use of this software is governed by the Commercial License Agreement
- * obtained after purchasing a license from BladeX.
- *
- * 1. This software is for development use only under a valid license
- * from BladeX.
- *
- * 2. Redistribution of this software's source code to any third party
- * without a commercial license is strictly prohibited.
- *
- * 3. Licensees may copyright their own code but cannot use segments
- * from this software for such purposes. Copyright of this software
- * remains with BladeX.
- *
- * Using this software signifies agreement to this License, and the software
- * must not be used for illegal purposes.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
- * not liable for any claims arising from secondary or illegal development.
- *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
-package ${strutil.replace(package.Entity,"entity","dto")};
+package ${strutil.replace(package.Entity,"entity","dto.gen")};
-import ${packageName!}.pojo.entity.${entityKey!}Entity;
+import ${packageName!}.pojo.entity.${entityKey!};
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
@@ -38,7 +16,7 @@ import java.io.Serial;
*/
@Data
@EqualsAndHashCode(callSuper = true)
-public class ${entityKey!}DTO extends ${entityKey!}Entity {
+public class ${entityKey!}GenDTO extends ${entityKey!} {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl
index db8f1ccf..2f5480db 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl
+++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl
@@ -1,29 +1,7 @@
/**
- * BladeX Commercial License Agreement
- * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
- *
- * Use of this software is governed by the Commercial License Agreement
- * obtained after purchasing a license from BladeX.
- *
- * 1. This software is for development use only under a valid license
- * from BladeX.
- *
- * 2. Redistribution of this software's source code to any third party
- * without a commercial license is strictly prohibited.
- *
- * 3. Licensees may copyright their own code but cannot use segments
- * from this software for such purposes. Copyright of this software
- * remains with BladeX.
- *
- * Using this software signifies agreement to this License, and the software
- * must not be used for illegal purposes.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
- * not liable for any claims arising from secondary or illegal development.
- *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
-package ${strutil.replace(package.Entity,"pojo.entity","excel")};
+package ${strutil.replace(package.Entity,"pojo.entity","excel.gen")};
import lombok.Data;
@@ -50,7 +28,7 @@ import java.io.Serial;
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
-public class ${entityKey!}Excel implements Serializable {
+public class ${entityKey!}GenExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl
index b9b59816..3082536e 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl
+++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl
@@ -1,31 +1,9 @@
/**
- * BladeX Commercial License Agreement
- * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
- *
- * Use of this software is governed by the Commercial License Agreement
- * obtained after purchasing a license from BladeX.
- *
- * 1. This software is for development use only under a valid license
- * from BladeX.
- *
- * 2. Redistribution of this software's source code to any third party
- * without a commercial license is strictly prohibited.
- *
- * 3. Licensees may copyright their own code but cannot use segments
- * from this software for such purposes. Copyright of this software
- * remains with BladeX.
- *
- * Using this software signifies agreement to this License, and the software
- * must not be used for illegal purposes.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
- * not liable for any claims arising from secondary or illegal development.
- *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
-package ${strutil.replace(package.Entity,"entity","vo")};
+package ${strutil.replace(package.Entity,"entity","vo.gen")};
-import ${packageName!}.pojo.entity.${entityKey!}Entity;
+import ${packageName!}.pojo.entity.${entityKey!};
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
@@ -38,7 +16,7 @@ import java.io.Serial;
*/
@Data
@EqualsAndHashCode(callSuper = true)
-public class ${entityKey!}VO extends ${entityKey!}Entity {
+public class ${entityKey!}GenVO extends ${entityKey!} {
@Serial
private static final long serialVersionUID = 1L;
diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl
index d49c3d4a..0954e3fc 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl
+++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl
@@ -1,33 +1,11 @@
/**
- * BladeX Commercial License Agreement
- * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
- *
- * Use of this software is governed by the Commercial License Agreement
- * obtained after purchasing a license from BladeX.
- *
- * 1. This software is for development use only under a valid license
- * from BladeX.
- *
- * 2. Redistribution of this software's source code to any third party
- * without a commercial license is strictly prohibited.
- *
- * 3. Licensees may copyright their own code but cannot use segments
- * from this software for such purposes. Copyright of this software
- * remains with BladeX.
- *
- * Using this software signifies agreement to this License, and the software
- * must not be used for illegal purposes.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
- * not liable for any claims arising from secondary or illegal development.
- *
- * Author: Chill Zhuang (bladejava@qq.com)
+ * Author: Tom Shuo
*/
package ${package.Mapper!};
-import ${packageName!}.pojo.entity.${entityKey!}Entity;
-import ${packageName!}.pojo.vo.${entityKey!}VO;
-import ${packageName!}.excel.${entityKey!}Excel;
+import ${packageName!}.pojo.entity.${entityKey!};
+import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
+import ${packageName!}.excel.gen.${entityKey!}GenExcel;
import ${superMapperClassPackage!};
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -40,7 +18,7 @@ import java.util.List;
* @author ${author!}
* @since ${date!}
*/
-public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}Entity> {
+public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}> {
/**
* 自定义分页
@@ -49,7 +27,7 @@ public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}
* @param ${entityKeyPath!} 查询参数
* @return List<${entityKey!}VO>
*/
- List<${entityKey!}VO> select${entityKey!}Page(IPage page, ${entityKey!}VO ${entityKeyPath!});
+ List<${entityKey!}GenVO> select${entityKey!}Page(IPage page, ${entityKey!}GenVO ${entityKeyPath!});
/**
* 获取导出数据
@@ -57,6 +35,6 @@ public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}
* @param queryWrapper 查询条件
* @return List<${entityKey!}Excel>
*/
- List<${entityKey!}Excel> export${entityKey!}(@Param("ew") Wrapper<${entityKey!}Entity> queryWrapper);
+ List<${entityKey!}GenExcel> export${entityKey!}(@Param("ew") Wrapper<${entityKey!}> queryWrapper);
}
diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl
index ea15f497..fbbfc442 100644
--- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl
+++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl
@@ -7,17 +7,17 @@