Commit 7af89be9 by 墨竹

fix:好办分权初始化修改

parent 76b5253b
......@@ -85,7 +85,7 @@ public interface TabHaobanRoleMenuMapper {
*/
boolean deleteByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<String> getMenuNotInMenuCodes(@Param("wxEnterpriseId") String wxEnterpriseId,
List<String> getMenuInMenuCodes(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("roleId") Long roleId,
@Param("menuCodes") List<String> menuCodes);
......
......@@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -357,7 +354,9 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
haobanRoleSystemQDTO.setSystemFlag(0);
if (RoleClerkTypeEnum.CLERK.getCode().equals(clerkType)) {
List<String> menuList = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId("-1", roleId);
//初始化我的
List<String> userCenter = haobanMenuService.getHaobanMenuByPid(Collections.singletonList("userCenter"));
List<String> menuList = haobanRoleMenuService.getMenuInMenuCodes("-1", roleId,userCenter );
List<String> codes = RolesListUtils.unionList(menuList, menuCodes);
Set<String> unionListcodes = codes.stream().collect(Collectors.toSet());
HaobanRoleMenuQDTO clerkMenus = new HaobanRoleMenuQDTO();
......@@ -366,7 +365,8 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
haobanRoleQDTO.setClerkMenus(clerkMenus);
haobanRoleSystemQDTO.setClerkMenus(clerkMenus);
} else if (RoleClerkTypeEnum.SHOP.getCode().equals(clerkType)) {
List<String> menuList = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId("-1", roleId);
List<String> userCenter = haobanMenuService.getHaobanMenuByPid(Collections.singletonList("userCenter"));
List<String> menuList = haobanRoleMenuService.getMenuInMenuCodes("-1", roleId,userCenter);
List<String> unionListcodes = RolesListUtils.unionList(menuList, menuCodes);
HaobanRoleMenuQDTO manegeClerkMenus = new HaobanRoleMenuQDTO();
manegeClerkMenus.setClerkType(clerkType);
......
......@@ -97,7 +97,7 @@ public interface HaobanRoleMenuService {
* @author mozhu
* @date 2022-10-09 14:20:25
*/
List<String> getMenuNotInMenuCodes(String wxEnterpriseId, Long roleId, List<String> menuCodes);
List<String> getMenuInMenuCodes(String wxEnterpriseId, Long roleId, List<String> menuCodes);
/**
......@@ -110,4 +110,5 @@ public interface HaobanRoleMenuService {
* @date 2022-10-10 10:44:23
*/
boolean deleteByMenuCode(String menuCode,String wxEnterpriseId);
}
......@@ -92,8 +92,8 @@ public class HaobanRoleMenuServiceImpl implements HaobanRoleMenuService {
}
@Override
public List<String> getMenuNotInMenuCodes(String wxEnterpriseId, Long roleId, List<String> menuCodes) {
return tabHaobanRoleMenuMapper.getMenuNotInMenuCodes(wxEnterpriseId, roleId, menuCodes);
public List<String> getMenuInMenuCodes(String wxEnterpriseId, Long roleId, List<String> menuCodes) {
return tabHaobanRoleMenuMapper.getMenuInMenuCodes(wxEnterpriseId, roleId, menuCodes);
}
......
......@@ -89,12 +89,12 @@
</delete>
<select id="getMenuNotInMenuCodes" resultType="java.lang.String">
<select id="getMenuInMenuCodes" resultType="java.lang.String">
select
menu_code
from tab_haoban_role_menu
where wx_enterprise_id = #{wxEnterpriseId} and role_id = #{roleId}
and menu_code not in
and menu_code in
<foreach collection="menuCodes" open="(" close=")" separator="," item="item">
#{item}
</foreach>
......
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