作者 钟来

生成所有业务接口

@@ -5,7 +5,7 @@ import javax.validation.Valid; @@ -5,7 +5,7 @@ import javax.validation.Valid;
5 import javax.validation.constraints.NotBlank; 5 import javax.validation.constraints.NotBlank;
6 import org.apache.commons.lang3.ArrayUtils; 6 import org.apache.commons.lang3.ArrayUtils;
7 import com.ruoyi.common.constant.GenConstants; 7 import com.ruoyi.common.constant.GenConstants;
8 -import com.ruoyi.common.core.domain.BaseEntity; 8 +import com.zhonglai.luhui.common.util.domain.BaseEntity;
9 import com.ruoyi.common.utils.StringUtils; 9 import com.ruoyi.common.utils.StringUtils;
10 10
11 /** 11 /**
@@ -98,6 +98,20 @@ public class GenTable extends BaseEntity @@ -98,6 +98,20 @@ public class GenTable extends BaseEntity
98 /** 上级菜单名称字段 */ 98 /** 上级菜单名称字段 */
99 private String parentMenuName; 99 private String parentMenuName;
100 100
  101 + /**
  102 + * 模块路径
  103 + */
  104 + private String modlePath;
  105 +
  106 +
  107 + public String getModlePath() {
  108 + return modlePath;
  109 + }
  110 +
  111 + public void setModlePath(String modlePath) {
  112 + this.modlePath = modlePath;
  113 + }
  114 +
101 public Long getTableId() 115 public Long getTableId()
102 { 116 {
103 return tableId; 117 return tableId;
1 package com.ruoyi.generator.domain; 1 package com.ruoyi.generator.domain;
2 2
3 import javax.validation.constraints.NotBlank; 3 import javax.validation.constraints.NotBlank;
4 -import com.ruoyi.common.core.domain.BaseEntity; 4 +import com.zhonglai.luhui.common.util.domain.BaseEntity;
5 import com.ruoyi.common.utils.StringUtils; 5 import com.ruoyi.common.utils.StringUtils;
6 6
7 /** 7 /**
@@ -22,7 +22,7 @@ public class GenUtils @@ -22,7 +22,7 @@ public class GenUtils
22 { 22 {
23 genTable.setClassName(convertClassName(genTable.getTableName())); 23 genTable.setClassName(convertClassName(genTable.getTableName()));
24 genTable.setPackageName(GenConfig.getPackageName()); 24 genTable.setPackageName(GenConfig.getPackageName());
25 - genTable.setModuleName(getModuleName(GenConfig.getPackageName())); 25 + genTable.setModuleName(getModuleName(genTable.getTableName()));
26 genTable.setBusinessName(getBusinessName(genTable.getTableName())); 26 genTable.setBusinessName(getBusinessName(genTable.getTableName()));
27 genTable.setFunctionName(replaceText(genTable.getTableComment())); 27 genTable.setFunctionName(replaceText(genTable.getTableComment()));
28 genTable.setFunctionAuthor(GenConfig.getAuthor()); 28 genTable.setFunctionAuthor(GenConfig.getAuthor());
@@ -70,6 +70,9 @@ public class GenUtils @@ -70,6 +70,9 @@ public class GenUtils
70 else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) 70 else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10)
71 { 71 {
72 column.setJavaType(GenConstants.TYPE_INTEGER); 72 column.setJavaType(GenConstants.TYPE_INTEGER);
  73 + }else if(column.getColumnType().equals("int"))
  74 + {
  75 + column.setJavaType(GenConstants.TYPE_INTEGER);
73 } 76 }
74 // 长整形 77 // 长整形
75 else 78 else
@@ -150,9 +153,7 @@ public class GenUtils @@ -150,9 +153,7 @@ public class GenUtils
150 */ 153 */
151 public static String getModuleName(String packageName) 154 public static String getModuleName(String packageName)
152 { 155 {
153 - int lastIndex = packageName.lastIndexOf(".");  
154 - int nameLength = packageName.length();  
155 - return StringUtils.substring(packageName, lastIndex + 1, nameLength); 156 + return packageName.split("_")[0];
156 } 157 }
157 158
158 /** 159 /**
@@ -163,9 +164,7 @@ public class GenUtils @@ -163,9 +164,7 @@ public class GenUtils
163 */ 164 */
164 public static String getBusinessName(String tableName) 165 public static String getBusinessName(String tableName)
165 { 166 {
166 - int lastIndex = tableName.lastIndexOf("_");  
167 - int nameLength = tableName.length();  
168 - return StringUtils.substring(tableName, lastIndex + 1, nameLength); 167 + return tableName.substring(tableName.indexOf("_")+1);
169 } 168 }
170 169
171 /** 170 /**
@@ -41,6 +41,7 @@ public class VelocityUtils @@ -41,6 +41,7 @@ public class VelocityUtils
41 String packageName = genTable.getPackageName(); 41 String packageName = genTable.getPackageName();
42 String tplCategory = genTable.getTplCategory(); 42 String tplCategory = genTable.getTplCategory();
43 String functionName = genTable.getFunctionName(); 43 String functionName = genTable.getFunctionName();
  44 + String modlePath = genTable.getModlePath();
44 45
45 VelocityContext velocityContext = new VelocityContext(); 46 VelocityContext velocityContext = new VelocityContext();
46 velocityContext.put("tplCategory", genTable.getTplCategory()); 47 velocityContext.put("tplCategory", genTable.getTplCategory());
@@ -57,10 +58,11 @@ public class VelocityUtils @@ -57,10 +58,11 @@ public class VelocityUtils
57 velocityContext.put("datetime", DateUtils.getDate()); 58 velocityContext.put("datetime", DateUtils.getDate());
58 velocityContext.put("pkColumn", genTable.getPkColumn()); 59 velocityContext.put("pkColumn", genTable.getPkColumn());
59 velocityContext.put("importList", getImportList(genTable)); 60 velocityContext.put("importList", getImportList(genTable));
60 - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); 61 + velocityContext.put("permissionPrefix", getPermissionPrefix(modlePath,moduleName, businessName));
61 velocityContext.put("columns", genTable.getColumns()); 62 velocityContext.put("columns", genTable.getColumns());
62 velocityContext.put("table", genTable); 63 velocityContext.put("table", genTable);
63 velocityContext.put("dicts", getDicts(genTable)); 64 velocityContext.put("dicts", getDicts(genTable));
  65 + velocityContext.put("modlePath", modlePath);
64 setMenuVelocityContext(velocityContext, genTable); 66 setMenuVelocityContext(velocityContext, genTable);
65 if (GenConstants.TPL_TREE.equals(tplCategory)) 67 if (GenConstants.TPL_TREE.equals(tplCategory))
66 { 68 {
@@ -136,11 +138,11 @@ public class VelocityUtils @@ -136,11 +138,11 @@ public class VelocityUtils
136 } 138 }
137 List<String> templates = new ArrayList<String>(); 139 List<String> templates = new ArrayList<String>();
138 templates.add("vm/java/domain.java.vm"); 140 templates.add("vm/java/domain.java.vm");
139 - templates.add("vm/java/mapper.java.vm");  
140 - templates.add("vm/java/service.java.vm");  
141 - templates.add("vm/java/serviceImpl.java.vm"); 141 +// templates.add("vm/java/mapper.java.vm");
  142 +// templates.add("vm/java/service.java.vm");
  143 +// templates.add("vm/java/serviceImpl.java.vm");
142 templates.add("vm/java/controller.java.vm"); 144 templates.add("vm/java/controller.java.vm");
143 - templates.add("vm/xml/mapper.xml.vm"); 145 +// templates.add("vm/xml/mapper.xml.vm");
144 templates.add("vm/sql/sql.vm"); 146 templates.add("vm/sql/sql.vm");
145 templates.add("vm/js/api.js.vm"); 147 templates.add("vm/js/api.js.vm");
146 if (GenConstants.TPL_CRUD.equals(tplCategory)) 148 if (GenConstants.TPL_CRUD.equals(tplCategory))
@@ -175,17 +177,20 @@ public class VelocityUtils @@ -175,17 +177,20 @@ public class VelocityUtils
175 // 业务名称 177 // 业务名称
176 String businessName = genTable.getBusinessName(); 178 String businessName = genTable.getBusinessName();
177 179
  180 + //业务项目的路径
  181 + String modlePath = genTable.getModlePath();
  182 +
178 String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); 183 String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
179 String mybatisPath = MYBATIS_PATH + "/" + moduleName; 184 String mybatisPath = MYBATIS_PATH + "/" + moduleName;
180 String vuePath = "vue"; 185 String vuePath = "vue";
181 186
182 if (template.contains("domain.java.vm")) 187 if (template.contains("domain.java.vm"))
183 { 188 {
184 - fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); 189 + fileName = StringUtils.format("{}/domain/{}/{}.java", javaPath,moduleName, className);
185 } 190 }
186 if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) 191 if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
187 { 192 {
188 - fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); 193 + fileName = StringUtils.format("{}/domain/{}/{}.java", javaPath, moduleName,genTable.getSubTable().getClassName());
189 } 194 }
190 else if (template.contains("mapper.java.vm")) 195 else if (template.contains("mapper.java.vm"))
191 { 196 {
@@ -201,7 +206,7 @@ public class VelocityUtils @@ -201,7 +206,7 @@ public class VelocityUtils
201 } 206 }
202 else if (template.contains("controller.java.vm")) 207 else if (template.contains("controller.java.vm"))
203 { 208 {
204 - fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); 209 + fileName = StringUtils.format("{}/{}/controller/{}/{}Controller.java", javaPath,modlePath,moduleName, className);
205 } 210 }
206 else if (template.contains("mapper.xml.vm")) 211 else if (template.contains("mapper.xml.vm"))
207 { 212 {
@@ -313,9 +318,9 @@ public class VelocityUtils @@ -313,9 +318,9 @@ public class VelocityUtils
313 * @param businessName 业务名称 318 * @param businessName 业务名称
314 * @return 返回权限前缀 319 * @return 返回权限前缀
315 */ 320 */
316 - public static String getPermissionPrefix(String moduleName, String businessName) 321 + public static String getPermissionPrefix(String modlePath,String moduleName, String businessName)
317 { 322 {
318 - return StringUtils.format("{}:{}", moduleName, businessName); 323 + return StringUtils.format("{}:{}:{}",modlePath, moduleName, businessName);
319 } 324 }
320 325
321 /** 326 /**
1 # 代码生成 1 # 代码生成
2 gen: 2 gen:
3 # 作者 3 # 作者
4 - author: ruoyi 4 + author: zhonglai
5 # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool 5 # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
6 - packageName: com.ruoyi.system 6 + packageName: com.zhonglai.luhui
7 # 自动去除表前缀,默认是false 7 # 自动去除表前缀,默认是false
8 autoRemovePre: false 8 autoRemovePre: false
9 # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) 9 # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
1 -package ${packageName}.controller; 1 +package ${packageName}.${modlePath}.controller.${moduleName};
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import com.ruoyi.common.annotation.DataSource;
  5 +import com.ruoyi.common.enums.DataSourceType;
4 import javax.servlet.http.HttpServletResponse; 6 import javax.servlet.http.HttpServletResponse;
  7 +import io.swagger.annotations.Api;
  8 +import io.swagger.annotations.ApiOperation;
5 import org.springframework.security.access.prepost.PreAuthorize; 9 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.GetMapping; 11 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,9 +20,10 @@ import com.ruoyi.common.annotation.Log; @@ -16,9 +20,10 @@ import com.ruoyi.common.annotation.Log;
16 import com.ruoyi.common.core.controller.BaseController; 20 import com.ruoyi.common.core.controller.BaseController;
17 import com.ruoyi.common.core.domain.AjaxResult; 21 import com.ruoyi.common.core.domain.AjaxResult;
18 import com.ruoyi.common.enums.BusinessType; 22 import com.ruoyi.common.enums.BusinessType;
19 -import ${packageName}.domain.${ClassName};  
20 -import ${packageName}.service.I${ClassName}Service; 23 +import com.zhonglai.luhui.dao.service.PublicTemplateService;
  24 +import ${packageName}.domain.${moduleName}.${ClassName};
21 import com.ruoyi.common.utils.poi.ExcelUtil; 25 import com.ruoyi.common.utils.poi.ExcelUtil;
  26 +
22 #if($table.crud || $table.sub) 27 #if($table.crud || $table.sub)
23 import com.ruoyi.common.core.page.TableDataInfo; 28 import com.ruoyi.common.core.page.TableDataInfo;
24 #elseif($table.tree) 29 #elseif($table.tree)
@@ -30,86 +35,91 @@ import com.ruoyi.common.core.page.TableDataInfo; @@ -30,86 +35,91 @@ import com.ruoyi.common.core.page.TableDataInfo;
30 * @author ${author} 35 * @author ${author}
31 * @date ${datetime} 36 * @date ${datetime}
32 */ 37 */
  38 +@Api(tags = "${functionName}")
33 @RestController 39 @RestController
34 -@RequestMapping("/${moduleName}/${businessName}") 40 +@RequestMapping("/${modlePath}/${moduleName}/${businessName}")
35 public class ${ClassName}Controller extends BaseController 41 public class ${ClassName}Controller extends BaseController
36 { 42 {
37 @Autowired 43 @Autowired
38 - private I${ClassName}Service ${className}Service; 44 + private PublicTemplateService publicTemplateService;
39 45
40 - /**  
41 - * 查询${functionName}列表  
42 - */ 46 + @ApiOperation(value ="查询${functionName}列表",notes="\n" +
  47 + "公共参数描述:\n" +
  48 + "条件参数:\n" +
  49 + "timeMap; //时间条件(如:{\"create_time\":[开始时间,结束时间]})\n" +
  50 + "keyValue; //模糊匹配的关键字(如:[\"value\",\"name,no\"])\n" +
  51 + "queryParams; //字段对应的比较符号(如:{\"id\":\"EQ\"})\n" +
  52 + "orderBy; //排序(如:\"id desc,name asc\")\n" +
  53 + "\n" +
  54 + "分页参数:\n" +
  55 + "pageNum; //当前记录起始索引,从1开始\n" +
  56 + "pageSize; //每页显示记录数")
  57 + @DataSource(DataSourceType.SLAVE)
43 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") 58 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
44 @GetMapping("/list") 59 @GetMapping("/list")
45 #if($table.crud || $table.sub) 60 #if($table.crud || $table.sub)
46 public TableDataInfo list(${ClassName} ${className}) 61 public TableDataInfo list(${ClassName} ${className})
47 { 62 {
48 startPage(); 63 startPage();
49 - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); 64 + List<${ClassName}> list = publicTemplateService.selectTList(${className});
50 return getDataTable(list); 65 return getDataTable(list);
51 } 66 }
52 #elseif($table.tree) 67 #elseif($table.tree)
53 public AjaxResult list(${ClassName} ${className}) 68 public AjaxResult list(${ClassName} ${className})
54 { 69 {
55 - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); 70 + List<${ClassName}> list = publicTemplateService.selectTList(${className});
56 return success(list); 71 return success(list);
57 } 72 }
58 #end 73 #end
59 74
60 - /**  
61 - * 导出${functionName}列表  
62 - */ 75 + @ApiOperation("导出${functionName}列表")
  76 + @DataSource(DataSourceType.SLAVE)
63 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") 77 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
64 @Log(title = "${functionName}", businessType = BusinessType.EXPORT) 78 @Log(title = "${functionName}", businessType = BusinessType.EXPORT)
65 @PostMapping("/export") 79 @PostMapping("/export")
66 public void export(HttpServletResponse response, ${ClassName} ${className}) 80 public void export(HttpServletResponse response, ${ClassName} ${className})
67 { 81 {
68 - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); 82 + List<${ClassName}> list = publicTemplateService.selectTList(${className});
69 ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); 83 ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
70 util.exportExcel(response, list, "${functionName}数据"); 84 util.exportExcel(response, list, "${functionName}数据");
71 } 85 }
72 86
73 - /**  
74 - * 获取${functionName}详细信息  
75 - */ 87 + @ApiOperation("获取${functionName}详细信息")
  88 + @DataSource(DataSourceType.SLAVE)
