12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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.NewShouldPayDao">
-
- <sql id="shouldPayColumns">
- co.orderID AS "orderId",
- co.orderNo AS "orderNo",
- co.orderTime AS "orderTime",
- co.status AS "status",
- co.userID AS "userId",
- co.clubID AS "clubId",
- co.orderSubmitType AS "orderTypeShow",
- co.orderType AS "orderTypeSys",
- co.payTotalFee AS "payTotalFee",
- (SELECT IFNULL(sum(shouldPayFee),0) FROM cm_order_product WHERE orderId=co.orderID) AS "shouldPayProduct",
- (SELECT IFNULL(sum(shouldPayFee),0) FROM cm_order_product WHERE orderId=co.orderID AND payStatus=2) AS "received",
- (SELECT IFNULL(count(1),0) FROM cm_order_product WHERE orderID=co.orderID) AS "productTypeNum" ,
- (SELECT IFNULL(count(1),0) FROM cm_new_finance_charge WHERE orderSequence like CONCAT(co.orderNo,'%') and status=2) AS "applyPayProductNum",
- bou.province AS "province",
- bou.city AS "city",
- bou.town AS "town",
- bou.name AS "clubName",
- bou.address AS "clubAddress",
- bou.mobile AS "clubMobile"
- </sql>
- <select id="get" resultType="newShouldPay">
- SELECT
- <include refid="shouldPayColumns"/>
- FROM cm_order co
- LEFT JOIN club c ON c.clubID = co.clubID
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderID
- WHERE co.orderID = #{orderId}
- </select>
-
- <select id="findList" resultType="newShouldPay">
- SELECT
- <include refid="shouldPayColumns"/>
- FROM cm_order co
- LEFT JOIN club c ON c.clubID = co.clubID
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderID
- <where>
-
- <if test="orderId != null and orderId != ''">
- AND co.orderID = #{orderId}
- </if>
- <if test="orderTypeSys != null and orderTypeSys != ''">
- AND co.orderType = #{orderTypeSys}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND co.orderNo LIKE concat('%',#{orderNo},'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name LIKE concat('%',#{clubName},'%')
- </if>
- <if test="startTime != null and startTime != ''">
- AND co.orderTime <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND co.orderTime <![CDATA[ <= ]]> #{endTime}
- </if>
- AND co.delFlag = 0
- AND co.status != 6
- AND (co.confirmFlag = 1 OR co.confirmFlag = 2)
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY co.orderID DESC,co.orderTime DESC
- </otherwise>
- </choose>
- </select>
- </mapper>
|