|
@@ -32,10 +32,10 @@
|
|
|
VALUES(#{goodsId},#{liveId},#{sellCount},NOW(),NOW())
|
|
|
</insert>
|
|
|
<insert id="batchInsert">
|
|
|
- INSERT INTO live_goods_mapper (goods_id_,live_id_,sell_count_,create_time_,update_time_)
|
|
|
+ INSERT INTO live_goods_mapper (goods_id_,live_id_,create_time_,update_time_)
|
|
|
VALUES
|
|
|
<foreach collection="liveGoodsMappers" item="item" index="index" separator=",">
|
|
|
- (#{item.goodsId},#{item.liveId},#{item.sellCount},NOW(),NOW())
|
|
|
+ (#{item.goodsId},#{item.liveId},NOW(),NOW())
|
|
|
</foreach>
|
|
|
ON DUPLICATE KEY UPDATE
|
|
|
goods_id_ = VALUES(goods_id_),
|
|
@@ -62,7 +62,7 @@
|
|
|
</update>
|
|
|
<update id="updateStatus">
|
|
|
UPDATE live_goods_mapper SET status_ = #{status},update_time_ = NOW()
|
|
|
- WHERE id_ = #{liveGoodsId}
|
|
|
+ WHERE goods_id_ = #{liveGoodsId}
|
|
|
<if test="liveId != null and liveId != ''">
|
|
|
AND live_id_ = #{liveId}
|
|
|
</if>
|
|
@@ -87,7 +87,7 @@
|
|
|
</sql>
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="LiveGoodsMapper" parameterType="map">
|
|
|
- SELECT lg.*,lg.status_ FROM live_goods_mapper lgm
|
|
|
+ SELECT lg.*,lgm.status_ FROM live_goods_mapper lgm
|
|
|
LEFT JOIN live_goods lg ON lgm.goods_id_ = lg.id_
|
|
|
<include refid="queryPageSql" />
|
|
|
ORDER BY lgm.id_
|
|
@@ -110,20 +110,44 @@
|
|
|
<resultMap id="LiveGoodsMapperDto" type="com.ym.mec.biz.dal.dto.LiveGoodsMapperDto">
|
|
|
<result column="id_" property="id" />
|
|
|
<result column="image_" property="image" />
|
|
|
- <result column="sell_count_" property="sellCount" />
|
|
|
<result column="status_" property="status" />
|
|
|
<result column="name_" property="name" />
|
|
|
<result column="original_price_" property="originalPrice" />
|
|
|
<result column="current_price_" property="currentPrice" />
|
|
|
- <result column="brief_" property="brief" />
|
|
|
+ <result column="goods_detail_url_" property="goodsDetailUrl" />
|
|
|
<result column="desc_" property="desc" />
|
|
|
- <result column="memo_" property="memo" />
|
|
|
+ <result column="stock_count_" property="stockCount" />
|
|
|
</resultMap>
|
|
|
<select id="getLiveGoodsList" resultMap="LiveGoodsMapperDto">
|
|
|
- SELECT lg.id_,lg.image_,lgm.sell_count_,
|
|
|
- lgm.status_,lg.name_,lg.original_price_,lg.current_price_,lg.brief_,lg.desc_,lg.memo_
|
|
|
+ SELECT lg.*,lgm.status_
|
|
|
FROM live_goods_mapper lgm
|
|
|
LEFT JOIN live_goods lg ON lgm.goods_id_ = lg.id_
|
|
|
WHERE lgm.live_id_ = #{liveId}
|
|
|
</select>
|
|
|
+ <sql id="queryPageSqlForGoods">
|
|
|
+ <where>
|
|
|
+ <if test="liveId != null and liveId != ''">
|
|
|
+ AND lgm.live_id_ = #{liveId}
|
|
|
+ </if>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (lg.name_ LIKE '%${search}%' OR lg.id_ = ${search})
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ AND lgm.status_ = #{status}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <select id="countLiveGoods" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(lgm.id_) FROM live_goods_mapper lgm
|
|
|
+ LEFT JOIN live_goods lg ON lgm.goods_id_ = lg.id_
|
|
|
+ <include refid="queryPageSqlForGoods" />
|
|
|
+ </select>
|
|
|
+ <select id="queryGoodsPage" resultMap="LiveGoodsMapperDto">
|
|
|
+ SELECT lg.*,lgm.status_
|
|
|
+ FROM live_goods_mapper lgm
|
|
|
+ LEFT JOIN live_goods lg ON lgm.goods_id_ = lg.id_
|
|
|
+ <include refid="queryPageSqlForGoods" />
|
|
|
+ ORDER BY lgm.id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
</mapper>
|