<?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.yami.shop.sys.dao.SysUserChannelMapper">

	<delete id="deleteBatch">
		delete from tz_sys_user_role where role_id in
		<foreach item="roleId" collection="roleIds" open="(" separator="," close=")">
			#{roleId}
		</foreach>
	</delete>
	
	<delete id="deleteByUserId">
		delete from tz_sys_user_channel where user_id = #{userId}
	</delete>
    <select id="listChannelByUserId" resultType="java.lang.Long">
		select channel_id from tz_sys_user_channel where user_id = #{userId}

	</select>

    <insert id="insertUserAndUserChannel">
	  	insert into tz_sys_user_channel (user_id,channel_id) values
	  	<foreach collection="channelIdList" item="channelId" separator=",">
	  		(#{userId},#{channelId})
	  	</foreach>
  </insert>
</mapper>