<?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="cn.com.ctop.common.module.mapper.MaterialInfoMapper">

    <select id="selectUserNameById" resultType="java.lang.String">
   select realname from  sys_user where  id = #{auditorId}
    </select>


    <select id="selectCountByMap" parameterType="java.util.Map" resultType="java.lang.Integer">

        select count(1)
        from ctop_material_info
        where 1 = 1
        <if test="userId != null">
            and user_id = #{userId}
        </if>

        <if test="status != null">
            and status = #{status}
        </if>


    </select>

    <select id="getRoleCodeByUserId" resultType="java.lang.String">
   SELECT
    role_code
    FROM
    sys_role
    WHERE
    id = (
    SELECT
    t2.role_id
    FROM
    sys_user t1
    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
    WHERE
    t1.id = #{userId,jdbcType=VARCHAR}
    )
    </select>


</mapper>
