UfoStoragePriceMapper.xml 9.28 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.UfoStoragePriceMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ufo_product.StoragePrice">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="product_id" property="productId" jdbcType="INTEGER"/>
        <result column="skup" property="skup" jdbcType="INTEGER"/>
        <result column="goods_id" property="goodsId" jdbcType="INTEGER"/>
        <result column="storage_id" property="storageId" jdbcType="SMALLINT"/>
        <result column="depot_num" property="depotNum" jdbcType="INTEGER"/>
        <result column="seller_uid" property="sellerUid" jdbcType="INTEGER"/>
        <result column="price" property="price" jdbcType="DECIMAL"/>
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="is_hide" property="isHide" jdbcType="INTEGER"/>
        <result column="pre_sale_flag" property="preSaleFlag" jdbcType="INTEGER"/>
        <result column="region" property="region" jdbcType="INTEGER"/>
    </resultMap>

    <resultMap id="UfoStorageMinPriceMap" type="com.yoho.search.base.bo.UfoStorageMinPrice">
        <id column="storage_id" property="storageId" jdbcType="INTEGER"/>
        <result column="availableNowPrice" property="availableNowPrice" jdbcType="DECIMAL"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status, update_time,
        create_time,is_hide,pre_sale_flag,region
    </sql>

    <select id="selectCount" resultType="java.lang.Integer" timeout="20000">
	    select count(*) from storage_price
    </select>

    <select id="selectPageList" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from storage_price
        order by id
        limit #{offset},#{pageSize}
    </select>

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

    <select id="selectStoragePriceIdBySkup" resultType="java.lang.Integer" parameterType="java.lang.Integer">
        select id from storage_price where skup = #{skup,jdbcType=INTEGER} limit 1
    </select>

    <select id="selectListByPrimaryKeys" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from storage_price
        where id in
        <foreach item="item" index="index" collection="ids" open="("  separator="," close=")">
            #{item}
        </foreach>
    </select>

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

    <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ufo_product.StoragePrice">
        insert into storage_price
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="skup != null">
                skup,
            </if>
            <if test="productId != null">
                product_id,
            </if>
            <if test="goodsId != null">
                goods_id,
            </if>
            <if test="storageId != null">
                storage_id,
            </if>
            <if test="depotNum != null">
                depot_num,
            </if>
            <if test="sellerUid != null">
                seller_uid,
            </if>
            <if test="price != null">
                price,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="isHide != null">
                is_hide,
            </if>
            <if test="preSaleFlag != null">
                pre_sale_flag,
            </if>
            <if test="region != null">
                region,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="skup != null">
                #{skup,jdbcType=INTEGER},
            </if>
            <if test="productId != null">
                #{productId,jdbcType=INTEGER},
            </if>
            <if test="goodsId != null">
                #{goodsId,jdbcType=INTEGER},
            </if>
            <if test="storageId != null">
                #{storageId,jdbcType=INTEGER},
            </if>
            <if test="depotNum != null">
                #{depotNum,jdbcType=INTEGER},
            </if>
            <if test="sellerUid != null">
                #{sellerUid,jdbcType=INTEGER},
            </if>
            <if test="price != null">
                #{price,jdbcType=DECIMAL},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=INTEGER},
            </if>
            <if test="isHide != null">
                #{isHide,jdbcType=INTEGER},
            </if>
            <if test="preSaleFlag != null">
                #{preSaleFlag,jdbcType=INTEGER},
            </if>
            <if test="region != null">
                #{region,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ufo_product.StoragePrice">
        update storage_price
        <set>
            <if test="skup != null">
                skup = #{skup,jdbcType=INTEGER},
            </if>
            <if test="productId != null">
                product_id = #{productId,jdbcType=INTEGER},
            </if>
            <if test="goodsId != null">
                goods_id = #{goodsId,jdbcType=INTEGER},
            </if>
            <if test="storageId != null">
                storage_id = #{storageId,jdbcType=SMALLINT},
            </if>
            <if test="depotNum != null">
                depot_num = #{depotNum,jdbcType=INTEGER},
            </if>
            <if test="sellerUid != null">
                seller_uid = #{sellerUid,jdbcType=INTEGER},
            </if>
            <if test="price != null">
                price = #{price,jdbcType=DECIMAL},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="isHide != null">
                is_hide = #{isHide,jdbcType=INTEGER},
            </if>
            <if test="preSaleFlag != null">
                pre_sale_flag = #{preSaleFlag,jdbcType=INTEGER},
            </if>
            <if test="region != null">
                region = #{region,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ufo_product.StoragePrice" >
        update storage_price
        set skup = #{skup,jdbcType=INTEGER},
        product_id = #{productId,jdbcType=INTEGER},
        goods_id = #{goodsId,jdbcType=INTEGER},
        storage_id = #{storageId,jdbcType=INTEGER},
        depot_num = #{depotNum,jdbcType=INTEGER},
        seller_uid = #{sellerUid,jdbcType=INTEGER},
        price = #{price,jdbcType=DECIMAL},
        status = #{status,jdbcType=INTEGER},
        update_time = #{updateTime,jdbcType=INTEGER},
        create_time = #{createTime,jdbcType=INTEGER},
        is_hide = #{isHide,jdbcType=INTEGER},
        pre_sale_flag = #{preSaleFlag,jdbcType=INTEGER},
        region = #{region,jdbcType=INTEGER}
        where id = #{id,jdbcType=INTEGER}
    </update>

    <select id="selectByProductIdList" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from storage_price
        where
        product_id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectStorageMinPriceList" resultMap="UfoStorageMinPriceMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from storage_price
        where
        storage_id in
        <foreach item="item" index="index" collection="storageIds"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        and pre_sale_flag not in(5,6)
        and status = 1
        and is_hide = 0
    </select>

</mapper>