SysPermissionMapper.java 2.2 KB
package com.skua.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skua.modules.system.entity.SysPermission;
import com.skua.modules.system.model.TreeModel;
import com.skua.modules.system.vo.SysReportPermissionVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * 菜单权限表 Mapper 接口
 */
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
	/**
	   * 通过父菜单ID查询子菜单
	 * @param parentId
	 * @return
	 */
	public List<TreeModel> queryListByParentId(@Param("parentId") String parentId);

	/**
	  *   根据用户查询用户权限
	 */
	public List<SysPermission> queryByUser(@Param("username") String username,@Param("orgCode")String orgCode);

	/**
	 *   修改菜单状态字段: 是否子节点
	 */
	@Update("update sys_permission set is_leaf=#{leaf} where id = #{id}")
	public int setMenuLeaf(@Param("id") String id,@Param("leaf") int leaf);

	/**
	  *   获取模糊匹配规则的数据权限URL
	 */
	@Select("SELECT url FROM sys_permission WHERE del_flag = 0 and menu_type = 2 and url like '%*%'")
    public List<String> queryPermissionUrlWithStar();

	public List<SysPermission> getMenuByComponent(@Param("query")String query);

	public List<SysPermission> getMenuOfDataFill(@Param("userId") String userId);

	public List<SysPermission> getMenuList(@Param("orgCode") String orgCode);

	/**
	 * 根据reportShowParentId获取菜单列表
	 * @param reportShowParentId
	 * @return
	 */
	List<SysReportPermissionVO> queryReportsShowTreeList(@Param("reportShowParentId")String reportShowParentId);

	@Select("select sys_permission_id sysPermissionId,permission_depart_name permissionDepartName,permission_depart_type permissionDepartType,permission_choose_type permissionChooseType from sys_permission_ext spe inner join sys_permission_depart_config spdc on spe.sys_permission_depart_config_id = spdc.id")
    List<Map<String, Object>> getPermissionDepartData();
	/**
	 * 根据用户查询用户移动端权限
	 * @param username
	 * @return
	 */
	public List<SysPermission> queryAppByUser(@Param("username") String username);
}