on}删除成功");
${entityName?uncap_first}Service.delete(${entityName?uncap_first});
systemService.addLog(j.getMsg(), Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
return j;
}
/**
* 添加${ftl_description}
*
* @param ${entityName?uncap_first}
* @return
*/
@RequestMapping(params = "save")
@ResponseBody
public AjaxJson save(${entityName}Entity ${entityName?uncap_first}, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
if (StringUtil.isNotEmpty(${entityName?uncap_first}.getId())) {
j.setMsg("${ftl_description}更新成功");
${entityName}Entity t = ${entityName?uncap_first}Service.get(${entityName}Entity.class, ${entityName?uncap_first}.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(${entityName?uncap_first}, t);
${entityName?uncap_first}Service.saveOrUpdate(t);
systemService.addLog(j.getMsg(), Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
j.setMsg("${ftl_description}更新失败");
}
} else {
j.setMsg("${ftl_description}添加成功");
${entityName?uncap_first}Service.save(${entityName?uncap_first});
systemService.addLog(j.getMsg(), Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
return j;
}
/**
* ${ftl_description}列表页面跳转
*
* @return
*/
@RequestMapping(params = "addorupdate")
public String addorupdate(${entityName}Entity ${entityName?uncap_first}, ModelMap map) {
if (StringUtil.isNotEmpty(${entityName?uncap_first}.getId())) {
${entityName?uncap_first} = ${entityName?uncap_first}Service.getEntity(${entityName}Entity.class, ${entityName?uncap_first}.getId());
map.put("${entityName?uncap_first}Page", ${entityName?uncap_first});
}
return ${entityName?upper_case}_ADD_OR_UPDATE_PAGE;
}
}
大家也上传下自己的风格吧,适合自己的才是最好的
|