CenterMenuMapper.xml 2.43 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nafmii.webcenter.user.dao.CenterMenuMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="org.nafmii.webcenter.user.entity.CenterMenuPO">
        <id column="ID" property="id" />
        <result column="MENU_NAME" property="menuName" />
        <result column="MENU_LEVLE" property="menuLevle" />
        <result column="PARENT_ID" property="parentId" />
        <result column="ORDER_SEQ" property="orderSeq" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="IS_ENABLE" property="isEnable" />
        <result column="CREATE_USER_ID" property="createUserId" />
        <result column="UPDATE_USER_ID" property="updateUserId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID, MENU_NAME, MENU_LEVLE,MENU_URL, PARENT_ID, ORDER_SEQ, CREATE_TIME, UPDATE_TIME, IS_ENABLE, CREATE_USER_ID, UPDATE_USER_ID
    </sql>

    <select id="selectAll" resultType="org.nafmii.webcenter.user.vo.MenuListVo">
        select
        ID as id,
        MENU_NAME as menuName, MENU_LEVLE as menuLevle, PARENT_ID as parentId,
        ORDER_SEQ as orderSeq, CREATE_TIME as createTime, UPDATE_TIME as updateTime,
        IS_ENABLE as isEnable, CREATE_USER_ID as createUserId, UPDATE_USER_ID as updateUserId
        from CENTER_MENU
        where IS_ENABLE = 0
    </select>
    <select id="queryMenuByUser" resultType="org.nafmii.webcenter.user.vo.MenuToUserVO">
        SELECT DISTINCT
            ( CM.ID ) AS menuId,
            CM.MENU_NAME,
            CM.MENU_LEVEL,
            CM.PARENT_ID,
            CM.MENU_URL,
            CM.ORDER_SEQ
        FROM
            CENTER_USER CU
            INNER JOIN CENTER_USER_ROLE CUr ON ( CUr.USER_ID = CU.ID )
            INNER JOIN CENTER_ROLE_MENU CRM ON ( CRM.ROLE_ID = CUr.ROLE_ID )
            INNER JOIN CENTER_MENU CM ON ( CM.ID = CRM.MENU_ID )
            INNER JOIN CENTER_ROLE CR ON ( CUr.ROLE_ID = CR.ID )
        WHERE
            CU.ID = #{userId}
            AND CU.IS_ENABLE = '0'
            AND CUr.IS_ENABLE = '0'
            AND CRM.IS_ENABLE = '0'
            AND CM.IS_ENABLE = '0'
            AND CR.IS_ENABLE = '0'
        ORDER BY
            CM.PARENT_ID ASC

    </select>
</mapper>