76 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") 89 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
77 @GetMapping(value = "/{${pkColumn.javaField}}") 90 @GetMapping(value = "/{${pkColumn.javaField}}")
78 public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) 91 public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
79 { 92 {
80 - return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); 93 + return success(publicTemplateService.getTById(${pkColumn.javaField}, ${ClassName}.class));
81 } 94 }
82 95
83 - /**  
84 - * 新增${functionName}  
85 - */ 96 + @ApiOperation("新增${functionName}")
  97 + @DataSource(DataSourceType.SLAVE)
86 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") 98 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
87 @Log(title = "${functionName}", businessType = BusinessType.INSERT) 99 @Log(title = "${functionName}", businessType = BusinessType.INSERT)
88 @PostMapping 100 @PostMapping
89 public AjaxResult add(@RequestBody ${ClassName} ${className}) 101 public AjaxResult add(@RequestBody ${ClassName} ${className})
90 { 102 {
91 - return toAjax(${className}Service.insert${ClassName}(${className})); 103 + return toAjax(publicTemplateService.add(${className}));
92 } 104 }
93 105
94 - /**  
95 - * 修改${functionName}  
96 - */ 106 + @ApiOperation("修改${functionName}")
  107 + @DataSource(DataSourceType.SLAVE)
97 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") 108 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
98 @Log(title = "${functionName}", businessType = BusinessType.UPDATE) 109 @Log(title = "${functionName}", businessType = BusinessType.UPDATE)
99 @PutMapping 110 @PutMapping
100 public AjaxResult edit(@RequestBody ${ClassName} ${className}) 111 public AjaxResult edit(@RequestBody ${ClassName} ${className})
101 { 112 {
102 - return toAjax(${className}Service.update${ClassName}(${className})); 113 + return toAjax(publicTemplateService.edit((${className})));
103 } 114 }
104 115
105 - /**  
106 - * 删除${functionName}  
107 - */ 116 + @ApiOperation("删除${functionName}")
  117 + @DataSource(DataSourceType.SLAVE)
