@RequestMapping(value = "/getFuncMenuTops") @ResponseBody @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true) public JSONArray getFuncMenuTops() { String hql = "from SystemResourcesVO vo where vo.enabled = '1' and vo.leaf_type = '2' order by vo.sort_str"; List list = hibernateTemplate.find(hql); JSONArray arrays = new JSONArray(); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { SystemResourcesVO vo = (SystemResourcesVO) list.get(i); ResourceMgrComboBo bo = new ResourceMgrComboBo(); bo.setValue(vo.getSelfId()); bo.setText(vo.getBrandName()); bo.setDesc(vo.getResouce_describe()); arrays.add(bo); } } // String jsonString = JSONValue.toJSONString(l1); // System.out.println("-----------" + arrays); return arrays; }
@RequestMapping(value = "/save") @ResponseBody @Transactional(propagation = Propagation.REQUIRED) public String save(ResourceMgrBean req) { // req.setRetStatus("00"); BeanDebugger.printBeanInfo(req); SystemResourcesVO vo = new SystemResourcesVO(); if (req.getResource_type().equals("00")) { // url 页面路径 if (req.getIsFunc().equals("00")) { // 功能目录 vo.setResource_id(UUIDGener.getUUID()); vo.setResource_name(req.getBrandName() + "_目录"); vo.setResource_type("url"); vo.setResource_content("#"); vo.setResouce_describe(req.getResouce_describe()); vo.setEnabled(req.getEnabled()); vo.setParent_menu_id(""); vo.setLeaf_type("2"); vo.setSort_str(req.getSort_str()); vo.setSelfId(req.getBrandName() + "_id"); vo.setParentId("#mainFuncId"); vo.setIsDouble(req.getIsDouble()); vo.setBgColor(req.getBgColor()); vo.setTileType("icon"); vo.setImgSrc(req.getImgSrc()); vo.setBrandName(req.getBrandName()); vo.setBrandCount(""); vo.setBadgeColor(""); vo.setTileHtml(""); vo.setMenuIcon(""); vo.setMenuUrl(""); hibernateTemplate.save(vo); hibernateTemplate.flush(); } if (req.getIsFunc().equals("01")) { // 功能菜单 vo.setResource_id(UUIDGener.getUUID()); vo.setResource_name(req.getBrandName() + "_菜单"); vo.setResource_type("url"); vo.setResource_content(req.getResource_content()); vo.setResouce_describe(req.getResouce_describe()); vo.setEnabled(req.getEnabled()); vo.setParent_menu_id(req.getParent_menu_id()); vo.setLeaf_type("3"); vo.setSort_str(req.getSort_str()); vo.setSelfId(""); vo.setParentId("#subFuncId"); vo.setIsDouble(req.getIsDouble()); vo.setBgColor(req.getBgColor()); vo.setTileType("icon"); vo.setImgSrc(req.getImgSrc()); vo.setBrandName(req.getBrandName()); vo.setBrandCount(""); vo.setBadgeColor(""); vo.setTileHtml(""); vo.setMenuIcon(req.getImgSrc()); vo.setMenuUrl("url:" + req.getResource_content()); hibernateTemplate.save(vo); hibernateTemplate.flush(); } } if (req.getResource_type().equals("01")) { // .do功能路径 vo.setResource_id(UUIDGener.getUUID()); vo.setResource_name(""); vo.setResource_type("url"); vo.setResource_content(req.getResource_content()); vo.setResouce_describe(req.getResouce_describe()); vo.setEnabled(req.getEnabled()); vo.setParent_menu_id(""); vo.setLeaf_type("1"); vo.setSort_str(""); vo.setSelfId(""); vo.setParentId(""); vo.setIsDouble(""); vo.setBgColor(""); vo.setTileType(""); vo.setImgSrc(""); vo.setBrandName(""); vo.setBrandCount(""); vo.setBadgeColor(""); vo.setTileHtml(""); vo.setMenuIcon(""); vo.setMenuUrl(""); hibernateTemplate.save(vo); hibernateTemplate.flush(); } return "00"; }