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

com.addplus.server.security.service.mapper.SysMenuFunctionMapper Maven / Gradle / Ivy

The newest version!
package com.addplus.server.security.service.mapper;

import com.addplus.server.core.model.authority.data.SysMenuFunction;
import com.addplus.server.core.model.authority.datatransfer.SysMenuRoleDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysMenuFunctionMapper extends BaseMapper {

    @Select("SELECT\n" +
            " id,\n" +
            " NAME,\n" +
            " icon,\n" +
            " m_desc,\n" +
            " dept,\n" +
            " url,\n" +
            " pid,\n" +
            " type,\n" +
            " sort,\n" +
            " function_type,\n" +
            " is_deleted,\n" +
            " path,\n" +
            " gmt_create,\n" +
            " gmt_modified,\n" +
            " modify_user \n" +
            "FROM\n" +
            " sys_menu_function \n" +
            "WHERE\n" +
            " sys_menu_function.is_deleted = 0 \n" +
            " AND FIND_IN_SET(#{id},sys_menu_function.path) ORDER BY sys_menu_function.dept desc,sys_menu_function.sort asc")
    List selectMenuFunctionTreeById(@Param("id") Long id);

    @Select("SELECT\n" +
            " id,\n" +
            " NAME,\n" +
            " icon,\n" +
            " m_desc,\n" +
            " dept,\n" +
            " url,\n" +
            " pid,\n" +
            " type,\n" +
            " sort,\n" +
            " function_type,\n" +
            " is_deleted,\n" +
            " path,\n" +
            " gmt_create,\n" +
            " gmt_modified,\n" +
            " modify_user \n" +
            "FROM\n" +
            " sys_menu_function \n" +
            "WHERE\n" +
            " sys_menu_function.is_deleted = 0 \n" +
            " AND sys_menu_function.pid = - 1 \n" +
            " AND type = #{type} ORDER BY sys_menu_function.dept desc,sys_menu_function.sort asc")
    List selectMenuFunctionOrderSort(Page page, @Param("type") Integer type);

    @Select("")
    List getMenuFunctionUserAll(@Param("roles") List roles, @Param("functionType") Integer functionType);

    @Select("SELECT\n" +
            " id \n" +
            "FROM\n" +
            " sys_menu_function \n" +
            "WHERE\n" +
            " FIND_IN_SET(#{id},sys_menu_function.path) AND is_deleted = 0")
    List getMenuFunctionChilders(@Param("id") Integer id);

    @Update("UPDATE sys_menu_function \n" +
            "SET is_deleted = 1 \n" +
            "WHERE\n" +
            " FIND_IN_SET(#{id},sys_menu_function.path) AND is_deleted =0")
    Integer updateLogicallyDeleteChilders(@Param("id") Integer id);

    @Select("SELECT\n" +
            " * \n" +
            "FROM\n" +
            " (\n" +
            " SELECT\n" +
            "  MAX( mf.id ) AS mId,\n" +
            "  mf.url AS url,\n" +
            "  GROUP_CONCAT( DISTINCT ( r.id ) ) AS rId \n" +
            " FROM\n" +
            "  sys_role_menufunction rm\n" +
            "  LEFT JOIN sys_menu_function mf ON mf.id = rm.m_id \n" +
            "  AND mf.is_deleted = 0\n" +
            "  RIGHT JOIN sys_role r ON r.id = rm.r_id \n" +
            "  AND r.is_deleted = 0 \n" +
            " WHERE\n" +
            "  rm.is_deleted = 0 \n" +
            " GROUP BY\n" +
            "  mf.url \n" +
            " ) mf \n" +
            "ORDER BY\n" +
            " mf.mId")
    List getMenuFunctionRoleAll();

    @Select("")
    List searchMenuFunctionByName(Page page, @Param("pid") String pid, @Param("name") String name, @Param("type") Integer type);


    @Select("SELECT\n" +
            " f.id,\n" +
            " f.`name`,\n" +
            " f.icon,\n" +
            " f.m_desc,\n" +
            " f.dept,\n" +
            " f.url,\n" +
            " f.pid,\n" +
            " f.sort,\n" +
            " f.path \n" +
            "FROM\n" +
            " sys_menu_function f \n" +
            "WHERE\n" +
            " f.is_deleted = 0 \n" +
            " AND f.function_type = 1\n" +
            " AND f.type = #{type} \n" +
            " AND f.dept <= 2 \n" +
            "ORDER BY\n" +
            " f.dept ASC,\n" +
            " f.sort ASC")
    List getMenuFunctionListByType(@Param("type") Integer type);

    @Select("SELECT max( sort ) FROM sys_menu_function WHERE pid = #{pid} AND function_type = #{functionType} AND is_deleted = 0")
    Integer getMenuFunctionMaxSort(@Param("pid") Long pid, @Param("functionType") Integer functionType);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy