Commit 0fbfdbfb by guojuxing

权限菜单查询方式调整:一开始只查询第一层

parent afd61885
......@@ -39,6 +39,11 @@ public class MenuListQO extends PageQO{
*/
private String versionCode;
/**
* 逐级展开的方式,所以需要传ID,如果不传,默认查询第一层级,即level = 1
*/
private Integer menuId;
public String getSearch() {
return search;
}
......@@ -94,4 +99,12 @@ public class MenuListQO extends PageQO{
public void setVersionCode(String versionCode) {
this.versionCode = versionCode;
}
public Integer getMenuId() {
return menuId;
}
public void setMenuId(Integer menuId) {
this.menuId = menuId;
}
}
......@@ -28,6 +28,8 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>


 */
ServiceResponse<List<MenuDTO>> listByMenuIdList(List<Integer> menuIdList);
ServiceResponse<List<MenuDTO>> listByParentMenuIdList(List<Integer> parentMenuIdList);
/**
* 查询用户拥有的所有菜单路由权限
* @Title: listUserMenu

......
......@@ -120,6 +120,8 @@ public interface TabSysMenuMapper {

 */
List<TabSysMenu> selectByIds(@Param("menuIdList") List<Integer> menuIdList);
List<TabSysMenu> listByParentMenuIdList(@Param("parentMenuIdList") List<Integer> parentMenuIdList);
List<TabSysMenu> selectByIdsAndOrderBy(@Param("menuIdList")List<Integer> menuIdList, @Param("orderByStr") String orderByStr);
/**
......@@ -194,7 +196,7 @@ public interface TabSysMenuMapper {

 * @author guojuxing 

* @return java.util.List<com.gic.auth.entity.TabSysUser>


 */
List<TabSysUser> listAdminOnlyOperationItem();
List<TabSysMenu> listAdminOnlyOperationItem();
void deleteByMenuIdList(@Param("list") List<Integer> menuIdList);
}
\ No newline at end of file
package com.gic.auth.service;
import java.util.List;
import com.gic.auth.dto.AuthItemListDTO;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.entity.TabSysMenu;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.MenuListQO;
import com.gic.auth.qo.MenuOperationItemListQO;
import com.github.pagehelper.Page;
import java.util.List;
public interface MenuService {
List<TabSysMenu> listMenu(MenuListQO params);
......@@ -176,7 +175,9 @@ public interface MenuService {

 * @author guojuxing 

* @return java.util.List<com.gic.auth.entity.TabSysUser>


 */
List<TabSysUser> listAdminOnlyOperationItem();
List<TabSysMenu> listAdminOnlyOperationItem();
void deleteByMenuIdList(List<Integer> menuIdList);
List<TabSysMenu> listByParentMenuIdList(List<Integer> parentMenuIdList);
}
......@@ -162,7 +162,7 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public List<TabSysUser> listAdminOnlyOperationItem() {
public List<TabSysMenu> listAdminOnlyOperationItem() {
return tabSysMenuMapper.listAdminOnlyOperationItem();
}
......@@ -173,6 +173,14 @@ public class MenuServiceImpl implements MenuService {
}
}
@Override
public List<TabSysMenu> listByParentMenuIdList(List<Integer> parentMenuIdList) {
if (CollectionUtils.isEmpty(parentMenuIdList)) {
return new ArrayList<>();
}
return tabSysMenuMapper.listByParentMenuIdList(parentMenuIdList);
}
private void updateSort(Integer sort, Integer id) {
TabSysMenu record = new TabSysMenu();
record.setMenuId(id);
......
......@@ -63,6 +63,12 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public ServiceResponse<List<MenuDTO>> listByParentMenuIdList(List<Integer> parentMenuIdList) {
return ServiceResponse.success(
EntityUtil.changeEntityListNew(MenuDTO.class, menuService.listByParentMenuIdList(parentMenuIdList)));
}
@Override
public ServiceResponse<List<MenuDTO>> listUserMenu(Integer userId, String versionCode) {
TabSysUser tabSysUser = userService.getUserById(userId);
if (tabSysUser == null) {
......@@ -86,7 +92,8 @@ public class MenuApiServiceImpl implements MenuApiService {
} else {
List<TabSysMenu> menuList = getUserMenuList(userId);
result = EntityUtil.changeEntityListNew(MenuDTO.class, menuList);
ServiceResponse<List<MenuDTO>> tempResult = getNoAuthOperationItem(userId, MenuProjectConstants.ALL_CODE, versionCode);
ServiceResponse<List<MenuDTO>> tempResult = getNoAuthOperationItem(userId, MenuProjectConstants.ALL_CODE,
versionCode);
result.addAll(tempResult.getResult());
}
......@@ -685,7 +692,8 @@ public class MenuApiServiceImpl implements MenuApiService {
* @param serviceList
* @param menuDTO
*/
private static void setMenuVersion(List<ServePropDTO> serviceList, List<ServeExpanDTO> serveExpandList, MenuDTO menuDTO) {
private static void setMenuVersion(List<ServePropDTO> serviceList, List<ServeExpanDTO> serveExpandList,
MenuDTO menuDTO) {
if (CollectionUtils.isEmpty(serviceList)) {
return;
}
......@@ -964,7 +972,7 @@ public class MenuApiServiceImpl implements MenuApiService {
}
//仅超管可用
if (tabSysUser.getSuperAdmin().intValue() != 1) {
List<TabSysUser> adminOnlyOperationItemList = menuService.listAdminOnlyOperationItem();
List<TabSysMenu> adminOnlyOperationItemList = menuService.listAdminOnlyOperationItem();
if (CollectionUtils.isNotEmpty(adminOnlyOperationItemList)) {
resultList.addAll(EntityUtil.changeEntityListNew(MenuDTO.class, adminOnlyOperationItemList));
}
......
......@@ -306,6 +306,9 @@
<if test="project != null">
and project = #{project}
</if>
<if test="menuId != null">
and parent_id = #{menuId}
</if>
<if test="versionCode != null and versionCode != '' ">
and menu_version like concat('%_', #{versionCode}, '_%' )
</if>
......@@ -376,6 +379,19 @@
</if>
</select>
<select id="listByParentMenuIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_menu
where status=1
<if test="null != parentMenuIdList and parentMenuIdList.size() &gt; 0">
and parent_id in
<foreach close=")" collection="parentMenuIdList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectByIdsAndOrderBy" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......
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