ProductPop.xml 2.53 KB
<?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.dili.titan.dao.ProductPopDao">
	<select id="selectList" parameterType="productPop" resultType="productPop">
		<![CDATA[SELECT pid,name,indate,publish_mode AS publishMode,publish_time AS publishTime, publish_settime as publishSettime,drops_time AS dropsTime,`status`,ctime,utime  FROM product_pop]]>
		<where>
			<![CDATA[(status = 3  or status = 5)]]>
			<if test="name != null and name != ''"><![CDATA[AND name = #{name}]]></if>
			<if test="indate != null and indate != ''"><![CDATA[AND indate = #{indate}]]></if>
			<if test="publishMode != null and publishMode != ''"><![CDATA[AND publish_mode = #{publishMode}]]></if>
			<if test="publishTime != null and publishTime != ''"><![CDATA[AND publish_time = #{publishTime}]]></if>
			<if test="dropsTime != null and dropsTime != ''"><![CDATA[AND drops_time = #{dropsTime}]]></if>
			<if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if>
			<if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if>
		</where>
		<if test="orderField != null and orderField != '' and orderType != null and orderType != ''"><![CDATA[ORDER BY ${orderField} ${orderType}]]></if>
		<if test="startIndex != null and startIndex &gt;= 0 and pageSize != null and pageSize &gt; 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if>
	</select>

	<update id="publish" parameterType="productPop">
        <![CDATA[update product_pop ]]>
		<set>
			<if test="status != null and status != ''"><![CDATA[`status` = #{status},]]></if>
			<if test="publishTime != null and publishTime != ''"><![CDATA[ publish_time = #{publishTime},]]></if>
            <if test="publishMode != null and publishMode != ''"><![CDATA[ publish_mode = #{publishMode},publish_settime=null,]]></if>
			<if test="utime != null and utime != ''"><![CDATA[ utime = #{utime}]]></if>
		</set>
		<![CDATA[where pid = #{pid} ]]>
	</update>

	<update id="drop" parameterType="productPop">
        <![CDATA[update product_pop ]]>
		<set>
			<if test="status != null and status != ''"><![CDATA[`status` = #{status},]]></if>
			<if test="dropsTime != null and dropsTime != ''"><![CDATA[ drops_time = #{dropsTime},]]></if>
            <if test="publishMode != null and publishMode != ''"><![CDATA[ publish_mode = #{publishMode},publish_settime=null,]]></if>
			<if test="utime != null and utime != ''"><![CDATA[ utime = #{utime}]]></if>
		</set>
		<![CDATA[where pid = #{pid} ]]>
	</update>
</mapper>