| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package com.zhcs.dt.service.system.menu.impl;
- import java.util.List;
- import javax.annotation.Resource;
- import org.springframework.stereotype.Service;
- import com.zhcs.dt.dao.DaoSupport;
- import com.zhcs.dt.entity.system.Menu;
- import com.zhcs.dt.service.system.menu.MenuManager;
- import com.zhcs.dt.util.PageData;
- /**
- * 类名称:MenuService 菜单处理
- * 创建人:FH qq 3 1 3 5 9 6 7 9 0[青苔]
- * 修改时间:2015年10月27日
- * @version v2
- */
- @Service("menuService")
- public class MenuService implements MenuManager{
- @Resource(name = "daoSupport")
- private DaoSupport dao;
-
- /**
- * 通过ID获取其子一级菜单
- * @param parentId
- * @return
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- public List<Menu> listSubMenuByParentId(String parentId) throws Exception {
- return (List<Menu>) dao.findForList("MenuMapper.listSubMenuByParentId", parentId);
- }
-
- /**
- * 通过菜单ID获取数据
- * @param pd
- * @return
- * @throws Exception
- */
- public PageData getMenuById(PageData pd) throws Exception {
- return (PageData) dao.findForObject("MenuMapper.getMenuById", pd);
- }
-
- /**
- * 新增菜单
- * @param menu
- * @throws Exception
- */
- public void saveMenu(Menu menu) throws Exception {
- dao.save("MenuMapper.insertMenu", menu);
- }
-
- /**
- * 取最大ID
- * @param pd
- * @return
- * @throws Exception
- */
- public PageData findMaxId(PageData pd) throws Exception {
- return (PageData) dao.findForObject("MenuMapper.findMaxId", pd);
- }
-
- /**
- * 删除菜单
- * @param MENU_ID
- * @throws Exception
- */
- public void deleteMenuById(String MENU_ID) throws Exception {
- dao.save("MenuMapper.deleteMenuById", MENU_ID);
- }
-
- /**
- * 编辑
- * @param menu
- * @return
- * @throws Exception
- */
- public void edit(Menu menu) throws Exception {
- dao.update("MenuMapper.updateMenu", menu);
- }
-
- /**
- * 保存菜单图标
- * @param pd
- * @return
- * @throws Exception
- */
- public PageData editicon(PageData pd) throws Exception {
- return (PageData)dao.findForObject("MenuMapper.editicon", pd);
- }
-
- /**
- * 获取所有菜单并填充每个菜单的子菜单列表(菜单管理)(递归处理)
- * @param MENU_ID
- * @return
- * @throws Exception
- */
- public List<Menu> listAllMenu(String MENU_ID) throws Exception {
- List<Menu> menuList = this.listSubMenuByParentId(MENU_ID);
- for(Menu menu : menuList){
- menu.setMENU_URL("menu/toEdit.do?MENU_ID="+menu.getMENU_ID());
- menu.setSubMenu(this.listAllMenu(menu.getMENU_ID()));
- menu.setTarget("treeFrame");
- }
- return menuList;
- }
- /**
- * 获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)(递归处理)
- * @param MENU_ID
- * @return
- * @throws Exception
- */
- public List<Menu> listAllMenuQx(String MENU_ID) throws Exception {
- List<Menu> menuList = this.listSubMenuByParentId(MENU_ID);
- for(Menu menu : menuList){
- menu.setSubMenu(this.listAllMenuQx(menu.getMENU_ID()));
- menu.setTarget("treeFrame");
- }
- return menuList;
- }
-
- }
|