<?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.roadm.mapper.ProductRegisterConfigMapper">

	<select id="listPageProductRegister" parameterType="ProductRegisterConfig"
		resultType="ProductRegisterConfig">
		SELECT
		d.id,d.channelcode,d.channelname,d.registernum,d.registertime,d.product
		from PRODUCT_REGISTER d where 1=1
			<if test="channelcode!=null and channelcode!=''">
				and d.channelcode=#{channelcode}
			</if>
			<if test="product!=null and product!=''">
				and d.product like '%'||#{product}||'%'
			</if>
		order by registertime desc
	</select>

	<insert id="insertPageProductRegister" parameterType="ProductRegisterConfig">
		insert into PRODUCT_REGISTER
		(CHANNELCODE,CHANNELNAME,REGISTERNUM,REGISTERTIME,PRODUCT) values
		(#{channelcode},#{channelname},#{registernum},#{registertime},#{product})
	</insert>
	
	<select id="getProductRegister" parameterType="ProductRegisterConfig"
		resultType="ProductRegisterConfig">
		SELECT
		d.id,d.CHANNELCODE,d.CHANNELNAME,d.REGISTERNUM,d.REGISTERTIME
		from PRODUCT_REGISTER d where 1=1
			<if test="channelcode!=null and channelcode!=''">
				and d.channelcode=#{channelcode}
			</if>
			<if test="product!=null and product!=''">
				and d.product=#{product}
			</if>
			<if test="registertime!=null and registertime!=''">
				and d.registertime=#{registertime}
			</if>
		order by registertime desc
	</select>
	
		<select id="getProductRegisterById" parameterType="int"
		resultType="ProductRegisterConfig">
		SELECT
		d.id,d.CHANNELCODE,d.CHANNELNAME,d.REGISTERNUM,d.REGISTERTIME
		from PRODUCT_REGISTER d where id=#{id} limit 1
	</select>
	
	 <update id="updateProductRegisterById" parameterType="ProductRegisterConfig">
        update
        PRODUCT_REGISTER set
        REGISTERNUM=#{registernum}
        where id=#{id}
    </update>

</mapper>