|
@@ -83,6 +83,9 @@
|
|
|
<if test="status != null">
|
|
|
AND lgm.status_ = #{status}
|
|
|
</if>
|
|
|
+ <if test="liveGoodsId != null">
|
|
|
+ AND lg.goods_id_ = #{liveGoodsId}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<!-- 分页查询 -->
|
|
@@ -100,6 +103,7 @@
|
|
|
LEFT JOIN live_goods lg ON lgm.goods_id_ = lg.id_
|
|
|
<include refid="queryPageSql" />
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findByLiveGoodsIdAndStatus" resultMap="LiveGoodsMapper">
|
|
|
SELECT * FROM live_goods_mapper WHERE goods_id_ = #{liveGoodsId} AND status_ = #{status}
|
|
|
</select>
|
|
@@ -107,6 +111,19 @@
|
|
|
SELECT * FROM live_goods_mapper WHERE live_id_ = #{liveId} AND goods_id_ = #{liveGoodsId}
|
|
|
</select>
|
|
|
|
|
|
+ <sql id="queryGoodsPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="liveId != null and liveId != ''">
|
|
|
+ AND lgm.live_id_ = #{liveId}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ AND lgm.status_ = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="liveGoodsId != null">
|
|
|
+ AND lg.goods_id_ = #{liveGoodsId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
<resultMap id="LiveGoodsMapperDto" type="com.ym.mec.biz.dal.dto.LiveGoodsMapperDto">
|
|
|
<result column="id_" property="id" />
|
|
|
<result column="image_" property="image" />
|
|
@@ -122,31 +139,18 @@
|
|
|
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}
|
|
|
+ <include refid="queryGoodsPageSql"/>
|
|
|
</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" />
|
|
|
+ <include refid="queryPageSql" />
|
|
|
</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" />
|
|
|
+ <include refid="queryPageSql" />
|
|
|
ORDER BY lgm.id_
|
|
|
<include refid="global.limit"/>
|
|
|
</select>
|