108 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") 118 @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
109 @Log(title = "${functionName}", businessType = BusinessType.DELETE) 119 @Log(title = "${functionName}", businessType = BusinessType.DELETE)
110 @DeleteMapping("/{${pkColumn.javaField}s}") 120 @DeleteMapping("/{${pkColumn.javaField}s}")
111 public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) 121 public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
112 { 122 {
113 - return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); 123 + return toAjax(publicTemplateService.removeByIds(${ClassName}.class,${pkColumn.javaField}s));
114 } 124 }
115 } 125 }
1 -package ${packageName}.domain; 1 +package ${packageName}.domain.${moduleName};
2 2
3 #foreach ($import in $importList) 3 #foreach ($import in $importList)
4 import ${import}; 4 import ${import};
5 #end 5 #end
6 import org.apache.commons.lang3.builder.ToStringBuilder; 6 import org.apache.commons.lang3.builder.ToStringBuilder;
7 import org.apache.commons.lang3.builder.ToStringStyle; 7 import org.apache.commons.lang3.builder.ToStringStyle;
8 -import com.ruoyi.common.annotation.Excel; 8 +import com.zhonglai.luhui.common.util.annotation.Excel;
  9 +import io.swagger.annotations.ApiModel;
  10 +import io.swagger.annotations.ApiModelProperty;
