From 932777e9d6dc8dc5d9edbfc9117639ae02d96956 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 14 十月 2021 11:55:07 +0800 Subject: [PATCH] 自动化代码生成优化 --- src/main/resources/generater/admin/adminController.template | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/resources/generater/admin/adminController.template b/src/main/resources/generater/admin/adminController.template index 6ac0695..2fbfc9c 100644 --- a/src/main/resources/generater/admin/adminController.template +++ b/src/main/resources/generater/admin/adminController.template @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.yeshi.utils.JsonUtil; import org.yeshi.utils.TimeUtil; +import com.google.gson.reflect.TypeToken; import javax.annotation.Resource; import javax.servlet.http.HttpSession; @@ -20,7 +21,7 @@ @Controller @RequestMapping("${mapping}") -public class AdminAppController { +public class ${controllerName} { <#assign serviceObjName="${service.name?uncap_first}"> <#assign entityObjName="${entity.name?uncap_first}"> @@ -58,8 +59,8 @@ @ResponseBody @RequestMapping("delete") public String delete(String ids, String callback) { - Type type = new TypeToken<List<${identifyIdType}>>(){}.get(); - List<${identifyIdType}> idList=new Gson().from(ids,type); + Type type = new TypeToken<List<${identifyIdType}>>(){}.getType(); + List<${identifyIdType}> idList=new Gson().fromJson(ids,type); ${serviceObjName}.delete(idList); return loadPrint(callback, JsonUtil.loadTrueResult("")); } @@ -71,7 +72,7 @@ ${serviceObjName}.add(bean); return loadPrint(callback, JsonUtil.loadTrueResult("")); }catch(Exception e){ - return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage)); + return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage())); } } @@ -94,9 +95,9 @@ return loadPrint(callback, JsonUtil.loadFalseResult("ID涓嶈兘涓虹┖")); } try{ - ${serviceObjName}.updateSelective(bean); + ${serviceObjName}.update(bean); }catch(Exception e){ - return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage)); + return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage())); } return loadPrint(callback,JsonUtil.loadTrueResult("")); } -- Gitblit v1.8.0