123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?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.caimei.modules.hehe.dao.CmHeheCollageDao">
-
- <sql id="cmHeheCollageColumns">
- a.id AS "id",
- a.productId AS "productId",
- a.price AS "price",
- a.memberNum AS "memberNum",
- a.status AS "status",
- a.startTime AS "startTime",
- a.completeTime AS "completeTime",
- a.endTime AS "endTime",
- p.name as productName,
- s.name as shopName
- </sql>
-
- <sql id="cmHeheCollageJoins">
- left join product p on a.productId = p.productID
- left join cm_hehe_product hp on p.productID = hp.productId
- left join shop s on p.shopID = s.shopID
- </sql>
-
- <select id="get" resultType="CmHeheCollage">
- SELECT
- <include refid="cmHeheCollageColumns"/>
- FROM cm_hehe_collage a
- <include refid="cmHeheCollageJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="CmHeheCollage">
- SELECT
- <include refid="cmHeheCollageColumns"/>
- FROM cm_hehe_collage a
- <include refid="cmHeheCollageJoins"/>
- <where>
- a.status != 0
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="status != null">
- AND a.status = #{status}
- </if>
- <if test="productName != null and productName != ''">
- and p.name like concat('%',#{productName},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- and s.name like concat('%',#{shopName},'%')
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by startTime desc
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="CmHeheCollage">
- SELECT
- <include refid="cmHeheCollageColumns"/>
- FROM cm_hehe_collage a
- <include refid="cmHeheCollageJoins"/>
- <where>
-
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="getCollageOrderIds" resultType="java.lang.Integer">
- select chcm.orderId from cm_hehe_collage_member chcm left join cm_order co on chcm.orderId = co.orderID
- where collageId = #{collageId} and co.receiptStatus = 3
- </select>
- <select id="findMemberList" resultType="com.caimei.modules.hehe.entity.CmHeheCollageMember">
- select chu.nickName,cm.launchFlag,chu.mobile,chu.userIdentity,co.orderTime,co.orderNo,co.orderID as orderId
- from cm_hehe_collage_member cm
- left join user u on cm.userId = u.userID
- left join cm_hehe_user chu on u.userID = chu.userId
- left join cm_order co on cm.orderId = co.orderID
- where collageId = #{collageId} and co.receiptStatus = 3
- <if test="nickName != null and nickName != ''">
- and chu.nickName like concat('%',#{nickName},'%')
- </if>
- <if test="mobile != null and mobile != ''">
- and chu.mobile like concat('%',#{mobile},'%')
- </if>
- <if test="orderNo != null and orderNo != ''">
- and (co.orderID = #{orderNo} or co.orderNo = #{orderNo})
- </if>
- order by cm.id
- </select>
- <select id="findNoPayCollageOrderIds" resultType="java.lang.Integer">
- select co.orderID from cm_hehe_collage_member chcm left join cm_order co on chcm.orderId = co.orderID
- where co.receiptStatus = 1 and chcm.collageId = #{collageId}
- </select>
- <insert id="insert" parameterType="CmHeheCollage" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_hehe_collage(
- productId,
- price
- ) VALUES (
- #{productId},
- #{price}
- )
- </insert>
-
- <update id="update">
- UPDATE cm_hehe_collage SET
- productId = #{productId},
- price = #{price}
- WHERE id = #{id}
- </update>
- <update id="completeCollage">
- update cm_hehe_collage
- set status = 2,
- completeTime = NOW(),
- remarks = '系统自动完成拼团'
- where id = #{collageId}
- </update>
- <delete id="delete">
- DELETE FROM cm_hehe_collage
- WHERE id = #{id}
- </delete>
- <delete id="cancelOrder">
- UPDATE
- cm_order
- SET
- STATUS = 6,
- updateDate = NOW(),
- closeReason = #{reason},
- closeTime = NOW()
- WHERE
- orderID = #{orderId}
- </delete>
- </mapper>
|