| | |
| | | import ${entity.clazz}; |
| | | import ${service.clazz}; |
| | | import ${query.clazz}; |
| | | <#if adminVO??> |
| | | import ${adminVO.clazz}; |
| | | </#if> |
| | | |
| | | <#if responseBody> |
| | | <#else> |
| | | import java.io.PrintWriter; |
| | |
| | | <#if add> |
| | | ${responseBody?string("@ResponseBody","")} |
| | | @RequestMapping("add") |
| | | public ${responseBody?string("String","void")} add(${entity.name} bean, HttpSession session${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | |
| | | <#if adminVO??> |
| | | public ${responseBody?string("String","void")} add(${adminVO.name} vo,AcceptAdminData acceptAdminData${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | try{ |
| | | ${serviceObjName}.add(vo.toEntity(acceptAdminData.getSystem())); |
| | | <@print data="JsonUtil.loadTrueResult(\"\")" > </@print> |
| | | }catch(Exception e){ |
| | | <@print data="JsonUtil.loadFalseResult(e.getMessage())" > </@print> |
| | | } |
| | | } |
| | | <#else> |
| | | public ${responseBody?string("String","void")} add(${entity.name} bean, AcceptAdminData acceptAdminData${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | try{ |
| | | ${serviceObjName}.add(bean); |
| | | <@print data="JsonUtil.loadTrueResult(\"\")" > </@print> |
| | |
| | | } |
| | | } |
| | | </#if> |
| | | </#if> |
| | | |
| | | ${responseBody?string("@ResponseBody","")} |
| | | @RequestMapping("get") |
| | | public ${responseBody?string("String","void")} get(${identifyIdType} id, HttpSession session${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | public ${responseBody?string("String","void")} get(${identifyIdType} id, AcceptAdminData acceptAdminData${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | ${entity.name} entity = ${serviceObjName}.get(id); |
| | | if (entity !=null){ |
| | | <@print data="JsonUtil.loadTrueResult(entity)" > </@print> |
| | |
| | | <#if update> |
| | | ${responseBody?string("@ResponseBody","")} |
| | | @RequestMapping("update") |
| | | public ${responseBody?string("String","void")} update(${entity.name} bean, HttpSession session${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | <#if adminVO??> |
| | | |
| | | public ${responseBody?string("String","void")} update( ${adminVO.name} vo ,AcceptAdminData acceptAdminData${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | if (vo.getId() == null) { |
| | | <@print data="JsonUtil.loadFalseResult(\"ID不能为空\")" > </@print> |
| | | } |
| | | try{ |
| | | ${serviceObjName}.update(vo.toEntity(null)); |
| | | }catch(Exception e){ |
| | | <@print data="JsonUtil.loadFalseResult(e.getMessage())" > </@print> |
| | | } |
| | | <@print data="JsonUtil.loadTrueResult(\"\")" > </@print> |
| | | } |
| | | |
| | | <#else> |
| | | |
| | | public ${responseBody?string("String","void")} update( ${entity.name} bean , AcceptAdminData acceptAdminData${jsonp?string(", String callback","")}${responseBody?string("",",PrintWriter out")}) { |
| | | if (bean.getId() == null) { |
| | | <@print data="JsonUtil.loadFalseResult(\"ID不能为空\")" > </@print> |
| | | } |
| | |
| | | <@print data="JsonUtil.loadTrueResult(\"\")" > </@print> |
| | | } |
| | | </#if> |
| | | </#if> |
| | | |
| | | |
| | | } |