@RequestMapping(value = "/deleteAll") @ResponseBody public Object deleteAll() { logBefore(logger, "批量删除Textmsg"); if (!PermissionHandler.buttonJurisdiction(menuUrl, "del")) { return null; } PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>(); 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(","); weixinTextMsgService.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 = "/edit") public ModelAndView edit() throws Exception { logBefore(logger, "修改Textmsg"); if (!PermissionHandler.buttonJurisdiction(menuUrl, "edit")) { return null; } ModelAndView mv = this.getModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); weixinTextMsgService.edit(pd); mv.addObject("msg", "success"); mv.setViewName("save_result"); return mv; }
@RequestMapping(value = "/delete") public void delete(PrintWriter out) { logBefore(logger, "删除Textmsg"); if (!PermissionHandler.buttonJurisdiction(menuUrl, "del")) { return; } PageData pd = new PageData(); try { pd = this.getPageData(); weixinTextMsgService.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, "新增Textmsg"); if (!PermissionHandler.buttonJurisdiction(menuUrl, "add")) { return null; } ModelAndView mv = this.getModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); pd.put("TEXTMSG_ID", this.get32UUID()); // 主键 pd.put("CREATETIME", Tools.date2Str(new Date())); // 创建时间 weixinTextMsgService.save(pd); mv.addObject("msg", "success"); mv.setViewName("save_result"); return mv; }
/* * 导出到excel * @return */ @RequestMapping(value = "/excel") public ModelAndView exportExcel() { logBefore(logger, "导出Textmsg到excel"); if (!PermissionHandler.buttonJurisdiction(menuUrl, "cha")) { return null; } 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 dataMap.put("titles", titles); List<PageData> varOList = weixinTextMsgService.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("KEYWORD")); // 1 vpd.put("var2", varOList.get(i).getString("CONTENT")); // 2 vpd.put("var3", varOList.get(i).getString("CREATETIME")); // 3 vpd.put("var4", varOList.get(i).get("STATUS").toString()); // 4 vpd.put("var5", varOList.get(i).getString("BZ")); // 5 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; }