@Action(value = "delDict") public String delDict() { String sid = request.getParameter("sid") == null ? "" : request.getParameter("sid"); String code = request.getParameter("code") == null ? "" : request.getParameter("code"); if (sid.equals("")) { if (tlstsService.exist(code)) { tlstsService.delRecord(code); } } else { if (tlstsService.exist(code) && tlssSerivce.Exist(sid)) { tlssSerivce.delRecord(sid); } } return null; }
@SuppressWarnings("unchecked") @Action(value = "listStatusTypeAction") public String listStatusType() { response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); String parentCode = StringUtil.getNotNullValueString(request.getParameter("parentid")); String type = StringUtil.getNotNullValueString(request.getParameter("type")); List list = new ArrayList(); // 判断此处是找TListStatusType的第一层节点,还是去找TListStatus的子节点 Boolean firstLevel = tlssSerivce.findChildRecord(parentCode); Boolean otherLevel = tlssSerivce.Exist(parentCode); if (!firstLevel) { if (!otherLevel) { list = tlstsService.findAll(type); } else { list = tlssSerivce.findTListStatusByRefId(parentCode); } } else { list = tlssSerivce.findTListStatusByCode(parentCode); } Iterator iter = list.iterator(); TListStatusType tempListStatusType = null; TListStatus tempListStatus = null; String temps = ""; while (iter.hasNext()) { if (!firstLevel) { if (!otherLevel) { tempListStatusType = (TListStatusType) iter.next(); String tmpVal = tempListStatusType.getCode() + splitExp + tempListStatusType.getName() + splitExp + tempListStatusType.getMemo() + splitExp + "" + splitExp + firstLevel.toString() + splitExp + otherLevel.toString() + splitExp + "root" + "@|@"; temps += tmpVal; } else { tempListStatus = (TListStatus) iter.next(); String tmpVal = tempListStatus.getSid() + splitExp + tempListStatus.getContent() + splitExp + tempListStatus.getMemo() + splitExp + tempListStatus.getOptorder() + splitExp + firstLevel.toString() + splitExp + otherLevel.toString() + splitExp + "child" + "@|@"; temps += tmpVal; } } else { tempListStatus = (TListStatus) iter.next(); String tmpVal = tempListStatus.getSid() + splitExp + tempListStatus.getContent() + splitExp + tempListStatus.getMemo() + splitExp + tempListStatus.getOptorder() + splitExp + firstLevel.toString() + splitExp + otherLevel.toString() + splitExp + "child1" + "@|@"; temps += tmpVal; } } // String last_xml = xml; // System.out.println("==========" +temps + "============"); Writer w = null; try { response.setCharacterEncoding("UTF-8"); w = response.getWriter(); w.write(temps); } catch (IOException e) { e.printStackTrace(); } finally { try { if (w != null) w.flush(); if (w != null) w.close(); } catch (IOException e) { e.printStackTrace(); } } return null; }