9 #if($table.crud || $table.sub) 11 #if($table.crud || $table.sub)
10 -import com.ruoyi.common.core.domain.BaseEntity; 12 +import com.zhonglai.luhui.common.util.domain.BaseEntity;
11 #elseif($table.tree) 13 #elseif($table.tree)
12 -import com.ruoyi.common.core.domain.TreeEntity;  
13 #end 14 #end
14 15
15 /** 16 /**
@@ -18,6 +19,7 @@ import com.ruoyi.common.core.domain.TreeEntity; @@ -18,6 +19,7 @@ import com.ruoyi.common.core.domain.TreeEntity;
18 * @author ${author} 19 * @author ${author}
19 * @date ${datetime} 20 * @date ${datetime}
20 */ 21 */
  22 +@ApiModel("${functionName}")
21 #if($table.crud || $table.sub) 23 #if($table.crud || $table.sub)
22 #set($Entity="BaseEntity") 24 #set($Entity="BaseEntity")
23 #elseif($table.tree) 25 #elseif($table.tree)
@@ -28,27 +30,30 @@ public class ${ClassName} extends ${Entity} @@ -28,27 +30,30 @@ public class ${ClassName} extends ${Entity}
28 private static final long serialVersionUID = 1L; 30 private static final long serialVersionUID = 1L;
29 31
30 #foreach ($column in $columns) 32 #foreach ($column in $columns)
31 -#if(!$table.isSuperColumn($column.javaField)) 33 + #if(!$table.isSuperColumn($column.javaField))
32 /** $column.columnComment */ 34 /** $column.columnComment */
33 -#if($column.list)  
34 -#set($parentheseIndex=$column.columnComment.indexOf("("))  
35 -#if($parentheseIndex != -1)  
36 -#set($comment=$column.columnComment.substring(0, $parentheseIndex))  
37 -#else  
38 -#set($comment=$column.columnComment)  
39 -#end  
40 -#if($parentheseIndex != -1)  
41 - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")  
42 -#elseif($column.javaType == 'Date')  
43 - @JsonFormat(pattern = "yyyy-MM-dd")  
44 - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")  
45 -#else  
46 - @Excel(name = "${comment}")  
47 -#end  
48 -#end 35 + #if($column.list)
  36 + #set($parentheseIndex=$column.columnComment.indexOf("("))
  37 + #if($parentheseIndex != -1)
  38 + #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  39 + #else
  40 + #set($comment=$column.columnComment)
  41 + #end
  42 + #if($parentheseIndex != -1)
  43 + @ApiModelProperty(value="${comment}",allowableValues="$column.readConverterExp()")
  44 + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
  45 + #elseif($column.javaType == 'Date')
  46 + @JsonFormat(pattern = "yyyy-MM-dd")
  47 + @ApiModelProperty(value="${comment}")
  48 + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
  49 + #else
  50 + @ApiModelProperty(value="${comment}")
  51 + @Excel(name = "${comment}")
  52 + #end
  53 + #end
