mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
fix 修复 JsonUtils 参数为空报错
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.generator.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -423,13 +424,13 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
|
||||
* @param genTable 设置后的生成对象
|
||||
*/
|
||||
public void setTableFromOptions(GenTable genTable) {
|
||||
Map<String, String> paramsObj = JsonUtils.parseMap(genTable.getOptions());
|
||||
Map<String, Object> paramsObj = JsonUtils.parseMap(genTable.getOptions());
|
||||
if (Validator.isNotNull(paramsObj)) {
|
||||
String treeCode = paramsObj.get(GenConstants.TREE_CODE);
|
||||
String treeParentCode = paramsObj.get(GenConstants.TREE_PARENT_CODE);
|
||||
String treeName = paramsObj.get(GenConstants.TREE_NAME);
|
||||
String parentMenuId = paramsObj.get(GenConstants.PARENT_MENU_ID);
|
||||
String parentMenuName = paramsObj.get(GenConstants.PARENT_MENU_NAME);
|
||||
String treeCode = Convert.toStr(paramsObj.get(GenConstants.TREE_CODE));
|
||||
String treeParentCode = Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE));
|
||||
String treeName = Convert.toStr(paramsObj.get(GenConstants.TREE_NAME));
|
||||
String parentMenuId = Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID));
|
||||
String parentMenuName = Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_NAME));
|
||||
|
||||
genTable.setTreeCode(treeCode);
|
||||
genTable.setTreeParentCode(treeParentCode);
|
||||
|
@ -319,7 +319,7 @@ public class VelocityUtils
|
||||
*/
|
||||
public static String getTreecode(Map<String, Object> paramsObj)
|
||||
{
|
||||
if (paramsObj.containsKey(GenConstants.TREE_CODE))
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_CODE)));
|
||||
}
|
||||
@ -334,7 +334,7 @@ public class VelocityUtils
|
||||
*/
|
||||
public static String getTreeParentCode(Map<String, Object> paramsObj)
|
||||
{
|
||||
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE)));
|
||||
}
|
||||
@ -349,7 +349,7 @@ public class VelocityUtils
|
||||
*/
|
||||
public static String getTreeName(Map<String, Object> paramsObj)
|
||||
{
|
||||
if (paramsObj.containsKey(GenConstants.TREE_NAME))
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_NAME)));
|
||||
}
|
||||
@ -365,8 +365,8 @@ public class VelocityUtils
|
||||
public static int getExpandColumn(GenTable genTable)
|
||||
{
|
||||
String options = genTable.getOptions();
|
||||
Map<String, String> paramsObj = JsonUtils.parseMap(options);
|
||||
String treeName = paramsObj.get(GenConstants.TREE_NAME);
|
||||
Map<String, Object> paramsObj = JsonUtils.parseMap(options);
|
||||
String treeName = Convert.toStr(paramsObj.get(GenConstants.TREE_NAME));
|
||||
int num = 0;
|
||||
for (GenTableColumn column : genTable.getColumns())
|
||||
{
|
||||
|
Reference in New Issue
Block a user