Skip to content

Commit

Permalink
issue 增加手动生成代码功能
Browse files Browse the repository at this point in the history
  • Loading branch information
enilu committed Mar 5, 2023
1 parent 3869bbb commit 7bc692c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/guide/other/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
### Issues
- Change node-sass替换为dart-sass
- Change 完善微信用户登录逻辑
- 升级shrio1.11.0版本到1.11.0,1.11.0版本之前存在权限绕过漏洞风险
- Change 升级shrio1.11.0版本到1.11.0,1.11.0版本之前存在权限绕过漏洞风险
- Change 升级mysql驱动版本
- Issue 定时任务增加手动执行功能
- Issue 增加手动生成代码功能
### Fixes
- Fix 不同手机号通过绑定统一微信账号问题
- Fix 系统参数对于新增参数的时候未对同名参数进行校验
Expand Down
59 changes: 59 additions & 0 deletions linjiashop-core/src/main/java/cn/enilu/flash/CodeGenerator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package cn.enilu.flash;


import cn.enilu.flash.code.Generator;
import cn.enilu.flash.utils.Lists;

import java.util.List;

/**
* 手动生成代码<br>
* 虽然本系统提供了代码生成插件方便根据java实体生成相关业务代码,但是部分idea版本存在兼容性问题(且也没有提供eclipse的插件),因此可以使用本工具类来手动生成代码
*
* @Author enilu
* @Date 2021/5/17 11:28
* @Version 1.0
*/
public class CodeGenerator {
public static void main(String[] args) throws Exception {
//要生成的代码的java 实体的完整路径
String className = "cn.enilu.flash.bean.entity.test.Girl";
generator(className);
}

private static void generator(String className) throws Exception {

String basepath = System.getProperty("user.dir");
String[] arr = className.split("\\.");
String entityName = arr[arr.length-1];
String userPath = arr[arr.length-2];
String basePackage = className.split(".bean.entity.")[0];
List<String> param = Lists.newArrayList();
param.add("-basePath");
param.add(basepath);
param.add("-i");
param.add(entityName);
param.add("-u");
param.add("/"+userPath);
param.add("-p");
param.add(basePackage);
param.add("-v");
param.add("all");
param.add("-mod");
param.add(basePackage+"."+userPath);
param.add("-ctr");
param.add("api.controller."+userPath);
param.add("-sev");
param.add("service."+userPath);
param.add("-repo");
param.add("dao."+userPath);
param.add("controller");
param.add("service");
param.add("view");
param.add("repository");
String[] args = param.toArray(new String[param.size()]);
Generator.main(args);


}
}

0 comments on commit 7bc692c

Please sign in to comment.