| | |
| | | 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; |
| | |
| | | |
| | | @Controller |
| | | @RequestMapping("${mapping}") |
| | | public class AdminAppController { |
| | | public class ${controllerName} { |
| | | |
| | | <#assign serviceObjName="${service.name?uncap_first}"> |
| | | <#assign entityObjName="${entity.name?uncap_first}"> |
| | |
| | | @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("")); |
| | | } |
| | |
| | | ${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())); |
| | | } |
| | | } |
| | | |
| | |
| | | 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("")); |
| | | } |