/** 批量删除 */ @RequestMapping(value = "/deleteAll") @ResponseBody public Object deleteAll() { logBefore(logger, "批量删除Line"); Map map = new HashMap(); PageData pd = new PageData(); try { pd = this.getPageData(); List<PageData> pdList = new ArrayList<PageData>(); String DATA_IDS = pd.getString("DATA_IDS"); if (null != DATA_IDS && !"".equals(DATA_IDS)) { String ArrayDATA_IDS[] = DATA_IDS.split(","); lineService.deleteAll(ArrayDATA_IDS); pd.put("msg", "ok"); } else { pd.put("msg", "no"); } pdList.add(pd); map.put("list", pdList); } catch (Exception e) { logger.error(e.toString(), e); } finally { logAfter(logger); } return AppUtil.returnObject(pd, map); }
/** 列表 */ @RequestMapping(value = "/list") public ModelAndView list(Page page) { logBefore(logger, "列表Line"); ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); try { pd = this.getPageData(); String TITLE = pd.getString("TITLE"); String PARENT_ID = pd.getString("PARENT_ID"); if (null != TITLE && !"".equals(TITLE)) { TITLE = TITLE.trim(); pd.put("TITLE", TITLE); } if (null != PARENT_ID && !"".equals(PARENT_ID)) { PARENT_ID = PARENT_ID.trim(); pd.put("PARENT_ID", PARENT_ID); } page.setPd(pd); List<PageData> varList = lineService.list(page); // 列出Line列表 mv.setViewName("information/line/line_list"); mv.addObject("varList", varList); mv.addObject("pd", pd); mv.addObject(Const.SESSION_QX, this.getHC()); // 按钮权限 } catch (Exception e) { logger.error(e.toString(), e); } return mv; }
/** 修改 */ @RequestMapping(value = "/edit") public ModelAndView edit() throws Exception { logBefore(logger, "修改Line"); ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); lineService.edit(pd); mv.addObject("msg", "success"); mv.setViewName("save_result"); return mv; }
/** 删除 */ @RequestMapping(value = "/delete") public void delete(PrintWriter out) { logBefore(logger, "删除Line"); PageData pd = new PageData(); try { pd = this.getPageData(); lineService.delete(pd); out.write("success"); out.close(); } catch (Exception e) { logger.error(e.toString(), e); } }
/** 新增 */ @RequestMapping(value = "/save") public ModelAndView save() throws Exception { logBefore(logger, "新增Line"); ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); pd.put("LINE_ID", this.get32UUID()); // 主键 // pd.put("PARENT_ID", ""); //父类ID lineService.save(pd); mv.addObject("msg", "success"); mv.setViewName("save_result"); return mv; }
/** 去修改页面 */ @RequestMapping(value = "/goEdit") public ModelAndView goEdit() { logBefore(logger, "去修改Line页面"); ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); try { pd = lineService.findById(pd); // 根据ID读取 mv.setViewName("information/line/line_edit"); mv.addObject("msg", "edit"); mv.addObject("pd", pd); } catch (Exception e) { logger.error(e.toString(), e); } return mv; }
/* * 导出到excel * @return */ @RequestMapping(value = "/excel") public ModelAndView exportExcel() { logBefore(logger, "导出Line到excel"); ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); try { Map<String, Object> dataMap = new HashMap<String, Object>(); List<String> titles = new ArrayList<String>(); titles.add("名称"); // 1 titles.add("链接"); // 2 titles.add("线路"); // 3 titles.add("类型"); // 4 titles.add("排序"); // 5 titles.add("父类ID"); // 6 dataMap.put("titles", titles); List<PageData> varOList = lineService.listAll(pd); List<PageData> varList = new ArrayList<PageData>(); for (int i = 0; i < varOList.size(); i++) { PageData vpd = new PageData(); vpd.put("var1", varOList.get(i).getString("TITLE")); // 1 vpd.put("var2", varOList.get(i).getString("LINE_URL")); // 2 vpd.put("var3", varOList.get(i).getString("LINE_ROAD")); // 3 vpd.put("var4", varOList.get(i).getString("TYPE")); // 4 vpd.put("var5", varOList.get(i).getString("LINE_ORDER")); // 5 vpd.put("var6", varOList.get(i).getString("PARENT_ID")); // 6 varList.add(vpd); } dataMap.put("varList", varList); ObjectExcelView erv = new ObjectExcelView(); mv = new ModelAndView(erv, dataMap); } catch (Exception e) { logger.error(e.toString(), e); } return mv; }