49 private $column.javaType $column.javaField; 54 private $column.javaType $column.javaField;
50 55
51 -#end 56 + #end
52 #end 57 #end
53 #if($table.sub) 58 #if($table.sub)
54 /** $table.subTable.functionName信息 */ 59 /** $table.subTable.functionName信息 */
@@ -5,8 +5,8 @@ import ${import}; @@ -5,8 +5,8 @@ import ${import};
5 #end 5 #end
6 import org.apache.commons.lang3.builder.ToStringBuilder; 6 import org.apache.commons.lang3.builder.ToStringBuilder;
7 import org.apache.commons.lang3.builder.ToStringStyle; 7 import org.apache.commons.lang3.builder.ToStringStyle;
8 -import com.ruoyi.common.annotation.Excel;  
9 -import com.ruoyi.common.core.domain.BaseEntity; 8 +import com.zhonglai.luhui.common.util.annotation.Excel;
  9 +import com.zhonglai.luhui.common.util.domain.BaseEntity;
10 10
11 /** 11 /**
12 * ${subTable.functionName}对象 ${subTableName} 12 * ${subTable.functionName}对象 ${subTableName}
@@ -3,7 +3,7 @@ import request from '@/utils/request' @@ -3,7 +3,7 @@ import request from '@/utils/request'
3 // 查询${functionName}列表 3 // 查询${functionName}列表
4 export function list${BusinessName}(query) { 4 export function list${BusinessName}(query) {
5 return request({ 5 return request({
6 - url: '/${moduleName}/${businessName}/list', 6 + url: '/${modlePath}/${moduleName}/${businessName}/list',
7 method: 'get', 7 method: 'get',
8 params: query 8 params: query
9 }) 9 })
@@ -12,7 +12,7 @@ export function list${BusinessName}(query) { @@ -12,7 +12,7 @@ export function list${BusinessName}(query) {
12 // 查询${functionName}详细 12 // 查询${functionName}详细
13 export function get${BusinessName}(${pkColumn.javaField}) { 13 export function get${BusinessName}(${pkColumn.javaField}) {
14 return request({ 14 return request({
15 - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 15 + url: '/${modlePath}/${moduleName}/${businessName}/' + ${pkColumn.javaField},
16 method: 'get' 16 method: 'get'
17 }) 17 })
18 } 18 }
@@ -20,7 +20,7 @@ export function get${BusinessName}(${pkColumn.javaField}) { @@ -20,7 +20,7 @@ export function get${BusinessName}(${pkColumn.javaField}) {
20 // 新增${functionName} 20 // 新增${functionName}
21 export function add${BusinessName}(data) { 21 export function add${BusinessName}(data) {
22 return request({ 22 return request({
23 - url: '/${moduleName}/${businessName}', 23 + url: '/${modlePath}/${moduleName}/${businessName}',
24 method: 'post', 24 method: 'post',
25 data: data 25 data: data
26 }) 26 })
@@ -29,7 +29,7 @@ export function add${BusinessName}(data) { @@ -29,7 +29,7 @@ export function add${BusinessName}(data) {
29 // 修改${functionName} 29 // 修改${functionName}
30 export function update${BusinessName}(data) { 30 export function update${BusinessName}(data) {
31 return request({ 31 return request({
32 - url: '/${moduleName}/${businessName}', 32 + url: '/${modlePath}/${moduleName}/${businessName}',
33 method: 'put', 33 method: 'put',
34 data: data 34 data: data
35 }) 35 })
@@ -38,7 +38,7 @@ export function update${BusinessName}(data) { @@ -38,7 +38,7 @@ export function update${BusinessName}(data) {
38 // 删除${functionName} 38 // 删除${functionName}
39 export function del${BusinessName}(${pkColumn.javaField}) { 39 export function del${BusinessName}(${pkColumn.javaField}) {
40 return request({ 40 return request({
41 - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 41 + url: '/${modlePath}/${moduleName}/${businessName}/' + ${pkColumn.javaField},
42 method: 'delete' 42 method: 'delete'
43 }) 43 })
44 } 44 }
1 -- 菜单 SQL 1 -- 菜单 SQL
2 insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) 2 insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
3 -values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); 3 +values('${functionName}', 2006, '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单');
4 4
5 -- 按钮父菜单ID 5 -- 按钮父菜单ID
6 SELECT @parentId := LAST_INSERT_ID(); 6 SELECT @parentId := LAST_INSERT_ID();
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 icon="el-icon-plus" 75 icon="el-icon-plus"
76 size="mini" 76 size="mini"
77 @click="handleAdd" 77 @click="handleAdd"
78 - v-hasPermi="['${moduleName}:${businessName}:add']" 78 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']"
79 >新增</el-button> 79 >新增</el-button>
80 </el-col> 80 </el-col>
81 <el-col :span="1.5"> 81 <el-col :span="1.5">
@@ -144,21 +144,21 @@ @@ -144,21 +144,21 @@
144 type="text" 144 type="text"
145 icon="el-icon-edit" 145 icon="el-icon-edit"
146 @click="handleUpdate(scope.row)" 146 @click="handleUpdate(scope.row)"
147 - v-hasPermi="['${moduleName}:${businessName}:edit']" 147 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']"
148 >修改</el-button> 148 >修改</el-button>
149 <el-button 149 <el-button
150 size="mini" 150 size="mini"
151 type="text" 151 type="text"
152 icon="el-icon-plus" 152 icon="el-icon-plus"
153 @click="handleAdd(scope.row)" 153 @click="handleAdd(scope.row)"
154 - v-hasPermi="['${moduleName}:${businessName}:add']" 154 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']"
155 >新增</el-button> 155 >新增</el-button>
156 <el-button 156 <el-button
157 size="mini" 157 size="mini"
158 type="text" 158 type="text"
159 icon="el-icon-delete" 159 icon="el-icon-delete"
160 @click="handleDelete(scope.row)" 160 @click="handleDelete(scope.row)"
161 - v-hasPermi="['${moduleName}:${businessName}:remove']" 161 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']"
162 >删除</el-button> 162 >删除</el-button>
163 </template> 163 </template>
164 </el-table-column> 164 </el-table-column>
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 icon="el-icon-plus" 75 icon="el-icon-plus"
76 size="mini" 76 size="mini"
77 @click="handleAdd" 77 @click="handleAdd"
78 - v-hasPermi="['${moduleName}:${businessName}:add']" 78 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']"
79 >新增</el-button> 79 >新增</el-button>
80 </el-col> 80 </el-col>
81 <el-col :span="1.5"> 81 <el-col :span="1.5">
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 size="mini" 86 size="mini"
87 :disabled="single" 87 :disabled="single"
88 @click="handleUpdate" 88 @click="handleUpdate"
89 - v-hasPermi="['${moduleName}:${businessName}:edit']" 89 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']"
90 >修改</el-button> 90 >修改</el-button>
91 </el-col> 91 </el-col>
92 <el-col :span="1.5"> 92 <el-col :span="1.5">
@@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@
97 size="mini" 97 size="mini"
98 :disabled="multiple" 98 :disabled="multiple"
99 @click="handleDelete" 99 @click="handleDelete"
100 - v-hasPermi="['${moduleName}:${businessName}:remove']" 100 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']"
101 >删除</el-button> 101 >删除</el-button>
102 </el-col> 102 </el-col>
103 <el-col :span="1.5"> 103 <el-col :span="1.5">
@@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
107 icon="el-icon-download" 107 icon="el-icon-download"
108 size="mini" 108 size="mini"
109 @click="handleExport" 109 @click="handleExport"
110 - v-hasPermi="['${moduleName}:${businessName}:export']" 110 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:export']"
111 >导出</el-button> 111 >导出</el-button>
112 </el-col> 112 </el-col>
113 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 113 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -158,14 +158,14 @@ @@ -158,14 +158,14 @@
158 type="text" 158 type="text"
159 icon="el-icon-edit" 159 icon="el-icon-edit"
160 @click="handleUpdate(scope.row)" 160 @click="handleUpdate(scope.row)"
161 - v-hasPermi="['${moduleName}:${businessName}:edit']" 161 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']"
162 >修改</el-button> 162 >修改</el-button>
163 <el-button 163 <el-button
164 size="mini" 164 size="mini"
165 type="text" 165 type="text"
166 icon="el-icon-delete" 166 icon="el-icon-delete"
167 @click="handleDelete(scope.row)" 167 @click="handleDelete(scope.row)"
168 - v-hasPermi="['${moduleName}:${businessName}:remove']" 168 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']"
169 >删除</el-button> 169 >删除</el-button>
170 </template> 170 </template>
171 </el-table-column> 171 </el-table-column>
@@ -593,7 +593,7 @@ export default { @@ -593,7 +593,7 @@ export default {
593 #end 593 #end
594 /** 导出按钮操作 */ 594 /** 导出按钮操作 */
595 handleExport() { 595 handleExport() {
596 - this.download('${moduleName}/${businessName}/export', { 596 + this.download('${modlePath}/${moduleName}/${businessName}/export', {
597 ...this.queryParams 597 ...this.queryParams
598 }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) 598 }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
599 } 599 }
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 plain 73 plain
74 icon="Plus" 74 icon="Plus"
75 @click="handleAdd" 75 @click="handleAdd"
76 - v-hasPermi="['${moduleName}:${businessName}:add']" 76 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']"
77 >新增</el-button> 77 >新增</el-button>
78 </el-col> 78 </el-col>
79 <el-col :span="1.5"> 79 <el-col :span="1.5">
@@ -136,9 +136,9 @@ @@ -136,9 +136,9 @@
136 #end 136 #end
137 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 137 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
138 <template #default="scope"> 138 <template #default="scope">
139 - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>  
140 - <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">新增</el-button>  
141 - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> 139 + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']">修改</el-button>
  140 + <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']">新增</el-button>
  141 + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']">删除</el-button>
142 </template> 142 </template>
143 </el-table-column> 143 </el-table-column>
144 </el-table> 144 </el-table>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 plain 73 plain
74 icon="Plus" 74 icon="Plus"
75 @click="handleAdd" 75 @click="handleAdd"
76 - v-hasPermi="['${moduleName}:${businessName}:add']" 76 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:add']"
77 >新增</el-button> 77 >新增</el-button>
78 </el-col> 78 </el-col>
79 <el-col :span="1.5"> 79 <el-col :span="1.5">
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 icon="Edit" 83 icon="Edit"
84 :disabled="single" 84 :disabled="single"
85 @click="handleUpdate" 85 @click="handleUpdate"
86 - v-hasPermi="['${moduleName}:${businessName}:edit']" 86 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']"
87 >修改</el-button> 87 >修改</el-button>
88 </el-col> 88 </el-col>
89 <el-col :span="1.5"> 89 <el-col :span="1.5">
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 icon="Delete" 93 icon="Delete"
94 :disabled="multiple" 94 :disabled="multiple"
95 @click="handleDelete" 95 @click="handleDelete"
96 - v-hasPermi="['${moduleName}:${businessName}:remove']" 96 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']"
97 >删除</el-button> 97 >删除</el-button>
98 </el-col> 98 </el-col>
99 <el-col :span="1.5"> 99 <el-col :span="1.5">
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 plain 102 plain
103 icon="Download" 103 icon="Download"
104 @click="handleExport" 104 @click="handleExport"
105 - v-hasPermi="['${moduleName}:${businessName}:export']" 105 + v-hasPermi="['${modlePath}:${moduleName}:${businessName}:export']"
106 >导出</el-button> 106 >导出</el-button>
107 </el-col> 107 </el-col>
108 <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> 108 <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@@ -148,8 +148,8 @@ @@ -148,8 +148,8 @@
148 #end 148 #end
149 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 149 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
150 <template #default="scope"> 150 <template #default="scope">
151 - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>  
152 - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> 151 + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${modlePath}:${moduleName}:${businessName}:edit']">修改</el-button>
  152 + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${modlePath}:${moduleName}:${businessName}:remove']">删除</el-button>
153 </template> 153 </template>
154 </el-table-column> 154 </el-table-column>
155 </el-table> 155 </el-table>
@@ -581,7 +581,7 @@ function handle${subClassName}SelectionChange(selection) { @@ -581,7 +581,7 @@ function handle${subClassName}SelectionChange(selection) {
581 #end 581 #end
582 /** 导出按钮操作 */ 582 /** 导出按钮操作 */
583 function handleExport() { 583 function handleExport() {
584 - proxy.download('${moduleName}/${businessName}/export', { 584 + proxy.download('${modlePath}/${moduleName}/${businessName}/export', {
585 ...queryParams.value 585 ...queryParams.value
586 }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) 586 }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
587 } 587 }