| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <?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.zhongzheng.modules.top.goods.mapper.TopOldOrderMapper">
- <resultMap type="com.zhongzheng.modules.top.goods.domain.TopOldOrder" id="TopOrderResult">
- <result property="orderId" column="order_id"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderPrice" column="order_price"/>
- <result property="orderGeneral" column="order_general"/>
- <result property="orderStatus" column="order_status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="payType" column="pay_type"/>
- <result property="transid" column="transid"/>
- <result property="cancelTime" column="cancel_time"/>
- <result property="finishTime" column="finish_time"/>
- <result property="orderType" column="order_type"/>
- <result property="payPrice" column="pay_price"/>
- <result property="orderFrom" column="order_from"/>
- <result property="createUsername" column="create_username"/>
- <result property="status" column="status"/>
- <result property="createSysUserId" column="create_sys_user_id"/>
- <result property="inputOrderSn" column="input_order_sn"/>
- <result property="payStatus" column="pay_status"/>
- <result property="checkStatus" column="check_status"/>
- <result property="refundStatus" column="refund_status"/>
- <result property="creditStatus" column="credit_status"/>
- <result property="invoiceStatus" column="invoice_status"/>
- <result property="orderProfit" column="order_profit"/>
- <result property="orderCost" column="order_cost"/>
- <result property="orderRefund" column="order_refund"/>
- <result property="orderRefunded" column="order_refunded"/>
- <result property="orderUncollected" column="order_uncollected"/>
- <result property="orderReceived" column="order_received"/>
- <result property="remark" column="remark"/>
- <result property="orderBusiness" column="order_business"/>
- <result property="costJson" column="cost_json"/>
- <result property="buyTime" column="buy_time"/>
- </resultMap>
- <select id="queryList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT
- vto.*
- FROM
- ( SELECT DISTINCT order_sn
- <if test="businessFullName != null and businessFullName != '' and (userCard == null or userCard == '')">
- FROM `v_top_order_business` where business_full_name = #{businessFullName}
- </if>
- <if test="userCard != null and userCard != '' and (businessFullName == null and businessFullName == '')">
- FROM `v_top_order_card` where user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </if>
- <if test="userCard != null and userCard != '' and businessFullName != null and businessFullName != ''">
- FROM (
- SELECT
- DISTINCT order_sn
- FROM
- ( SELECT order_sn FROM v_top_order_business WHERE business_full_name = #{businessFullName} UNION ALL SELECT order_sn FROM v_top_order_card
- WHERE user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}) b
- ) m
- </if>
- <if test="(userCard == null or userCard == '') and (businessFullName == null or businessFullName == '')">
- FROM (
- SELECT
- DISTINCT order_sn
- FROM
- ( SELECT order_sn FROM v_top_order_business UNION ALL SELECT order_sn FROM v_top_order_card) b
- ) m
- </if>
- ) a
- LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn
- WHERE vto.`status` = 1
- <if test="checkStatus != null and checkStatus != ''">
- AND vto.check_status = #{checkStatus}
- </if>
- <if test="refundStatusList != null and refundStatusList.size()!=0 ">
- AND vto.refund_status in
- <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="creditStatus != null and creditStatus != '' and creditStatus == 0">
- AND vto.order_received <![CDATA[ < ]]> vto.pay_price
- </if>
- <if test="creditStatus != null and creditStatus != '' and creditStatus == 1">
- AND vto.pay_price = vto.order_received
- </if>
- <if test="invoiceStatus != null and invoiceStatus != ''">
- AND vto.invoice_status = #{invoiceStatus}
- </if>
- <if test="startTime != null and startTime != ''">
- AND vto.create_time <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND vto.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="orderSn != null and orderSn != ''">
- AND vto.order_sn = #{orderSn}
- </if>
- <if test="orderSnList != null and orderSnList.size()!=0 ">
- AND vto.order_sn in
- <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- AND (
- vto.create_org LIKE CONCAT( '%', #{keyword}, '%' )
- -- OR vto.course_org LIKE CONCAT( '%', #{keyword}, '%' )
- OR vto.order_org LIKE CONCAT( '%', #{keyword}, '%' ))
- </if>
- </select>
- <!-- <select id="queryList_COUNT" resultType="Long">-->
- <!-- SELECT-->
- <!-- count(distinct vto.order_id )-->
- <!-- FROM-->
- <!-- ( SELECT DISTINCT order_sn-->
- <!-- <if test="businessFullName != null and businessFullName != '' and (userCard == null or userCard == '')">-->
- <!-- FROM `v_top_order_business` where business_full_name = #{businessFullName}-->
- <!-- </if>-->
- <!-- <if test="userCard != null and userCard != '' and (businessFullName == null and businessFullName == '')">-->
- <!-- FROM `v_top_order_card` where user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}-->
- <!-- </if>-->
- <!-- <if test="userCard != null and userCard != '' and businessFullName != null and businessFullName != ''">-->
- <!-- FROM (-->
- <!-- SELECT-->
- <!-- DISTINCT order_sn-->
- <!-- FROM-->
- <!-- ( SELECT order_sn FROM v_top_order_business WHERE business_full_name = #{businessFullName} UNION ALL SELECT order_sn FROM v_top_order_card-->
- <!-- WHERE user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}) b-->
- <!-- ) m-->
- <!-- </if>-->
- <!-- <if test="(userCard == null or userCard == '') and (businessFullName == null or businessFullName == '')">-->
- <!-- FROM (-->
- <!-- SELECT-->
- <!-- DISTINCT order_sn-->
- <!-- FROM-->
- <!-- ( SELECT order_sn FROM v_top_order_business UNION ALL SELECT order_sn FROM v_top_order_card) b-->
- <!-- ) m-->
- <!-- </if>-->
- <!-- ) a-->
- <!-- LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn-->
- <!-- WHERE vto.`status` = 1-->
- <!-- <if test="checkStatus != null and checkStatus != ''">-->
- <!-- AND vto.check_status = #{checkStatus}-->
- <!-- </if>-->
- <!-- <if test="refundStatusList != null and refundStatusList.size()!=0 ">-->
- <!-- AND vto.refund_status in-->
- <!-- <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">-->
- <!-- #{item}-->
- <!-- </foreach>-->
- <!-- </if>-->
- <!-- <if test="creditStatus != null and creditStatus != '' and creditStatus == 0">-->
- <!-- AND vto.order_received <![CDATA[ < ]]> vto.pay_price-->
- <!-- </if>-->
- <!-- <if test="creditStatus != null and creditStatus != '' and creditStatus == 1">-->
- <!-- AND vto.pay_price = vto.order_received-->
- <!-- </if>-->
- <!-- <if test="invoiceStatus != null and invoiceStatus != ''">-->
- <!-- AND vto.invoice_status = #{invoiceStatus}-->
- <!-- </if>-->
- <!-- <if test="startTime != null and startTime != ''">-->
- <!-- AND vto.create_time <![CDATA[ >= ]]> #{startTime}-->
- <!-- </if>-->
- <!-- <if test="endTime != null and endTime != ''">-->
- <!-- AND vto.create_time <![CDATA[ <= ]]> #{endTime}-->
- <!-- </if>-->
- <!-- <if test="keyword != null and keyword != ''">-->
- <!-- AND (-->
- <!-- vto.create_org LIKE CONCAT( '%', #{keyword}, '%' )-->
- <!-- OR vto.order_sn LIKE CONCAT( '%', #{keyword}, '%' )-->
- <!-- OR vto.create_no LIKE CONCAT( '%', #{keyword}, '%' )-->
- <!-- OR vto.order_org LIKE CONCAT( '%', #{keyword}, '%' ))-->
- <!-- </if>-->
- <!-- </select>-->
- <select id="queryById" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT * FROM v_top_order WHERE order_sn = #{orderSn}
- </select>
- <select id="queryBusinessBySn" parameterType="java.lang.String" resultType="java.lang.String">
- SELECT business_name FROM v_top_order_business WHERE order_sn = #{orderSn}
- </select>
- <select id="queryByOrderSns" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT * FROM v_top_order WHERE 1 =1
- <if test="orderSnList != null and orderSnList.size()!=0 ">
- AND order_sn in
- <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="queryReceiveList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT
- too.*,
- st.tenant_name,
- rn.id as note_id,
- rn.note_type,
- rn.day_time,
- rn.week_time,
- rn.month_time,
- rn.last_time
- FROM
- top_old_order too
- LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
- LEFT JOIN top_order_rec_note rn ON too.tenant_id = rn.tenant_id and too.order_sn = rn.order_sn
- where 1=1
- <if test="startTime != null and startTime != ''">
- AND too.create_time <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND too.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="keyNo != null and keyNo != ''">
- AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
- </if>
- <if test="creditStatus != null and creditStatus != ''">
- AND too.credit_status = #{creditStatus}
- </if>
- ORDER BY too.order_id DESC
- </select>
- <select id="queryDivSellerList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT
- too.*,
- st.tenant_name,
- r.role_name,
- cl.check_status as divide_check_status
- FROM
- v_top_order too
- LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
- LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
- AND cl.check_sign = 1
- AND ( too.divide_model + 1 ) = cl.check_from
- LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
- where 1=1 AND too.divide_model = 2
- <if test="startTime != null and startTime != ''">
- AND too.create_time <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND too.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="keyNo != null and keyNo != ''">
- AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
- </if>
- <if test="divideStatusList != null and divideStatusList.size()!=0 ">
- AND too.divide_status in
- <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="divideStatus != null and divideStatus != ''">
- AND too.divide_status = #{divideStatus}
- </if>
- <if test="roleId != null and roleId != ''">
- AND cl.role_id = #{roleId}
- </if>
- ORDER BY too.order_id DESC
- </select>
- <select id="queryTenantList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT
- too.*,
- st.tenant_name,
- r.role_name,
- cl.check_status as divide_check_status
- FROM
- top_old_order too
- LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
- LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
- AND cl.check_sign = 1
- AND ( too.divide_model + 1 ) = cl.check_from
- LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
- where 1=1 AND too.divide_model = 1
- <if test="startTime != null and startTime != ''">
- AND too.create_time <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND too.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="keyNo != null and keyNo != ''">
- AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
- </if>
- <if test="divideStatusList != null and divideStatusList.size()!=0 ">
- AND too.divide_status in
- <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="divideStatus != null and divideStatus != ''">
- AND too.divide_status = #{divideStatus}
- </if>
- <if test="tenantId != null and tenantId != ''">
- AND too.tenant_id = #{tenantId}
- </if>
- <if test="roleId != null and roleId != ''">
- AND cl.role_id = #{roleId}
- </if>
- ORDER BY too.order_id DESC
- </select>
- <select id="tenantMoneyTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
- SELECT
- IFNULL( SUM( too.divide_company_money ), 0 )
- FROM
- v_top_order too
- WHERE
- too.divide_model = 1
- AND too.divide_status = 5
- </select>
- <select id="tenantSellerTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
- SELECT
- IFNULL( SUM( too.divide_seller_money ), 0 )
- FROM
- v_top_order too
- WHERE
- too.divide_model = 2
- AND too.divide_status = 5
- </select>
- <select id="queryListAll" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
- SELECT * FROM v_top_order
- </select>
- <select id="getOrderBySn" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.domain.TopOldOrder">
- SELECT * FROM v_top_order WHERE order_sn = #{orderSn}
- </select>
- <select id="logList" parameterType="com.zhongzheng.modules.top.financial.bo.TopOrderLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopOrderLogVo">
- SELECT * FROM top_order_log WHERE order_sn = #{orderSn}
- </select>
- </mapper>
|