<?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.superdesk.uniorder.dao.mapper.channel.UnifiedChannelSyncMapperEx">


	<select id="findChannelByChannelId"
	        resultMap="cn.superdesk.uniorder.dao.mapper.channel.UnifiedChannelSyncMapper.BaseResultMap"
	        parameterType="java.lang.Long">
		select
		<include refid="cn.superdesk.uniorder.dao.mapper.channel.UnifiedChannelSyncMapper.Base_Column_List"/>
		from
			unified_channel_sync
		<where>
			channel_id = #{id,jdbcType=BIGINT}
		</where>
	</select>

	<select id="findAll" resultMap="cn.superdesk.uniorder.dao.mapper.channel.UnifiedChannelSyncMapper.BaseResultMap">
		select
		<include refid="cn.superdesk.uniorder.dao.mapper.channel.UnifiedChannelSyncMapper.Base_Column_List"/>
		from
			unified_channel_sync
		<where>
		<if test="channelId !=null and channelId != ''">
			and channel_id = #{channelId}
		</if>

		<if test="enabled !=null and enabled != ''">
			and enabled = #{enabled}
		</if>
		<if test="channelName != null and channelName != ''">
			and channel_name like CONCAT('%',#{channelName},'%')
		</if>
		</where>
		order by create_time desc
	</select>

</mapper>