<?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.kiisoo.ic.system.mapper.PrivilageUserDOMapper">

    <select id="selectUserInfoAndRoleInfo" resultType="com.kiisoo.ic.system.bean.PrivilageUserBean">
        select t1.id ,t1.name, t1.mobil,t3.name as roleName, t3.id as roleId, t3.code as roleCode
        from privilage_user t1, privilage_user_role t2, privilage_role t3
        where t1.id = t2.user_id
        and t2.role_id = t3.id
        and t1.id = #{userId}
        limit 1
    </select>
    <select id="selectStoreIdByUserId" resultType="java.lang.Long">
        SELECT store_id from poi_store_staff where user_id = #{userId} limit 1
    </select>
    <select id="selecctRoleByUserId" resultType="com.kiisoo.ic.system.entity.PrivilageRoleDO">
        select t2.*
        from privilage_user_role t1,
             privilage_role t2
        where t1.role_id = t2.id
        and t1.user_id = #{userId}
    </select>
    <select id="selectListPr" resultType="com.kiisoo.ic.system.entity.PrivilageUserDO">
        select t1.*,t2.id as sellerId from privilage_user t1,poi_store_staff t2
        where t1.id = t2.user_id
        and t2.id in
        <foreach collection="sellerIds" separator="," item="item" close=")" index="index" open="(">
            #{item}
        </foreach>
    </select>


</mapper>
