|
@@ -2,92 +2,105 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei365.order.mapper.OrderSellerMapper">
|
|
|
<update id="updateClubLastCheckOrderDate">
|
|
|
- UPDATE club SET lastCheckOrderDate = #{date} WHERE clubID = #{clubId}
|
|
|
+ UPDATE club
|
|
|
+ SET lastCheckOrderDate = #{date}
|
|
|
+ WHERE clubID = #{clubId}
|
|
|
</update>
|
|
|
<select id="getClubUserIds" resultType="java.lang.Integer">
|
|
|
- SELECT userID FROM club WHERE spID = #{serviceProviderId}
|
|
|
+ SELECT userID
|
|
|
+ FROM club
|
|
|
+ WHERE spID = #{serviceProviderId}
|
|
|
</select>
|
|
|
<select id="getOrderList" resultType="com.caimei365.order.model.vo.OrderVo">
|
|
|
SELECT
|
|
|
- orderSeen,
|
|
|
- orderID AS orderId,
|
|
|
- shopOrderIds,
|
|
|
- orderSource,
|
|
|
- orderNo,
|
|
|
- userID AS userId,
|
|
|
- clubID AS clubId,
|
|
|
- buyUserID AS buyUserId,
|
|
|
- orderTime,
|
|
|
- updateDate,
|
|
|
- delFlag,
|
|
|
- userBeans,
|
|
|
- orderType,
|
|
|
- orderSubmitType,
|
|
|
- confirmFlag,
|
|
|
- onlinePayFlag,
|
|
|
- splitFlag,
|
|
|
- payFlag,
|
|
|
- receiptStatus,
|
|
|
- payStatus,
|
|
|
- zeroCostFlag,
|
|
|
- sendOutStatus,
|
|
|
- refundType,
|
|
|
- affirmPaymentFlag,
|
|
|
- productCount,
|
|
|
- presentCount,
|
|
|
- promotionalGiftsCount,
|
|
|
- hasActProduct,
|
|
|
- promotionFullReduction,
|
|
|
- secondHandOrderFlag,
|
|
|
- invoiceFlag,
|
|
|
- freePostFlag AS postageFlag,
|
|
|
- freight AS postage,
|
|
|
- productTotalFee,
|
|
|
- orderTotalFee,
|
|
|
- payTotalFee,
|
|
|
- payableAmount,
|
|
|
- balancePayFee,
|
|
|
- discountFee,
|
|
|
- couponAmount,
|
|
|
- status,
|
|
|
- confirmTime,
|
|
|
- payTime,
|
|
|
- rebateFlag,
|
|
|
- clauseID AS clauseId,
|
|
|
- clauseName
|
|
|
- FROM cm_order
|
|
|
- WHERE delFlag = 0 AND userID IN
|
|
|
+ co.orderSeen,
|
|
|
+ co.orderID AS orderId,
|
|
|
+ co.shopOrderIds,
|
|
|
+ co.orderSource,
|
|
|
+ co.orderNo,
|
|
|
+ co.userID AS userId,
|
|
|
+ co.clubID AS clubId,
|
|
|
+ co.buyUserID AS buyUserId,
|
|
|
+ co.orderTime,
|
|
|
+ co.updateDate,
|
|
|
+ co.delFlag,
|
|
|
+ co.userBeans,
|
|
|
+ co.orderType,
|
|
|
+ co.orderSubmitType,
|
|
|
+ co.confirmFlag,
|
|
|
+ co.onlinePayFlag,
|
|
|
+ co.splitFlag,
|
|
|
+ co.payFlag,
|
|
|
+ co.receiptStatus,
|
|
|
+ co.payStatus,
|
|
|
+ co.zeroCostFlag,
|
|
|
+ co.sendOutStatus,
|
|
|
+ co.refundType,
|
|
|
+ co.affirmPaymentFlag,
|
|
|
+ co.productCount,
|
|
|
+ co.presentCount,
|
|
|
+ co.promotionalGiftsCount,
|
|
|
+ co.hasActProduct,
|
|
|
+ co.promotionFullReduction,
|
|
|
+ co.secondHandOrderFlag,
|
|
|
+ co.invoiceFlag,
|
|
|
+ co.freePostFlag AS postageFlag,
|
|
|
+ co.freight AS postage,
|
|
|
+ co.productTotalFee,
|
|
|
+ co.orderTotalFee,
|
|
|
+ co.payTotalFee,
|
|
|
+ co.payableAmount,
|
|
|
+ co.balancePayFee,
|
|
|
+ co.discountFee,
|
|
|
+ co.couponAmount,
|
|
|
+ co.status,
|
|
|
+ co.confirmTime,
|
|
|
+ co.payTime,
|
|
|
+ co.rebateFlag,
|
|
|
+ co.clauseID AS clauseId,
|
|
|
+ co.clauseName
|
|
|
+ <if test="orderSubmitType == 3">
|
|
|
+ ,s.linkMan as serviceName
|
|
|
+ </if>
|
|
|
+ FROM cm_order co
|
|
|
+ <if test="orderSubmitType == 3">
|
|
|
+ LEFT JOIN club c ON co.userId=c.userId
|
|
|
+ LEFT JOIN serviceprovider s ON c.spId=s.serviceProviderID
|
|
|
+ </if>
|
|
|
+ WHERE co.delFlag = 0 AND co.userID IN
|
|
|
<foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
|
|
|
#{userId}
|
|
|
</foreach>
|
|
|
<if test="listType == 1 ">
|
|
|
- AND status = '0'
|
|
|
+ AND co.status = '0'
|
|
|
</if>
|
|
|
<if test="listType == 2 ">
|
|
|
- AND status IN(11,12,13,21,22,23)
|
|
|
+ AND co.status IN(11,12,13,21,22,23)
|
|
|
</if>
|
|
|
<if test="listType == 3 ">
|
|
|
- AND status IN(11,12,21,22,31,32)
|
|
|
+ AND co.status IN(11,12,21,22,31,32)
|
|
|
</if>
|
|
|
<if test="listType == 4 ">
|
|
|
- AND status IN(12,13,22,23,32,33)
|
|
|
+ AND co.status IN(12,13,22,23,32,33)
|
|
|
</if>
|
|
|
<if test="listType == 5 ">
|
|
|
- AND refundType IN(1,2)
|
|
|
+ AND co.refundType IN(1,2)
|
|
|
</if>
|
|
|
<if test="orderSubmitType == 1">
|
|
|
- AND orderSubmitType IN (0,1,2)
|
|
|
+ AND co.orderSubmitType IN (0,1,2)
|
|
|
</if>
|
|
|
<if test="orderSubmitType == 2">
|
|
|
- AND orderSubmitType IN (3,4)
|
|
|
+ AND co.orderSubmitType IN (3,4)
|
|
|
</if>
|
|
|
<if test="orderNo != null and orderNo != '' ">
|
|
|
- AND orderNo = #{orderNo}
|
|
|
+ AND co.orderNo = #{orderNo}
|
|
|
</if>
|
|
|
- ORDER BY orderTime DESC
|
|
|
+ ORDER BY co.orderTime DESC
|
|
|
</select>
|
|
|
<select id="getSpIdByClubId" resultType="java.lang.Integer">
|
|
|
- SELECT spID FROM club WHERE clubID = #{clubId}
|
|
|
+ SELECT spID
|
|
|
+ FROM club
|
|
|
+ WHERE clubID = #{clubId}
|
|
|
</select>
|
|
|
<select id="getOrderListClub" resultType="com.caimei365.order.model.vo.OrderVo">
|
|
|
SELECT
|
|
@@ -162,7 +175,9 @@
|
|
|
ORDER BY orderTime DESC
|
|
|
</select>
|
|
|
<select id="getUserIdBySpId" resultType="java.lang.Integer">
|
|
|
- SELECT userID FROM serviceprovider WHERE serviceProviderID = #{serviceProviderId}
|
|
|
+ SELECT userID
|
|
|
+ FROM serviceprovider
|
|
|
+ WHERE serviceProviderID = #{serviceProviderId}
|
|
|
</select>
|
|
|
<select id="getOrderListByKeyword" resultType="com.caimei365.order.model.vo.OrderVo">
|
|
|
SELECT DISTINCT
|
|
@@ -222,7 +237,9 @@
|
|
|
ORDER BY co.orderTime DESC
|
|
|
</select>
|
|
|
<select id="getClubIdsBySellerId" resultType="java.lang.Integer">
|
|
|
- select userID from club where spID = #{serviceProviderId}
|
|
|
+ select userID
|
|
|
+ from club
|
|
|
+ where spID = #{serviceProviderId}
|
|
|
</select>
|
|
|
<select id="getSellerOrderCount" resultType="java.lang.Integer">
|
|
|
SELECT COUNT(*) FROM cm_order
|
|
@@ -247,7 +264,10 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getLastCheckOrderDate" resultType="java.util.Date">
|
|
|
- SELECT lastCheckOrderDate FROM club WHERE userID = #{userId} LIMIT 1
|
|
|
+ SELECT lastCheckOrderDate
|
|
|
+ FROM club
|
|
|
+ WHERE userID = #{userId}
|
|
|
+ LIMIT 1
|
|
|
</select>
|
|
|
<select id="getUncheckedOrderCount" resultType="java.lang.Integer">
|
|
|
SELECT COUNT(*) FROM cm_order
|
|
@@ -257,4 +277,37 @@
|
|
|
AND orderTime > #{lastCheckOrderDate}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <select id="getClubUserIdsByRole" resultType="java.lang.Integer">
|
|
|
+ SELECT DISTINCT userId FROM club
|
|
|
+ WHERE
|
|
|
+ (SELECT serviceProviderId
|
|
|
+ FROM cm_serviceteam_manager
|
|
|
+ WHERE serviceProviderId=#{serviceProviderId}) IS NOT NULL
|
|
|
+ AND spID IN
|
|
|
+ (SELECT serviceId
|
|
|
+ FROM cm_serviceteam_group
|
|
|
+ WHERE serviceId!=#{serviceProviderId})
|
|
|
+ UNION
|
|
|
+ SELECT userId FROM club
|
|
|
+ WHERE
|
|
|
+ (SELECT serviceProviderId
|
|
|
+ FROM cm_serviceteam_manager
|
|
|
+ WHERE serviceProviderId=#{serviceProviderId}) IS NULL
|
|
|
+ AND spID IN
|
|
|
+ (SELECT serviceId
|
|
|
+ FROM cm_serviceteam_group csg
|
|
|
+ LEFT JOIN cm_serviceteam_role csr ON csg.teamId=csr.id
|
|
|
+ WHERE csr.leaderId=#{serviceProviderId}
|
|
|
+ AND csg.serviceId!=#{serviceProviderId})
|
|
|
+ </select>
|
|
|
+ <select id="findLeaderId" resultType="java.lang.Integer">
|
|
|
+ SELECT csr.leaderId
|
|
|
+ FROM cm_serviceteam_role csr
|
|
|
+ LEFT JOIN cm_serviceteam_group csg ON csg.teamId = csr.id
|
|
|
+ WHERE csg.serviceId = #{spId}
|
|
|
+ </select>
|
|
|
+ <select id="findManagerId" resultType="java.lang.Integer">
|
|
|
+ select serviceProviderId
|
|
|
+ from cm_serviceteam_manager
|
|
|
+ </select>
|
|
|
</mapper>
|