123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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.NewOrderProductDao">
- <sql id="orderProductColumns">
- a.`orderProductID` AS `orderProductID`,
- a.`orderNo` AS `orderNo`,
- a.`orderID` AS `orderID`,
- a.`shopOrderID` AS `shopOrderID`,
- a.`shopOrderNo` AS `shopOrderNo`,
- a.`shopID` AS `shopID`,
- a.`productID` AS `productID`,
- a.`num` AS `num`,
- a.`presentNum` AS `presentNum`,
- a.`outStoreType` AS `outStoreType`,
- a.`skuID` AS `skuID`,
- a.`props` AS `props`,
- a.`propName` AS `propName`,
- a.`productNo` AS `productNo`,
- a.`price` AS `price`,
- a.`normalPrice` AS `normalPrice`,
- a.`price0` AS `price0`,
- a.`price1` AS `price1`,
- a.`totalAmount` AS `totalAmount`,
- a.`totalFee` AS `totalFee`,
- a.`shouldPayFee` AS `shouldPayFee`,
- a.`discount` AS `discount`,
- a.`discountPrice` AS `discountPrice`,
- a.`taxRate` AS `taxRate`,
- a.`addedValueTax` AS `addedValueTax`,
- a.`totalAddedValueTax` AS `totalAddedValueTax`,
- IFNULL(a.`shouldPayTotalTax` ,0) AS `shouldPayTotalTax`,
- a.`shopFee` AS `shopFee`,
- a.`otherFee` AS `otherFee`,
- a.`cmFee` AS `cmFee`,
- a.`singleShopFee` AS `singleShopFee`,
- a.`singleOtherFee` AS `singleOtherFee`,
- a.`singleCmFee` AS `singleCmFee`,
- a.`status` AS `status`,
- a.`commentFlag` AS `commentFlag`,
- a.`totalBeans` AS `totalBeans`,
- a.`useBalanceAmount` AS `useBalanceAmount`,
- a.`useBeanAmount` AS `useBeanAmount`,
- a.`notOutStore` AS `notOutStore`,
- a.`cmbeanPrice` AS `cmbeanPrice`,
- a.`isActProduct` AS `isActProduct`,
- a.`isGiftProduct` AS `isGiftProduct`,
- a.`productActInfo` AS `productActInfo`,
- a.`buyAgainFlag` AS `buyAgainFlag`,
- a.`confirmProductFlag` AS `confirmProductFlag`,
- a.`payStatus` AS `payStatus`,
- a.`name` AS `name`,
- p.`unit` AS `unit`,
- a.`actType` AS `actType`,
- a.`actPreferential` AS `actPreferential`,
- a.`preferential` AS `preferential`,
- (select mainImage from product p where p.productID = a.productID) AS image,
- a.`discountFee` AS `discountFee`,
- (select cso.status from cm_shop_order cso where cso.shopOrderID = a.shopOrderID) AS status,
- a.`productUnit` AS `productUnit`,
- a.`productImage` AS `productImage`,
- a.`shopName` AS `shopName`,
- p.costProportional AS costProportional,
- p.stock AS stock,
- p.costCheckFlag AS costCheckFlag,
- p.costPrice AS costPrice,
- a.costPrice as newCostPrice,
- p.aliasName AS aliasName,
- a.singleShouldPayTotalTax AS singleShouldPayTotalTax
- </sql>
- <sql id="orderProductJoins">
- LEFT JOIN product p ON p.productID = a.productID
- </sql>
- <select id="get" resultType="com.caimei.modules.order.entity.NewOrderProduct">
- SELECT
- <include refid="orderProductColumns"/>
- FROM cm_order_product a
- <include refid="orderProductJoins"/>
- WHERE a.orderProductID = #{orderProductID}
- </select>
- <select id="findListByShopOrderID" resultType="com.caimei.modules.order.entity.NewOrderProduct">
- SELECT
- <include refid="orderProductColumns"/>
- FROM cm_order_product a
- <include refid="orderProductJoins"/>
- WHERE a.shopOrderID = #{shopOrderID}
- </select>
- <select id="getReturningNum" resultType="Integer">
- SELECT
- IFNULL(sum(a.actualReturnedNum+a.actualCancelNum),0)
- FROM cm_returned_purchase_product a
- right join cm_returned_purchase b on a.returnedID = b.id
- WHERE a.orderProductID = #{orderProductID}
- and b.status = 1
- and b.delFlag = 0
- </select>
- <select id="getReturnedNum" resultType="Integer">
- SELECT
- IFNULL(sum(a.actualReturnedNum+a.actualCancelNum),0)
- FROM cm_returned_purchase_product a
- right join cm_returned_purchase b on a.returnedID = b.id
- WHERE a.orderProductID = #{orderProductID}
- and b.status = 2
- and b.delFlag = 0
- </select>
- <select id="getReceivedNum" resultType="Integer">
- SELECT
- IFNULL(sum(a.num),0)
- FROM cm_logistics_record a
- right join cm_logistics_batch b on a.logisticsBatchID = b.id
- WHERE a.orderProductID = #{orderProductID}
- and b.status = 1
- </select>
- </mapper>
|