package com.roubsite.admin.action; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import com.roubsite.admin.bean.MenuTree; import com.roubsite.admin.bean.RsMenu; import com.roubsite.admin.bean.ZTree; import com.roubsite.admin.dao.rsMenu.IRsMenuDao; import com.roubsite.admin.dao.rsMenu.RsMenuDao; import com.roubsite.database.annotation.Dao; import com.roubsite.database.bean.Record; import com.roubsite.database.dao.DataSet; import com.roubsite.security.annotation.RSSecRetType; import com.roubsite.security.annotation.RSSecurity; import com.roubsite.utils.JsonUtils; import com.roubsite.utils.StringUtils; import com.roubsite.utils.UuidUtils; @SuppressWarnings("rawtypes") public class RsMenuAction extends AdminAction { @Dao(impl = RsMenuDao.class, dataSource = "dataSource") IRsMenuDao rsMenuDao; @RSSecurity @Override public void execute() throws Exception { this.display("/rsMenu/listRsMenu.html"); } @RSSecurity(retType = RSSecRetType.retJson) public void doQuery() throws IOException { Record record = new Record(); Map paramSet = (Map) this.getParamSet(false); record.fromBeanMap((Map) paramSet.get("__data__")); DataSet ret = rsMenuDao.queryd(record, (int) paramSet.get("__offset__"), (int) paramSet.get("__limit__")); this.print(JsonUtils.convertToString(ret)); } @RSSecurity(retType = RSSecRetType.retJson) public void doDel() throws Exception { String jsonString = (String) this.getParamSet(true); List ids = JsonUtils.readToObject(jsonString, ArrayList.class); int r = rsMenuDao.del(ids); Map ret = new HashMap(); ret.put("status", r); this.print(JsonUtils.convertToString(ret)); } @RSSecurity public void doEdit() throws ServletException, IOException { String editState = this.I("editState"); String method = this.I("method"); String pid = this.I("pid"); String id = this.I("id"); DataSet ret = new DataSet(); if (StringUtils.isNotEmpty(id)) { ret = rsMenuDao.getInfoById(id); if (ret.getCount() >= 1) { List r = ret.getRows(); RsMenu m = (RsMenu) r.get(0); pid = m.getParentId(); } } if (StringUtils.isEmpty(pid)) { pid = "root"; } DataSet parentRet = rsMenuDao.getInfoById(pid); if (parentRet.getCount() >= 1) { List r = parentRet.getRows(); RsMenu m = (RsMenu) r.get(0); this.assign("parentName", m.getMenuName()); } this.assign("pid", pid); if (StringUtils.isEmpty(editState)) { // 正常打开页面 if ("UPDATE".equals(method)) { this.assign("retInfo", JsonUtils.convertToString(ret)); } this.assign("method", method); this.display("/rsMenu/editRsMenu.html"); return; } // 有数据提交 String paramSet = (String) this.getParamSet(true); Record r = new Record(); r.setState(Integer.parseInt(editState)); r.fromJson(paramSet); if (!StringUtils.isNotEmptyObject(r.get("MENU_ID"))) { r.set("MENU_ID", UuidUtils.getUuid()); } int status = rsMenuDao.saveData(r, RsMenu.class); Map retMap = new HashMap(); retMap.put("status", status); this.print(JsonUtils.convertToString(retMap)); } @RSSecurity(retType = RSSecRetType.retJson) public void doGetAdminMenu() throws Exception { List<MenuTree> list = rsMenuDao.getAdminMenu("root", rSUserInfo.getUid()); this.print(JsonUtils.convertToString(list)); } @RSSecurity public void doMenu() throws ServletException, IOException { this.display("/rsMenu/menu.html"); } @RSSecurity(retType = RSSecRetType.retJson) public void doQueryTree() throws IOException { List<Map> ret = rsMenuDao.queryAll(); List o = new ArrayList<>(); for (Map object : ret) { ZTree tree = new ZTree(); tree.setId(object.get("MENU_ID")); tree.setpId(object.get("PARENT_ID")); tree.setName(object.get("MENU_NAME")); o.add(tree); } this.print(JsonUtils.convertToString(o)); } @RSSecurity public void doSelectMenu() throws Exception { this.display("/rsMenu/selectMenu.html"); } }

lironggang LV38
2020年4月22日
大杰打劫 LV8
2019年11月6日
shiyuanstone LV1
2019年5月9日
tomarsli LV52
2018年11月27日
weixh7 LV25
2018年11月23日
2976172660 LV1
2018年10月20日
zk25796 LV16
2018年9月30日
ysyxlnm LV13
2018年7月3日
best2018 LV46
2018年7月2日
lonesafe LV11
2018年6月30日

Frank_F
2024年7月5日
暂无贡献等级
sccs1984 LV15
2024年2月19日
泓鼎168 LV20
2023年5月23日
tlpaladin LV7
2022年11月29日
1399796575 LV1
2022年11月22日
微信网友_6190590901735424 LV1
2022年11月22日
Mayoubin2001 LV21
2022年5月26日
a318888331 LV13
2022年4月11日
zui360
2022年3月2日
暂无贡献等级
yangctz LV25
2021年11月18日