package com.bonus.canteen.core.auth.role.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.auth.menu.vo.MgrMenuTreeVO;
import com.bonus.canteen.core.auth.menu.vo.MgrMenuVO;
import com.bonus.canteen.core.auth.role.entity.MgrRoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MgrRoleMenuMapper extends BaseMapper<MgrRoleMenu> {
   int insertBatch(@Param("roleId") Long roleId, @Param("menus") List<Long> menus);

   List<MgrMenuVO> listPermissions(@Param("userId") Long userId);

   List<MgrMenuVO> listPermissionsByRoleCode(@Param("userId") Long userId, @Param("roleCode") String roleCode);

   List<MgrMenuTreeVO> getTenantMenu(@Param("excludeMiddle") Integer excludeMiddle, @Param("userId") Long userId, @Param("isAdmin") boolean isAdmin);

   List<MgrMenuTreeVO> listMenuListByRoleCode(@Param("userId") Long userId, @Param("roleCode") String roleCode, @Param("webType") Integer webType, @Param("typeList") List<Integer> typeList);

   void clearUnUsedPermissions();

   void insertBatchNew(@Param("insertList") List<MgrRoleMenu> insertList);
}
