<?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="com.factory.wx.mapper.WxMapper">


    <!--获取用户功能列表-->
    <select id="getUserFunctions" resultType="com.factory.wx.entity.res.FunctionsRes">
        SELECT DISTINCT m.`name`,
                        m.description
        FROM us_user_role ur,
             us_role r,
             us_role_permission rp,
             us_permission p,
             us_module m
        WHERE ur.user_id = ${userId}
          AND ur.role_id = rp.role_id
          AND rp.permission_id = p.id
          AND p.module_id = m.id
          AND ur.role_id = r.id
          AND r.del_flag = 0
          AND p.hidden = 0
          AND p.del_flag = 0
          AND m.del_flag = 0
          AND m.type = 'WX'
          AND description IS NOT NULL
    </select>


</mapper>