<?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.ruoyi.promotion.mapper.PromotionWishMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.promotion.domain.PromotionWish">
|
<id column="id" property="id" />
|
<result column="member_id" property="memberId" />
|
<result column="phone" property="phone" />
|
<result column="recommend_status" property="recommendStatus" />
|
<result column="remark" property="remark" />
|
<result column="create_by" property="createBy" />
|
<result column="create_time" property="createTime" />
|
<result column="update_by" property="updateBy" />
|
<result column="update_time" property="updateTime" />
|
<result column="del_flag" property="delFlag" />
|
</resultMap>
|
|
<resultMap id="WishResultMap" type="com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishVO">
|
<id column="id" property="id" />
|
<result column="member_id" property="memberId" />
|
<result column="phone" property="phone" />
|
<result column="recommend_status" property="recommendStatus" />
|
<result column="goodsName" property="goodsName" />
|
<result column="create_time" property="createTime" />
|
<collection property="recommendList" javaType="java.util.List" resultMap="RecommendResultMap"/>
|
</resultMap>
|
|
<resultMap id="RecommendResultMap" type="com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishRecommendVO">
|
<id column="recommendId" property="id" />
|
<result column="recommendGoodsName" property="goodsName" />
|
<result column="selling_price" property="sellingPrice" />
|
<result column="available_num" property="availableNum" />
|
<result column="goods_image_url" property="goodsImageUrl" />
|
<result column="expire_time" property="expireTime" />
|
</resultMap>
|
|
<select id="getBulletList"
|
resultType="com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishBulletVO">
|
SELECT tpw.member_id, tpw.create_time, tpwl.expected_year, tpwl.goods_name
|
FROM t_promotion_wish tpw
|
INNER JOIN t_promotion_wish_list tpwl ON tpw.id = tpwl.wish_id
|
<where>
|
tpw.del_flag = 0 AND tpw.recommend_status = 1 and tpw.show_flag = 1
|
</where>
|
GROUP BY tpwl.wish_id,tpw.member_id
|
</select>
|
<select id="getRecommendList"
|
resultType="com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishRecommendVO"
|
parameterType="java.lang.Long">
|
SELECT
|
r.id, r.goods_name, r.selling_price, r.available_num, r.goods_image_url,r.expire_time
|
FROM
|
t_promotion_wish w
|
LEFT JOIN
|
t_promotion_wish_recommend r ON w.id = r.wish_id
|
<where>
|
w.del_flag = 0
|
AND w.member_id = #{memberId}
|
AND w.recommend_status = 1
|
AND r.purchase_status = 0
|
AND r.expire_time > NOW();
|
</where>
|
</select>
|
<select id="selectNotRecommend" resultType="com.ruoyi.promotion.domain.PromotionWish"
|
parameterType="java.lang.Long">
|
SELECT
|
*
|
FROM
|
t_promotion_wish
|
<where>
|
del_flag = 0
|
AND member_id = #{memberId}
|
AND recommend_status = 0
|
AND (last_prompt_date IS NULL OR last_prompt_date < CURDATE());
|
</where>
|
</select>
|
<select id="getWishHistory" resultMap="WishResultMap">
|
SELECT tpw.id,
|
tpw.member_id,
|
tpw.phone,
|
tpw.recommend_status,
|
tpw.create_time,
|
GROUP_CONCAT(tpwl.goods_name) AS goodsName,
|
tpwr.id AS recommendId,
|
tpwr.goods_name AS recommendGoodsName,
|
tpwr.selling_price,
|
tpwr.available_num,
|
tpwr.goods_image_url,
|
tpwr.expire_time
|
FROM t_promotion_wish tpw
|
LEFT JOIN t_promotion_wish_list tpwl ON tpw.id = tpwl.wish_id
|
LEFT JOIN t_promotion_wish_recommend tpwr ON tpwr.wish_id = tpw.id
|
<where>
|
tpw.del_flag = 0 AND tpw.show_flag = 1 AND tpw.member_id = #{memberId}
|
</where>
|
GROUP BY tpw.id
|
</select>
|
<select id="getRecommendNum" resultType="java.lang.Integer"
|
parameterType="java.lang.Long">
|
SELECT COALESCE(SUM(tpwr.available_num), 0)
|
FROM t_promotion_wish tpw
|
LEFT JOIN t_promotion_wish_recommend tpwr ON tpwr.wish_id = tpw.id
|
<where>
|
tpw.del_flag = 0
|
AND tpwr.expire_time >= NOW()
|
AND tpw.member_id = #{memberId}
|
</where>
|
</select>
|
<select id="getCompletedWishCount" resultType="java.lang.Long">
|
SELECT COUNT(id)
|
FROM t_promotion_wish
|
</select>
|
|
</mapper>
|