Commit c3716f55 by naan1993

增加字典输入错误信息的提示

parent 6ceb0909
...@@ -46,6 +46,7 @@ public enum BizExceptionEnum { ...@@ -46,6 +46,7 @@ public enum BizExceptionEnum {
/** /**
* 错误的请求 * 错误的请求
*/ */
DICT_MUST_BE_NUMBER(400,"字典的值必须为数字"),
REQUEST_NULL(400, "请求有错误"), REQUEST_NULL(400, "请求有错误"),
SESSION_TIMEOUT(400, "会话超时"), SESSION_TIMEOUT(400, "会话超时"),
SERVER_ERROR(500, "服务器异常"); SERVER_ERROR(500, "服务器异常");
......
...@@ -52,7 +52,11 @@ public class DictServiceImpl implements IDictService { ...@@ -52,7 +52,11 @@ public class DictServiceImpl implements IDictService {
Dict itemDict = new Dict(); Dict itemDict = new Dict();
itemDict.setPid(dict.getId()); itemDict.setPid(dict.getId());
itemDict.setName(name); itemDict.setName(name);
try {
itemDict.setNum(Integer.valueOf(num)); itemDict.setNum(Integer.valueOf(num));
}catch (NumberFormatException e){
throw new BussinessException(BizExceptionEnum.DICT_MUST_BE_NUMBER);
}
this.dictMapper.insert(itemDict); this.dictMapper.insert(itemDict);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment