同步ruoyi4,1最新版本,修复订单发货及其规格修改bug

This commit is contained in:
hupeng committed 2019-12-10 11:49:08 +08:00
1 parent d2306354db
commit 49e46e68c4
156 files changed
+12006 -10025

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.0.0</version>
<version>4.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -21,8 +21,8 @@ public class GenConfig
/** 生成包路径 */
public static String packageName;
/** 自动去除表前缀,默认是true */
public static String autoRemovePre;
/** 自动去除表前缀,默认是false */
public static boolean autoRemovePre;
/** 表前缀(类名不会包含表前缀) */
public static String tablePrefix;
@@ -49,13 +49,13 @@ public class GenConfig
GenConfig.packageName = packageName;
}
public static String getAutoRemovePre()
public static boolean getAutoRemovePre()
{
return autoRemovePre;
}
@Value("${autoRemovePre}")
public void setAutoRemovePre(String autoRemovePre)
public void setAutoRemovePre(boolean autoRemovePre)
{
GenConfig.autoRemovePre = autoRemovePre;
}
@@ -252,4 +252,18 @@ public class GenTable extends BaseEntity
{
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
}
public boolean isSuperColumn(String javaField)
{
return isSuperColumn(this.tplCategory, javaField);
}
public static boolean isSuperColumn(String tplCategory, String javaField)
{
if (isTree(tplCategory))
{
StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.TREE_ENTITY);
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}
}
@@ -325,7 +325,22 @@ public class GenTableColumn extends BaseEntity
public static boolean isSuperColumn(String javaField)
{
return StringUtils.equalsAnyIgnoreCase(javaField, "createBy", "createTime", "updateBy", "updateTime", "remark");
return StringUtils.equalsAnyIgnoreCase(javaField,
//BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
//TreeEntity
"parentName", "parentId", "orderNum", "ancestors");
}
public boolean isUsableColumn()
{
return isUsableColumn(javaField);
}
public static boolean isUsableColumn(String javaField)
{
//isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单
return StringUtils.equalsAnyIgnoreCase(javaField, "parentId" , "orderNum");
}
public String readConverterExp()
@@ -263,6 +263,7 @@ public class GenTableServiceImpl implements IGenTableService
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
IOUtils.write(sw.toString(), zip, Constants.UTF8);
IOUtils.closeQuietly(sw);
zip.flush();
zip.closeEntry();
}
catch (IOException e)
@@ -1,6 +1,7 @@
package com.ruoyi.generator.util;
import java.util.Arrays;
import org.apache.commons.lang3.RegExUtils;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.config.GenConfig;
@@ -19,7 +20,7 @@ public class GenUtils
*/
public static void initTable(GenTable genTable, String operName)
{
genTable.setClassName(StringUtils.convertToCamelCase(genTable.getTableName()));
genTable.setClassName(convertClassName(genTable.getTableName()));
genTable.setPackageName(GenConfig.getPackageName());
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
@@ -152,6 +153,25 @@ public class GenUtils
return businessName;
}
/**
* 表名转换成Java类名
*
* @param tableName 表名称
* @return 类名
*/
public static String convertClassName(String tableName)
{
boolean autoRemovePre = GenConfig.getAutoRemovePre();
String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
{
String[] searchList = StringUtils.split(tablePrefix, ",");
String[] replacementList = emptyList(searchList.length);
tableName = StringUtils.replaceEach(tableName, searchList, replacementList);
}
return StringUtils.convertToCamelCase(tableName);
}
/**
* 关键字替换
*
@@ -160,7 +180,7 @@ public class GenUtils
*/
public static String replaceText(String text)
{
return text.replaceAll("(?:表|若依)", "");
return RegExUtils.replaceAll(text, "(?:表|若依)", "");
}
/**
@@ -199,4 +219,20 @@ public class GenUtils
return 0;
}
}
/**
* 获取空数组列表
*
* @param length 长度
* @return 数组信息
*/
public static String[] emptyList(int length)
{
String[] values = new String[length];
for (int i = 0; i < length; i++)
{
values[i] = StringUtils.EMPTY;
}
return values;
}
}
@@ -2,10 +2,10 @@
# 代码生成
gen:
# 作者
author: hupeng
author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.shop
# 自动去除表前缀,默认是true
autoRemovePre: true
# 表前缀(类名不会包含表前缀)
tablePrefix: store_
packageName: com.ruoyi.system
# 自动去除表前缀,默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
@@ -57,10 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectGenTableVo"/>
<where>
<if test="tableName != null and tableName != ''">
AND table_name like concat('%', #{tableName}, '%')
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND table_comment like concat('%', #{tableComment}, '%')
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
</where>
</select>
@@ -71,10 +71,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND table_name like concat('%', #{tableName}, '%')
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND table_comment like concat('%', #{tableComment}, '%')
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
</select>
@@ -47,7 +47,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
@@ -68,7 +68,10 @@
sortOrder: "desc",
showExport: true,
modalName: "生成配置",
rememberSelected: true,
uniqueId: "tableId",
columns: [{
field: 'state',
checkbox: true
},
{
@@ -26,7 +26,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
@@ -44,7 +44,10 @@
showToggle: false,
showColumns: false,
clickToSelect: true,
rememberSelected: true,
uniqueId: "tableName",
columns: [{
field: 'state',
checkbox: true
},
{
@@ -14,7 +14,8 @@
<form class="form-horizontal m" id="form-${businessName}-add">
#foreach($column in $columns)
#set($field=$column.javaField)
#if($column.insert && !$column.superColumn && !$column.pk)
#if($column.insert && !$column.pk)
#if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf("("))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
@@ -66,8 +67,8 @@
<label class="col-sm-3 control-label">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:checked="${dict.default}"#if($column.required) required#end>
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:checked="${dict.default}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
@@ -101,6 +102,7 @@
</div>
#end
#end
#end
#end
</form>
</div>
@@ -130,7 +132,6 @@
minView: "month",
autoclose: true
});
#break
#end
#end
#if($table.tree)
@@ -14,7 +14,8 @@
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
<input name="${pkColumn.javaField}" th:field="*{${pkColumn.javaField}}" type="hidden">
#foreach($column in $columns)
#if($column.edit && !$column.superColumn && !$column.pk)
#if($column.edit && !$column.pk)
#if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf("("))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
@@ -66,8 +67,8 @@
<label class="col-sm-3 control-label">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:field="*{${field}}"#if($column.required) required#end>
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:field="*{${field}}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
@@ -101,6 +102,7 @@
</div>
#end
#end
#end
#end
</form>
</div>
@@ -130,7 +132,6 @@
minView: "month",
autoclose: true
});
#break
#end
#end
#if($table.tree)
@@ -74,7 +74,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
@@ -46,19 +46,7 @@ public class ${ClassName}Controller extends BaseController
return prefix + "/${businessName}";
}
#if($table.tree)
/**
* 查询${functionName}树列表
*/
@RequiresPermissions("${permissionPrefix}:list")
@PostMapping("/list")
@ResponseBody
public List<${ClassName}> list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return list;
}
#elseif($table.crud)
#if($table.crud)
/**
* 查询${functionName}列表
*/
@@ -71,12 +59,25 @@ public class ${ClassName}Controller extends BaseController
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list);
}
#elseif($table.tree)
/**
* 查询${functionName}树列表
*/
@RequiresPermissions("${permissionPrefix}:list")
@PostMapping("/list")
@ResponseBody
public List<${ClassName}> list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return list;
}
#end
/**
* 导出${functionName}列表
*/
@RequiresPermissions("${permissionPrefix}:export")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(${ClassName} ${className})
@@ -28,7 +28,7 @@ public class ${ClassName} extends ${Entity}
private static final long serialVersionUID = 1L;
#foreach ($column in $columns)
#if(!$column.superColumn)
#if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */
#if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("("))
@@ -50,8 +50,12 @@ public class ${ClassName} extends ${Entity}
#end
#end
#foreach ($column in $columns)
#if(!$column.superColumn)
#if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
public void set${AttrName}($column.javaType $column.javaField)
{
this.$column.javaField = $column.javaField;
@@ -68,7 +72,11 @@ public class ${ClassName} extends ${Entity}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
#foreach ($column in $columns)
#if($column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
.append("${column.javaField}", get${AttrName}())
#end
.toString();
@@ -81,7 +81,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
public int update${ClassName}(${ClassName} ${className})
{
#foreach ($column in $columns)
#if($column.javaField == 'createTime')
#if($column.javaField == 'updateTime')
${className}.setUpdateTime(DateUtils.getNowDate());
#end
#end
@@ -106,6 +106,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${pkColumn.javaField} ${functionName}ID
* @return 结果
*/
@Override
public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField})
{
return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField});
@@ -1,19 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}', '3', '1', '/${moduleName}/${businessName}', 'C', '0', '${permissionPrefix}:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '${functionName}菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}查询', @parentId, '1', '#', 'F', '0', '${permissionPrefix}:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}新增', @parentId, '2', '#', 'F', '0', '${permissionPrefix}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}修改', @parentId, '3', '#', 'F', '0', '${permissionPrefix}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}删除', @parentId, '4', '#', 'F', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}导出', @parentId, '5', '#', 'F', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');