Browse Source

修正:parseFromMap方法

master
郑根木 2 years ago
parent
commit
3c16e3bb29
4 changed files with 14 additions and 2 deletions
  1. +1
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/body/BeanBodyEditor.java
  2. +1
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/body/SwMapBodyEditor.java
  3. +4
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java
  4. +8
    -0
      smtweb-framework/core/src/main/resources/权限相关.json

+ 1
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/body/BeanBodyEditor.java View File

@@ -33,7 +33,7 @@ public class BeanBodyEditor implements IEditor {


private Object getGetValue(String paramName, Class<?> paramType, Map<String, Object> params) { private Object getGetValue(String paramName, Class<?> paramType, Map<String, Object> params) {
if (paramName == null) { if (paramName == null) {
return JsonUtil.parse(params, paramType);
return JsonUtil.parseSimple(params, paramType);
} }


// Json字符进行类型转化 // Json字符进行类型转化


+ 1
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/controller/binder/body/SwMapBodyEditor.java View File

@@ -30,7 +30,7 @@ public class SwMapBodyEditor implements IEditor {
} }


private Object getGetValue(String paramName, Class<?> paramType, Map<String, Object> params, HttpServletRequest request) { private Object getGetValue(String paramName, Class<?> paramType, Map<String, Object> params, HttpServletRequest request) {
SwMap result = JsonUtil.parse(params, SwMap.class);
SwMap result = JsonUtil.parseSimple(params, SwMap.class);
request.setAttribute(BODY_MAP, result); request.setAttribute(BODY_MAP, result);
return getFieldValue(result, paramName); return getFieldValue(result, paramName);
} }


+ 4
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/JsonUtil.java View File

@@ -120,6 +120,10 @@ public class JsonUtil {
* @return Bean对象实例 * @return Bean对象实例
*/ */
public static <T> T parse(Map map, Class<T> clazz) { public static <T> T parse(Map map, Class<T> clazz) {
return parse(encodeString(map), clazz);
}

public static <T> T parseSimple(Map map, Class<T> clazz) {
try { try {
if (map == null || map.isEmpty()) { if (map == null || map.isEmpty()) {
return null; return null;


+ 8
- 0
smtweb-framework/core/src/main/resources/权限相关.json View File

@@ -42,5 +42,13 @@
"字段权限中的字段": "0-无/1-读/2-写" "字段权限中的字段": "0-无/1-读/2-写"
} }
} }
],
"人员分组.详细": [
{
"type": "类型,1-机构 2-部门 3-角色 4-人员 5-机构性质 5-部门性质",
"kind": "0-包含 1-排除",
"value": "值",
"rec": "树形结构有效:0-仅本级 1-含下级"
}
] ]
} }

Loading…
Cancel
Save