ProductPoolMapper.xml 4.12 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.yoho.search.dal.ProductPoolMapper">
    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductPool">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="activityId" property="activityId" jdbcType="INTEGER"/>
        <result column="pool_name" property="poolName" jdbcType="VARCHAR"/>
        <result column="comment" property="comment" jdbcType="VARCHAR"/>
        <result column="productType" property="productType" jdbcType="CHAR"/>
        <result column="diff_type" property="diffType" jdbcType="CHAR"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="shop_id" property="shopId" jdbcType="INTEGER"/>
        <result column="backImageUrl" property="backImageUrl" jdbcType="VARCHAR"/>
        <result column="service_type" property="serviceType" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, activityId, pool_name, comment, productType, diff_type, create_time, shop_id, backImageUrl,service_type
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from product_pool
        where id = #{id,jdbcType=INTEGER}
        limit 1
    </select>

    <select id="selectByIds" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        product_pool
        where diff_type = 4 and id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from product_pool
        where id = #{id,jdbcType=INTEGER}
    </delete>


    <insert id="insert" parameterType="com.yoho.search.dal.model.ProductPool">
        insert into product_pool (id, activityId, pool_name, comment, productType, diff_type, create_time, shop_id, backImageUrl,service_type)
        values (#{id,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{poolName,jdbcType=VARCHAR},
        #{comment,jdbcType=VARCHAR}, #{productType,jdbcType=CHAR}, #{diffType,jdbcType=CHAR},
        #{createTime,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{backImageUrl,jdbcType=VARCHAR},#{serviceType,jdbcType=INTEGER})
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductPool">
        update product_pool
        <set>
            <if test="activityId != null">
                activityId = #{activityId,jdbcType=INTEGER},
            </if>
            <if test="poolName != null">
                pool_name = #{poolName,jdbcType=VARCHAR},
            </if>
            <if test="comment != null">
                comment = #{comment,jdbcType=VARCHAR},
            </if>
            <if test="productType != null">
                productType = #{productType,jdbcType=CHAR},
            </if>
            <if test="diffType != null">
                diff_type = #{diffType,jdbcType=CHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="shopId != null">
                shop_id = #{shopId,jdbcType=INTEGER},
            </if>
            <if test="backImageUrl != null">
                backImageUrl = #{backImageUrl,jdbcType=VARCHAR},
            </if>
            <if test="serviceType != null">
                service_type = #{serviceType,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <select id="selectCount" resultType="java.lang.Integer" timeout="20000">
		SELECT count(1) FROM product_pool
	</select>

    <select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List" />
        from product_pool limit #{offset},#{pageSize}
    </select>

</mapper>