<?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.yeshi.fanli.dao.mybatis.lable.QualityFlashSaleMapper">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.fanli.entity.bus.lable.QualityFlashSale">
|
<id column="fs_id" property="id" jdbcType="BIGINT" />
|
<result column="fs_type" property="type" jdbcType="INTEGER" />
|
<result column="fs_weight" property="weight" jdbcType="DOUBLE" />
|
<result column="fs_createtime" property="createtime" jdbcType="TIMESTAMP" />
|
<result column="fs_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
|
|
<association property="taoBaoGoodsBrief" column="fs_qfgoods_id" javaType="com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief">
|
<id column="fs_qfgoods_id" property="id" jdbcType="BIGINT" />
|
</association>
|
</resultMap>
|
|
<sql id="Base_Column_List">fs_id,fs_qfgoods_id,fs_type,fs_weight,fs_createtime,fs_updatetime
|
</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_quality_flash_sale where fs_id = #{id,jdbcType=BIGINT}
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_quality_flash_sale where fs_id = #{id,jdbcType=BIGINT}
|
</delete>
|
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale"
|
useGeneratedKeys="true" keyProperty="id">insert into
|
yeshi_ec_quality_flash_sale
|
(fs_id,fs_qfgoods_id,fs_type,fs_weight,fs_createtime,fs_updatetime) values
|
(#{id,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_quality_flash_sale
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">fs_id,</if>
|
<if test="taoBaoGoodsBrief != null">fs_qfgoods_id,</if>
|
<if test="type != null">fs_type,</if>
|
<if test="weight != null">fs_weight,</if>
|
<if test="createtime != null">fs_createtime,</if>
|
<if test="updatetime != null">fs_updatetime,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="weight != null">#{weight,jdbcType=DOUBLE},</if>
|
<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
|
<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale">update
|
yeshi_ec_quality_flash_sale set
|
fs_qfgoods_id = #{taoBaoGoodsBrief.id,jdbcType=BIGINT},
|
fs_type = #{type,jdbcType=INTEGER},
|
fs_weight = #{weight,jdbcType=DOUBLE},
|
fs_createtime = #{createtime,jdbcType=TIMESTAMP},
|
fs_updatetime = #{updatetime,jdbcType=TIMESTAMP} where fs_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFlashSale">
|
update yeshi_ec_quality_flash_sale
|
<set>
|
<if test="taoBaoGoodsBrief != null">fs_qfgoods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
|
<if test="type != null">fs_type=#{type,jdbcType=INTEGER},</if>
|
<if test="weight != null">fs_weight=#{weight,jdbcType=DOUBLE},</if>
|
<if test="createtime != null">fs_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
|
<if test="updatetime != null">fs_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where fs_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<insert id="insertBatch" parameterType="java.util.List">
|
insert into yeshi_ec_quality_flash_sale
|
(
|
<include refid="Base_Column_List" />
|
)
|
values
|
<foreach collection="list" item="item" separator=",">
|
(
|
#{item.id,jdbcType=BIGINT},
|
#{item.taoBaoGoodsBrief.id,jdbcType=BIGINT},
|
#{item.type,jdbcType=INTEGER},
|
#{item.weight,jdbcType=DOUBLE},
|
#{item.createtime,jdbcType=TIMESTAMP},
|
#{item.updatetime,jdbcType=TIMESTAMP}
|
)
|
</foreach>
|
</insert>
|
|
<update id="updateBatchSelective" parameterType="java.util.List">
|
update yeshi_ec_quality_flash_sale
|
<trim prefix="set" suffixOverrides=",">
|
<trim prefix="fs_weight =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.weight !=null">
|
when fs_id=#{item.id} then #{item.weight}
|
</if>
|
</foreach>
|
</trim>
|
<trim prefix="fs_type =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.type !=null">
|
when fs_id=#{item.id} then #{item.type}
|
</if>
|
</foreach>
|
</trim>
|
<trim prefix="fs_updatetime =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.updatetime !=null">
|
when fs_id=#{item.id} then #{item.updatetime}
|
</if>
|
</foreach>
|
</trim>
|
</trim>
|
where fs_id in
|
<foreach collection="list" index="index" item="item"
|
separator="," open="(" close=")">
|
#{item.id,jdbcType=BIGINT}
|
</foreach>
|
</update>
|
|
<select id="listQueryByQualityID" resultMap="BaseResultMap">
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_quality_flash_sale
|
WHERE fs_qfgoods_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</select>
|
|
<delete id="deleteByGoodsId" parameterType="java.lang.Long">
|
delete from yeshi_ec_quality_flash_sale where fs_qfgoods_id = #{qid,jdbcType=BIGINT}
|
</delete>
|
|
<delete id="deleteBatchByQualityID" parameterType="java.util.List">
|
delete FROM yeshi_ec_quality_flash_sale WHERE fs_qfgoods_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</delete>
|
|
<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
delete FROM yeshi_ec_quality_flash_sale WHERE fs_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</delete>
|
|
<select id="queryNeedRemove" resultType="java.lang.Long">
|
SELECT fs_id FROM `yeshi_ec_quality_flash_sale`
|
WHERE <![CDATA[TO_DAYS(`fs_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`fs_updatetime`)) >= #{hour}]]>
|
ORDER BY fs_updatetime LIMIT ${start},${count}
|
</select>
|
|
|
</mapper>
|