<?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.platform.dao.custom.MySysUserBrandDao">


    <select id="getBindUserName" resultType="java.lang.String">
		select username from sys_user
		where user_id in  (select user_id from sys_user_brand brand where brand.brand_id = #{brandId}
		 and brand.enable = 1)
	</select>

	<select id="getBrandBindUserIdList" resultType="com.platform.entity.SysUserBrand">
		select user_id from sys_user_brand
		where brand_id = #{brandId} and enable = 1
	</select>

	<select id="queryList" resultType="com.platform.entity.SysUserBrand">
		select *, b.name as brandName from sys_user_brand a LEFT JOIN nideshop_brand b on a.brand_id = b.id
		<where>
			enable = 1
			<if test="userId != null">
				and user_id = #{userId}
			</if>
		</where>
	</select>

	<select id="queryBrandIdList" resultType="long">
        select brand_id from sys_user_brand where user_id = #{value} and enable = 1
    </select>


</mapper>
