All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zznote.basecommon.dao.TMenuDao Maven / Gradle / Ivy

The newest version!
package com.zznote.basecommon.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zznote.basecommon.common.constant.UserConstants;
import com.zznote.basecommon.common.mapper.BaseMapperPlus;
import com.zznote.basecommon.entity.system.TMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 菜单权限表
 * 
 * @author zhangzhen
 * @email [email protected]
 * @date 2022-04-12 17:04:17
 */
@Mapper
public interface TMenuDao extends BaseMapperPlus {

    List selectMenuPermsByUserId(Long userId);


    /**
     * 根据用户查询系统菜单列表
     *
     * @param queryWrapper 查询条件
     * @return 菜单列表
     */
    List selectMenuListByUserId(@Param(Constants.WRAPPER) Wrapper queryWrapper);


    /**
     * 根据用户ID查询菜单
     *
     * @return 菜单列表
     */
    default List selectMenuTreeAll() {
        LambdaQueryWrapper lqw = new LambdaQueryWrapper()
                .in(TMenu::getMenuType, UserConstants.TYPE_DIR, UserConstants.TYPE_MENU)
                .eq(TMenu::getStatus, UserConstants.MENU_NORMAL)
                .orderByAsc(TMenu::getParentId)
                .orderByAsc(TMenu::getOrderNum);
        return this.selectList(lqw);
    }


    /**
     * 根据用户ID查询菜单
     *
     * @param userId 用户ID
     * @return 菜单列表
     */
    List selectMenuTreeByUserId(Long userId);


    /**
     * 根据角色ID查询菜单树信息
     *
     * @param roleId            角色ID
     * @param menuCheckStrictly 菜单树选择项是否关联显示
     * @return 选中菜单列表
     */
    List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy