<?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.domain.mapper.PrivilageDomainEntityDOMapper">

    <select id="selectEntityByUserId" resultType="java.lang.Long">
      select t2.entity_id from privilage_user_domain t1, privilage_domain_entity t2
        where t1.domain_id = t2.domain_id
        and t2.type =#{type}
        and t1.user_id = #{userId}
    </select>

    <select id="selectDomainIdByShopEntity" resultType="java.lang.Long">
      select t2.org_id from  privilage_domain_entity t1,privilage_organizational_domain t2
        where t1.entity_id = #{shopId}
        and t1.domain_id = t2.domain_id
        and t1.type = 3
        limit 1
    </select>

</mapper>
