apply datapermission

This commit is contained in:
sxu 2025-03-10 19:08:37 +08:00
parent 410193c53c
commit 6f7ee75ae7
2 changed files with 6 additions and 34 deletions

View File

@ -3,6 +3,8 @@ package com.bonus.canteen.core.menu.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.auth.config.LeNiuDataPermission;
import com.bonus.canteen.core.auth.enums.DataPermissionTypeEnum;
import com.bonus.canteen.core.auth.po.MgrUserAuthPO;
import com.bonus.canteen.core.customer.model.CustInfo;
import com.bonus.canteen.core.marketing.vo.MktEffectiveUserVO;
@ -40,6 +42,10 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
@Select({"select recipe_id, recipe_name from menu_recipe ${ew.customSqlSegment}"})
List<MenuRecipe> selectRecipeNameMap(@Param("ew") Wrapper<MenuRecipe> wrapper);
@LeNiuDataPermission(
alias = "aa",
permissionType = DataPermissionTypeEnum.PERMISSION_AREA
)
Page<MenuRecipeV2PageVO> selectAllRecipeV2List(Page<MenuRecipeV2PageVO> page, @Param("content") MenuRecipeV2PageDTO content, @Param("delFlag") Integer delFlag, @Param("authPO") MgrUserAuthPO authPO);
}

View File

@ -237,13 +237,8 @@
left join alloc_stall a on mr.stall_id = a.stall_id
left join mkt_effective me on mr.eff_id = me.eff_id
left join alloc_area aa on ac.area_id = aa.area_id
LEFT JOIN sys_role sr ON aa.area_id = sr.area_id
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
where
mr.del_flag = #{delFlag}
AND sr.del_flag = 0
AND sr.role_key = #{authPO.roleCode}
AND sur.user_id = #{authPO.userId}
<if test="content.recipeId != null ">
and mr.recipe_id = #{content.recipeId}
</if>
@ -286,35 +281,6 @@
<if test="content.recipeType != null">
and mr.recipe_type = #{content.recipeType}
</if>
<!-- <if test="'3'.toString() == authPO.roleType.toString()">-->
<!-- and exists(-->
<!-- select-->
<!-- null-->
<!-- from mgr_role_canteen it1-->
<!-- left join mgr_role it2 on it2.role_id = it1.role_id-->
<!-- left join mgr_user_role it3 on it1.role_id = it3.role_id-->
<!-- where-->
<!-- it2.del_flag = 2-->
<!-- and it2.role_code = #{authPO.roleCode}-->
<!-- and it1.half_select = 1-->
<!-- and it3.user_id = #{authPO.userId}-->
<!-- and mr.stall_id = it1.data_id-->
<!-- )-->
<!-- </if>-->
<!-- <if test="'-1'.toString() != authPO.roleType.toString() ">-->
<!-- and EXISTS (-->
<!-- SELECT null-->
<!-- FROM mgr_role_area it1-->
<!-- LEFT JOIN mgr_role it2 ON it2.role_id = it1.role_id-->
<!-- LEFT JOIN mgr_user_role it3 ON it1.role_id = it3.role_id-->
<!-- WHERE it2.del_flag = 2-->
<!-- AND it2.role_code = #{authPO.roleCode}-->
<!-- AND it1.half_select = 1-->
<!-- AND it3.user_id = #{authPO.userId}-->
<!-- AND aa.area_id = it1.data_id-->
<!-- )-->
<!-- </if>-->
order by
mr.crtime desc
</select>