| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?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 vto.check_staus = #{checkStaus}
- </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 business_name FROM v_top_order_business 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="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 top_old_order WHERE order_sn = #{orderSn}
- </select>
- </mapper>
|