Commit 7913464c by guojuxing

同步应用菜单,添加删除不存在的应用菜单

parent 6edc11f6
......@@ -30,6 +30,7 @@ public interface MenuApiService {
ServiceResponse<List<MenuDTO>> listByMenuIdList(List<Integer> menuIdList);
ServiceResponse<List<MenuDTO>> listByParentMenuIdList(List<Integer> parentMenuIdList);
/**
* 查询用户拥有的所有菜单路由权限
* @Title: listUserMenu

......@@ -49,7 +50,22 @@ public interface MenuApiService {
* @param versionCode 商户服务订购的版本
* @return
*/
ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu, String versionCode);
ServiceResponse<List<MenuDTO>> getUserMenuOfGic(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode);
/**
* 获取登陆用户的应用菜单(页面类型)
* @Title: getUserMenuOfApp

* @Description:

* @author guojuxing
* @param enterpriseId
* @param userId
* @param currentMenu
* @param versionCode

* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.MenuDTO>>


*/
ServiceResponse<List<MenuDTO>> getUserMenuOfApp(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode);
/**
* 根据用户ID查询没拥有的gic操作项
......@@ -68,6 +84,7 @@ public interface MenuApiService {
* @return
*/
ServiceResponse<List<MenuDTO>> getSuperAdminGicMenu(Integer enterpriseId);
/**
* 获取超级管理员的菜单 非树
* @Title: getSuperAdminGicMenuNotTree

......@@ -129,7 +146,6 @@ public interface MenuApiService {

 */
ServiceResponse<Void> saveGICPage(MenuDTO menuDTO);
/**
* 查询已经购买的应用
* @Title: listAppPageOfHasBuy

......@@ -149,6 +165,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> updateGICPage(MenuDTO menuDTO);
/**
* 删除页面、子页面、权限项、操作项
* @Title: deleteMenu

......@@ -158,6 +175,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> deleteMenu(Integer menuId);
/**
* 新增GIC子页面
* @Title: saveGICChildPage

......@@ -177,6 +195,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> updateGICChildPage(MenuDTO menuDTO);
/**
* 编辑应用页面
* @Title: updateAppPage

......@@ -186,6 +205,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> updateAppPage(MenuDTO menuDTO);
/**
* 新增应用子页面
* @Title: saveAppChildPage

......@@ -195,6 +215,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


 */
ServiceResponse<Integer> saveAppChildPage(MenuDTO menuDTO);
/**
* 编辑应用子页面
* @Title: updateAppChildPage

......@@ -285,6 +306,7 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.AuthItemListDTO>>


 */
ServiceResponse<List<AuthItemListDTO>> listAuthItemByMenuId(Integer menuId);
/**
* 获取gic基础服务的版本列表数据
* @Title: getGicDefaultVersion

......
......@@ -199,4 +199,14 @@ public interface TabSysMenuMapper {
List<TabSysMenu> listAdminOnlyOperationItem();
void deleteByMenuIdList(@Param("list") List<Integer> menuIdList);
/**
* 逻辑删除不存在的应用菜单
* @Title: deleteNotInApp

* @Description:

* @author guojuxing
* @param projectList

* @return void


*/
void deleteNotInApp(List<String> projectList);
}
\ No newline at end of file
......@@ -180,4 +180,14 @@ public interface MenuService {
void deleteByMenuIdList(List<Integer> menuIdList);
List<TabSysMenu> listByParentMenuIdList(List<Integer> parentMenuIdList);
/**
* 逻辑删除不存在的应用菜单
* @Title: deleteNotInApp

* @Description:

* @author guojuxing
* @param projectList

* @return void


*/
void deleteNotInApp(List<String> projectList);
}
......@@ -181,6 +181,11 @@ public class MenuServiceImpl implements MenuService {
return tabSysMenuMapper.listByParentMenuIdList(parentMenuIdList);
}
@Override
public void deleteNotInApp(List<String> projectList) {
tabSysMenuMapper.deleteNotInApp(projectList);
}
private void updateSort(Integer sort, Integer id) {
TabSysMenu record = new TabSysMenu();
record.setMenuId(id);
......
......@@ -111,6 +111,12 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public ServiceResponse<List<MenuDTO>> getUserMenuOfApp(Integer enterpriseId, Integer userId, Integer currentMenu,
String versionCode) {
return getUserLoginMenu(enterpriseId, userId, currentMenu, false, versionCode);
}
@Override
public ServiceResponse<List<MenuDTO>> getNoAuthOperationItemOfGic(Integer userId, String versionCode) {
return getNoAuthOperationItem(userId, MenuProjectConstants.DEFAULT_PROJECT_CODE, versionCode);
}
......@@ -615,6 +621,14 @@ public class MenuApiServiceImpl implements MenuApiService {
Map<String, TabSysMenu> appMenu = getFirstLevelAppMenu();
if (appListResponse.isSuccess()) {
List<ApplicationDTO> appList = appListResponse.getResult();
//删除已经不存在的应用
//获取存在的应用
List<String> projectList = new ArrayList<>();
for (ApplicationDTO applicationDTO : appList) {
projectList.add(applicationDTO.getApplicationId().toString());
}
//删除不在projectList中的应用菜单:逻辑删除
menuService.deleteNotInApp(projectList);
for (ApplicationDTO app : appList) {
if (appMenu.containsKey(app.getApplicationId().toString())) {
//如果已存在,则更新版本信息
......@@ -863,11 +877,12 @@ public class MenuApiServiceImpl implements MenuApiService {

 */
private ServiceResponse<List<MenuDTO>> getUserLoginMenu(Integer enterpriseId, Integer userId, Integer currentMenu, boolean isGic,
String versionCode) {
//先查询登陆用户信息
TabSysUser tabSysUser = userService.getUserById(userId);
if (tabSysUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户不存在");
}
//返回结果集定义声明
List<TabSysMenu> resultList;
if (StringUtils.isBlank(versionCode)) {
......@@ -890,6 +905,7 @@ public class MenuApiServiceImpl implements MenuApiService {
List<TabSysMenu> menuList = getUserMenuList(userId);
List<Integer> menuIdList = new ArrayList<>();
for (TabSysMenu menu : menuList) {
//符合条件的菜单ID
boolean isMapMenu;
if (isGic) {
isMapMenu = menu.getMenuType().intValue() == MenuTypeEnum.PAGE.getCode()
......
......@@ -518,4 +518,16 @@
</foreach>
</if>
</update>
<update id="deleteNotInApp">
<if test="projectList != null and projectList.size() > 0">
update tab_sys_menu set status = 0
where status = 1
and project != 'gic'
and project NOT IN
<foreach close=")" collection="projectList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
</update>
</mapper>
\ No newline at end of file
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