|
@@ -1,7 +1,7 @@
|
|
|
<?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">
|
|
|
+ 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">
|
|
@@ -41,49 +41,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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 id="queryList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo"
|
|
|
+ resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
SELECT
|
|
|
- vto.*
|
|
|
+ vto.*
|
|
|
FROM
|
|
|
- ( SELECT DISTINCT order_sn
|
|
|
- <if test="businessFullName != null and businessFullName != '' and ((userCard == null or userCard == '') and (userName == null or userName == ''))">
|
|
|
- FROM `v_top_order_business` where INSTR( business_full_name,#{businessFullName} ) > 0
|
|
|
- </if>
|
|
|
- <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and (businessFullName == null or businessFullName == '')">
|
|
|
- FROM `v_top_order_card` where 1=1
|
|
|
- <if test="userCard != null and userCard != ''">
|
|
|
- AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
- </if>
|
|
|
- <if test="userName != null and userName != ''">
|
|
|
- AND user_name LIKE CONCAT( '%', #{userName}, '%' )
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and businessFullName != null and businessFullName != ''">
|
|
|
- FROM (
|
|
|
- SELECT
|
|
|
- DISTINCT order_sn
|
|
|
- FROM
|
|
|
- ( SELECT order_sn FROM v_top_order_business WHERE INSTR( business_full_name,#{businessFullName} ) > 0 UNION ALL SELECT order_sn FROM v_top_order_card
|
|
|
- WHERE 1 = 1
|
|
|
- <if test="userCard != null and userCard != ''">
|
|
|
- AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
- </if>
|
|
|
- <if test="userName != null and userName != ''">
|
|
|
- AND user_name LIKE CONCAT( '%', #{userName}, '%' )
|
|
|
- </if>
|
|
|
- ) b
|
|
|
- ) m
|
|
|
- </if>
|
|
|
- <if test="(userCard == null or userCard == '') and (businessFullName == null or businessFullName == '') and (userName == null or userName == '')">
|
|
|
- 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
|
|
|
+ <if test="businessFullName != null and businessFullName != '' and ((userCard == null or userCard == '') and (userName == null or userName == ''))">
|
|
|
+ ( SELECT DISTINCT order_sn
|
|
|
+ FROM `v_top_order_business` where INSTR( business_full_name,#{businessFullName} ) > 0
|
|
|
+ ) a
|
|
|
+ LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn
|
|
|
+ </if>
|
|
|
+ <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and (businessFullName == null or businessFullName == '')">
|
|
|
+ ( SELECT DISTINCT order_sn
|
|
|
+ FROM `v_top_order_card` where 1=1
|
|
|
+ <if test="userCard != null and userCard != ''">
|
|
|
+ AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ AND user_name LIKE CONCAT( '%', #{userName}, '%' )
|
|
|
+ </if>
|
|
|
+ ) a
|
|
|
+ LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn
|
|
|
+ </if>
|
|
|
+ <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and businessFullName != null and businessFullName != ''">
|
|
|
+ ( SELECT DISTINCT order_sn
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ DISTINCT order_sn
|
|
|
+ FROM
|
|
|
+ ( SELECT order_sn FROM v_top_order_business WHERE INSTR( business_full_name,#{businessFullName} ) > 0 UNION
|
|
|
+ ALL SELECT order_sn FROM v_top_order_card
|
|
|
+ WHERE 1 = 1
|
|
|
+ <if test="userCard != null and userCard != ''">
|
|
|
+ AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ AND user_name LIKE CONCAT( '%', #{userName}, '%' )
|
|
|
+ </if>
|
|
|
+ ) b
|
|
|
+ ) m
|
|
|
+ ) a
|
|
|
+ LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn
|
|
|
+ </if>
|
|
|
+ <if test="(userCard == null or userCard == '') and (businessFullName == null or businessFullName == '') and (userName == null or userName == '')">
|
|
|
+ v_top_order vto
|
|
|
+ </if>
|
|
|
WHERE vto.`status` in (0,1)
|
|
|
<if test="operationType != null">
|
|
|
AND vto.operation_type = #{operationType}
|
|
@@ -233,14 +236,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
OR ot.create_no LIKE CONCAT( '%', #{keyword}, '%' )
|
|
|
OR ot.purchase_org LIKE CONCAT( '%', #{keyword}, '%' ))
|
|
|
</if>
|
|
|
- ) + (SELECT
|
|
|
+ ) + (SELECT
|
|
|
COUNT( DISTINCT o.order_sn ) AS num
|
|
|
FROM
|
|
|
`order` o
|
|
|
LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
LEFT JOIN `user` u ON o.user_id = u.user_id
|
|
|
WHERE
|
|
|
- 1 = 1 AND o.`status` IN (0,1)
|
|
|
+ 1 = 1 AND o.`status` IN (0,1)
|
|
|
AND ( `o`.`order_type` != 4 )
|
|
|
AND (
|
|
|
isnull( `o`.`input_order_sn` )
|
|
@@ -250,7 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="businessFullName != null and businessFullName != ''">
|
|
|
AND (
|
|
|
SELECT
|
|
|
- COUNT(g.goods_id)
|
|
|
+ COUNT(g.goods_id)
|
|
|
FROM
|
|
|
goods g
|
|
|
LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
@@ -258,7 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN course_business cb ON g.business_id = cb.id
|
|
|
WHERE
|
|
|
og.goods_id = g.goods_id
|
|
|
- AND
|
|
|
+ AND
|
|
|
INSTR( CONCAT('学校业务', cet.education_name, cb.business_name, cpt.project_name),#{businessFullName}) > 0) > 0
|
|
|
</if>
|
|
|
<if test="userCard != null and userCard != ''">
|
|
@@ -330,29 +333,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
AND o.order_sn LIKE CONCAT( '%', #{keyword}, '%' )
|
|
|
</if>
|
|
|
- )) as number
|
|
|
+ )) as number
|
|
|
</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 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 DISTINCT business_name FROM v_top_order_business WHERE order_sn = #{orderSn}
|
|
|
+ SELECT DISTINCT business_name
|
|
|
+ FROM v_top_order_business
|
|
|
+ WHERE order_sn = #{orderSn}
|
|
|
</select>
|
|
|
|
|
|
<select id="queryBusinessFullNameBySn" parameterType="java.lang.String" resultType="java.lang.String">
|
|
|
- SELECT
|
|
|
- DISTINCT business_full_name
|
|
|
- FROM
|
|
|
- top_old_order_goods
|
|
|
- WHERE
|
|
|
- order_sn = #{orderSn}
|
|
|
+ SELECT DISTINCT business_full_name
|
|
|
+ FROM top_old_order_goods
|
|
|
+ WHERE order_sn = #{orderSn}
|
|
|
AND `status` = 1
|
|
|
AND check_status = 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryByOrderSns" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
+ <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
|
|
@@ -362,7 +368,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryReceiveUnSum" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="long">
|
|
|
+ <select id="queryReceiveUnSum" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo"
|
|
|
+ resultType="long">
|
|
|
SELECT
|
|
|
IFNULL(sum(
|
|
|
too.order_uncollected),0)
|
|
@@ -404,21 +411,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ORDER BY too.buy_time DESC
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryReceiveList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
+ <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,
|
|
|
- rn.exceed_type
|
|
|
+ too.*,
|
|
|
+ st.tenant_name,
|
|
|
+ rn.id as note_id,
|
|
|
+ rn.note_type,
|
|
|
+ rn.day_time,
|
|
|
+ rn.week_time,
|
|
|
+ rn.month_time,
|
|
|
+ rn.last_time,
|
|
|
+ rn.exceed_type
|
|
|
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
|
|
|
+ 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 too.check_status=1 AND too.order_uncollected >0
|
|
|
<if test="tenantId != null and tenantId != ''">
|
|
|
AND too.tenant_id = #{tenantId}
|
|
@@ -441,7 +449,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="badBill != null and badBill == 1 and badBillList != null and badBillList.size()!=0 ">
|
|
|
AND
|
|
|
<foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
|
|
|
- (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
|
|
|
+ (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="badBill != null and badBill == 2 and badBillList != null and badBillList.size()!=0 ">
|
|
@@ -454,7 +462,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="queryDivSellerList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
+ <select id="queryDivSellerList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo"
|
|
|
+ resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
SELECT
|
|
|
too.*,
|
|
|
st.tenant_name,
|
|
@@ -492,7 +501,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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 id="queryTenantList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo"
|
|
|
+ resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
|
|
|
SELECT
|
|
|
too.*,
|
|
|
st.tenant_name,
|
|
@@ -533,42 +543,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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
|
|
|
+ <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
|
|
|
+ <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 *
|
|
|
+ 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 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 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>
|
|
|
|
|
|
- <select id="getRefundOrder" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
|
|
|
- SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn}
|
|
|
+ <select id="getRefundOrder" parameterType="java.lang.String"
|
|
|
+ resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
|
|
|
+ SELECT *
|
|
|
+ FROM v_top_order_refund
|
|
|
+ WHERE order_sn = #{orderSn}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getRefundOrderByBo" parameterType="com.zhongzheng.modules.top.financial.bo.RefundOrderBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
|
|
|
+ <select id="getRefundOrderByBo" parameterType="com.zhongzheng.modules.top.financial.bo.RefundOrderBo"
|
|
|
+ resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
|
|
|
SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn} AND status = 1
|
|
|
<if test="periodStatus != null and periodStatus != ''">
|
|
|
AND period_status = #{periodStatus}
|
|
@@ -576,7 +593,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="getOrderSnByBusiness" parameterType="java.lang.String" resultType="java.lang.String">
|
|
|
- SELECT DISTINCT order_sn FROM v_top_order_business WHERE INSTR(business_full_name,#{businessName}) > 0
|
|
|
+ SELECT DISTINCT order_sn
|
|
|
+ FROM v_top_order_business
|
|
|
+ WHERE INSTR(business_full_name, #{businessName}) > 0
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|