12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?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.order.dao.CmUtilsDao">
- <select id="selectPayTotalFee" resultType="java.lang.Double">
- select ROUND(IFNULL((
- co.payTotalFee - (IFNULL((
- select ROUND(SUM((IFNULL(op.costPrice, 0) *
- (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0))) +
- IFNULL(op.shouldPayTotalTax, 0)),
- 2)
- from cm_order_product op
- left join cm_shop_order cso on cso.shopOrderID = op.shopOrderID
- where cso.orderID = co.orderID
- AND op.productID != 999
- group by cso.orderID
- ), 0)) - (select IFNULL(SUM(cso.shopOtherFee), 0)
- from cm_shop_order cso
- where cso.orderID = co.orderID)
- - IFNULL((SELECT SUM(shopPostFee + IF(differenceType = 1, differencePrice, 0) -
- IF(differenceType = 2, differencePrice, 0))
- FROM cm_shop_order
- WHERE orderID = co.orderID), 0)
- + IFNULL((SELECT SUM(cpsr.wipePayment)
- FROM cm_pay_shop_record cpsr
- WHERE cpsr.shopOrderID IN (SELECT cso.shopOrderID
- FROM cm_shop_order cso
- WHERE cso.orderID = co.orderID)
- AND cpsr.delFlag = 0
- AND (cpsr.`status` = 1 OR cpsr.`status` = 0)), 0)
- ), 0), 2) as "采美总佣金"
- from cm_order co
- where co.orderID = #{orderID}
- </select>
- <select id="selectPayTotalFees" resultType="java.lang.Double">
- select ROUND(IFNULL((
- co.payTotalFee - (IFNULL((
- SELECT ROUND(SUM((IFNULL(op.costPrice, 0) *
- (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0))) +
- IFNULL(op.shouldPayTotalTax, 0)), 2)
- FROM cm_order_product op
- LEFT JOIN cm_shop_order cso ON cso.shopOrderID = op.shopOrderID
- WHERE cso.orderID = co.orderID
- AND op.productID != 999
- GROUP BY cso.orderID
- ), 0)) - (SELECT IFNULL(SUM(cso.shopOtherFee +
- IF(differenceType = 1, differencePrice, 0) -
- IF(differenceType = 2, differencePrice, 0)),
- 0)
- FROM cm_shop_order cso
- WHERE cso.orderID = co.orderID)
- - IFNULL((SELECT SUM(shopPostFee) FROM cm_shop_order WHERE orderID = co.orderID), 0)
- ), 0), 2) as "采美总佣金"
- from cm_order co
- where orderID = #{orderID}
- </select>
- <select id="findOrderIsSecond" resultType="java.lang.Integer">
- select secondHandOrderFlag from cm_order where orderId= #{orderId}
- </select>
- </mapper>
|