Commit 527bc6e1 by fengshuonan

菜单查询增加一个条件

parent 74f7da05
......@@ -129,8 +129,9 @@ public class MenuController extends BaseController {
@RequestMapping(value = "/list")
@ResponseBody
public Object list(@RequestParam(required = false) String menuName,
@RequestParam(required = false) String level) {
List<Map<String, Object>> menus = this.menuService.selectMenus(menuName, level);
@RequestParam(required = false) String level,
@RequestParam(required = false) Long menuId) {
List<Map<String, Object>> menus = this.menuService.selectMenus(menuName, level, menuId);
return super.warpObject(new MenuWarpper(menus));
}
......
......@@ -25,7 +25,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @return
* @date 2017年2月12日 下午9:14:34
*/
List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level);
List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level, @Param("menuId") Long menuId, @Param("code") String code);
/**
* 根据条件查询菜单
......
......@@ -40,6 +40,9 @@
<if test="level != null and level != ''">
and LEVELS = #{level}
</if>
<if test="menuId != null and menuId != 0">
and (MENU_ID = #{menuId} or MENU_ID in ( select MENU_ID from sys_menu where PCODES like CONCAT('%[', #{code}, ']%') ))
</if>
</select>
<select id="getMenuIdsByRoleId" resultType="long">
......
......@@ -108,8 +108,16 @@ public class MenuService extends ServiceImpl<MenuMapper, Menu> {
* @return
* @date 2017年2月12日 下午9:14:34
*/
public List<Map<String, Object>> selectMenus(String condition, String level) {
return this.baseMapper.selectMenus(condition, level);
public List<Map<String, Object>> selectMenus(String condition, String level, Long menuId) {
//获取menuId的code
String code = "";
if (menuId != null) {
Menu menu = this.selectById(menuId);
code = menu.getCode();
}
return this.baseMapper.selectMenus(condition, level, menuId, code);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment