<?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.unis.crk.basic.mapper.FuncInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.unis.crk.basic.entity.FuncInfo">
        <id column="func_id" property="funcId" />
        <result column="func_name" property="funcName" />
        <result column="func_url" property="funcUrl" />
        <result column="parent_id" property="parentId" />
        <result column="ico_url" property="icoUrl" />
        <result column="status" property="status" />
        <result column="remark" property="remark" />
        <result column="del_flag" property="delFlag" />
        <result column="updatetime" property="updatetime" />
        <result column="func_sort" property="funcSort" />
       <!-- <result column="uses" property="uses" />-->
    </resultMap>
    <select id="getFuncInfoByRoleId" resultMap="BaseResultMap" parameterType="java.lang.String">
        select f.* from role_func r left join func_info f on r.func_id=f.func_id where r.role_id=#{roleId}  AND f.status = 0
    </select>
    <select id="getFuncInfoByUserId" resultMap="BaseResultMap" parameterType="java.lang.String">
        SELECT DISTINCT f.* from role_func r
        LEFT JOIN func_info f on r.func_id=f.func_id
        LEFT JOIN user_role u on u.role_id = r.role_id
        WHERE u.user_id = #{userId}
        AND f.status = 0
      <!--  <if test='isApp =="0"'>
            AND f.uses in ('5459521','5459522')
        </if>
        <if test='isApp =="1"'>
            AND f.uses in ('5459521','5459523')
        </if>-->
    </select>

    <select id="getAllFuncInfo" resultMap="BaseResultMap" parameterType="java.lang.String">
        select *  from func_info
    </select>
    <select id="getByFuncId" resultMap="BaseResultMap" parameterType="java.lang.String">
        select *  from func_info where  func_id=#{id}
    </select>

</mapper>
