|
@@ -18,22 +18,28 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryList" resultMap="footprintMap">
|
|
|
- select distinct
|
|
|
- a.* ,b.nickname as user_name,c.name as goods_name
|
|
|
- from mall_footprint a
|
|
|
- left join mall_user b on a.user_id = b.id
|
|
|
- left join mall_goods c on a.goods_id = c.id
|
|
|
- LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
|
|
|
- left join mall_store s on d.store_id = s.id
|
|
|
+ SELECT DISTINCT
|
|
|
+ a.*,
|
|
|
+ b.nickname AS user_name,
|
|
|
+ c.NAME AS goods_name
|
|
|
+ FROM
|
|
|
+ mall_product_store_rela r
|
|
|
+ INNER JOIN mall_footprint a ON r.goods_id = a.goods_id
|
|
|
+ INNER JOIN mall_store s ON r.store_id = s.id
|
|
|
+ INNER JOIN mall_goods c ON r.goods_id = c.id
|
|
|
+ INNER JOIN mall_merch_user d ON r.store_id = d.store_id
|
|
|
+ AND r.merch_sn = d.merch_sn
|
|
|
+ INNER JOIN mall_user b ON a.user_id = b.id
|
|
|
+ AND d.user_id = b.id
|
|
|
WHERE 1=1
|
|
|
<if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
</if>
|
|
|
<if test="storeId != null">
|
|
|
- and d.store_id = #{storeId}
|
|
|
+ and r.store_id = #{storeId}
|
|
|
</if>
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
- and d.merch_sn = #{merchSn}
|
|
|
+ and c.merch_sn = #{merchSn}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
AND b.username LIKE concat('%',#{name},'%')
|
|
@@ -52,19 +58,24 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryTotal" resultType="int">
|
|
|
- select count(distinct a.id) from mall_footprint a
|
|
|
- left join mall_user b on a.user_id = b.id
|
|
|
- LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
|
|
|
- left join mall_store s on d.store_id = s.id
|
|
|
+ select count(distinct a.id) FROM
|
|
|
+ mall_product_store_rela r
|
|
|
+ INNER JOIN mall_footprint a ON r.goods_id = a.goods_id
|
|
|
+ INNER JOIN mall_store s ON r.store_id = s.id
|
|
|
+ INNER JOIN mall_goods c ON r.goods_id = c.id
|
|
|
+ INNER JOIN mall_merch_user d ON r.store_id = d.store_id
|
|
|
+ AND r.merch_sn = d.merch_sn
|
|
|
+ INNER JOIN mall_user b ON a.user_id = b.id
|
|
|
+ AND d.user_id = b.id
|
|
|
WHERE 1=1
|
|
|
<if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
</if>
|
|
|
<if test="storeId != null">
|
|
|
- and d.store_id = #{storeId}
|
|
|
+ and r.store_id = #{storeId}
|
|
|
</if>
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
- and d.merch_sn = #{merchSn}
|
|
|
+ and c.merch_sn = #{merchSn}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
AND b.username LIKE concat('%',#{name},'%')
|