TopOldOrderMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.top.goods.mapper.TopOldOrderMapper">
  6. <resultMap type="com.zhongzheng.modules.top.goods.domain.TopOldOrder" id="TopOrderResult">
  7. <result property="orderId" column="order_id"/>
  8. <result property="orderSn" column="order_sn"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="orderPrice" column="order_price"/>
  11. <result property="orderGeneral" column="order_general"/>
  12. <result property="orderStatus" column="order_status"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="payTime" column="pay_time"/>
  16. <result property="payType" column="pay_type"/>
  17. <result property="transid" column="transid"/>
  18. <result property="cancelTime" column="cancel_time"/>
  19. <result property="finishTime" column="finish_time"/>
  20. <result property="orderType" column="order_type"/>
  21. <result property="payPrice" column="pay_price"/>
  22. <result property="orderFrom" column="order_from"/>
  23. <result property="createUsername" column="create_username"/>
  24. <result property="status" column="status"/>
  25. <result property="createSysUserId" column="create_sys_user_id"/>
  26. <result property="inputOrderSn" column="input_order_sn"/>
  27. <result property="payStatus" column="pay_status"/>
  28. <result property="checkStatus" column="check_status"/>
  29. <result property="refundStatus" column="refund_status"/>
  30. <result property="creditStatus" column="credit_status"/>
  31. <result property="invoiceStatus" column="invoice_status"/>
  32. <result property="orderProfit" column="order_profit"/>
  33. <result property="orderCost" column="order_cost"/>
  34. <result property="orderRefund" column="order_refund"/>
  35. <result property="orderRefunded" column="order_refunded"/>
  36. <result property="orderUncollected" column="order_uncollected"/>
  37. <result property="orderReceived" column="order_received"/>
  38. <result property="remark" column="remark"/>
  39. <result property="costJson" column="cost_json"/>
  40. <result property="buyTime" column="buy_time"/>
  41. </resultMap>
  42. <select id="queryList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  43. SELECT
  44. vto.*
  45. FROM
  46. ( SELECT DISTINCT order_sn
  47. <if test="businessFullName != null and businessFullName != '' and ((userCard == null or userCard == '') and (userName == null or userName == ''))">
  48. FROM `v_top_order_business` where INSTR( business_full_name,#{businessFullName} ) > 0
  49. </if>
  50. <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and (businessFullName == null or businessFullName == '')">
  51. FROM `v_top_order_card` where 1=1
  52. <if test="userCard != null and userCard != ''">
  53. AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  54. </if>
  55. <if test="userName != null and userName != ''">
  56. AND user_name LIKE CONCAT( '%', #{userName}, '%' )
  57. </if>
  58. </if>
  59. <if test="((userCard != null and userCard != '') or (userName != null and userName != '')) and businessFullName != null and businessFullName != ''">
  60. FROM (
  61. SELECT
  62. DISTINCT order_sn
  63. FROM
  64. ( 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
  65. WHERE 1 = 1
  66. <if test="userCard != null and userCard != ''">
  67. AND user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  68. </if>
  69. <if test="userName != null and userName != ''">
  70. AND user_name LIKE CONCAT( '%', #{userName}, '%' )
  71. </if>
  72. ) b
  73. ) m
  74. </if>
  75. <if test="(userCard == null or userCard == '') and (businessFullName == null or businessFullName == '') and (userName == null or userName == '')">
  76. FROM (
  77. SELECT
  78. DISTINCT order_sn
  79. FROM
  80. ( SELECT order_sn FROM v_top_order_business UNION ALL SELECT order_sn FROM v_top_order_card) b
  81. ) m
  82. </if>
  83. ) a
  84. LEFT JOIN v_top_order vto ON a.order_sn = vto.order_sn
  85. WHERE vto.`status` in (0,1)
  86. <if test="checkStatus != null">
  87. AND vto.check_status = #{checkStatus}
  88. </if>
  89. <if test="refundStatus != null">
  90. AND vto.refund_status = #{refundStatus}
  91. </if>
  92. <if test="refundStatusList != null and refundStatusList.size()!=0 ">
  93. AND vto.refund_status in
  94. <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
  95. #{item}
  96. </foreach>
  97. </if>
  98. <if test="creditStatus != null and creditStatus == 0">
  99. AND vto.order_received <![CDATA[ < ]]> vto.pay_price
  100. </if>
  101. <if test="creditStatus != null and creditStatus == 1">
  102. AND vto.pay_price = vto.order_received
  103. </if>
  104. <if test="finishStatus != null">
  105. AND vto.finish_status = #{finishStatus}
  106. </if>
  107. <if test="invoiceStatus != null and invoiceStatus != ''">
  108. AND vto.invoice_status = #{invoiceStatus}
  109. </if>
  110. <if test="orderOrg != null and orderOrg != ''">
  111. AND vto.order_org LIKE CONCAT( '%', #{orderOrg}, '%' )
  112. </if>
  113. <if test="startTime != null and startTime != ''">
  114. AND vto.buy_time <![CDATA[ >= ]]> #{startTime}
  115. </if>
  116. <if test="endTime != null and endTime != ''">
  117. AND vto.buy_time <![CDATA[ <= ]]> #{endTime}
  118. </if>
  119. <if test="checkStartTime != null and checkStartTime != ''">
  120. AND vto.check_time <![CDATA[ >= ]]> #{checkStartTime}
  121. </if>
  122. <if test="checkEndTime != null and checkEndTime != ''">
  123. AND vto.check_time <![CDATA[ <= ]]> #{checkEndTime}
  124. </if>
  125. <if test="orderSn != null and orderSn != ''">
  126. AND vto.order_sn = #{orderSn}
  127. </if>
  128. <if test="tenantId != null and tenantId != ''">
  129. AND vto.tenant_id = #{tenantId}
  130. </if>
  131. <if test="orderSnList != null and orderSnList.size()!=0 ">
  132. AND vto.order_sn in
  133. <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
  134. #{item}
  135. </foreach>
  136. </if>
  137. <if test="keyword != null and keyword != ''">
  138. AND (
  139. vto.order_sn LIKE CONCAT( '%', #{keyword}, '%' )
  140. OR vto.create_no LIKE CONCAT( '%', #{keyword}, '%' )
  141. OR vto.purchase_org LIKE CONCAT( '%', #{keyword}, '%' ))
  142. </if>
  143. order by vto.create_time DESC
  144. </select>
  145. <select id="queryList_COUNT" resultType="Long">
  146. SELECT
  147. ((SELECT
  148. COUNT( DISTINCT ot.order_sn ) AS num
  149. FROM
  150. top_old_order ot
  151. LEFT JOIN top_old_order_goods otg ON ot.order_sn = otg.order_sn
  152. WHERE
  153. 1 = 1 AND ot.`status` = 1
  154. <if test="businessFullName != null and businessFullName != ''">
  155. AND INSTR( otg.business_full_name , #{businessFullName} ) > 0
  156. </if>
  157. <if test="userCard != null and userCard != ''">
  158. AND otg.user_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  159. </if>
  160. <if test="userName != null and userName != ''">
  161. AND otg.user_name LIKE CONCAT( '%', #{userName}, '%' )
  162. </if>
  163. <if test="checkStatus != null">
  164. AND ot.check_status = #{checkStatus}
  165. </if>
  166. <if test="refundStatus != null">
  167. AND ot.refund_status = #{refundStatus}
  168. </if>
  169. <if test="refundStatusList != null and refundStatusList.size()!=0 ">
  170. AND ot.refund_status in
  171. <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
  172. #{item}
  173. </foreach>
  174. </if>
  175. <if test="orderOrg != null and orderOrg != ''">
  176. AND ot.order_org LIKE CONCAT( '%', #{orderOrg}, '%' )
  177. </if>
  178. <if test="checkStartTime != null and checkStartTime != ''">
  179. AND ot.check_time <![CDATA[ >= ]]> #{checkStartTime}
  180. </if>
  181. <if test="checkEndTime != null and checkEndTime != ''">
  182. AND ot.check_time <![CDATA[ <= ]]> #{checkEndTime}
  183. </if>
  184. <if test="creditStatus != null and creditStatus != '' and creditStatus == 0">
  185. AND ot.order_received <![CDATA[ < ]]> ot.pay_price
  186. </if>
  187. <if test="creditStatus != null and creditStatus != '' and creditStatus == 1">
  188. AND ot.pay_price = ot.order_received
  189. </if>
  190. <if test="invoiceStatus != null and invoiceStatus != ''">
  191. AND ot.invoice_status = #{invoiceStatus}
  192. </if>
  193. <if test="startTime != null and startTime != ''">
  194. AND ot.create_time <![CDATA[ >= ]]> #{startTime}
  195. </if>
  196. <if test="endTime != null and endTime != ''">
  197. AND ot.create_time <![CDATA[ <= ]]> #{endTime}
  198. </if>
  199. <if test="orderSn != null and orderSn != ''">
  200. AND ot.order_sn = #{orderSn}
  201. </if>
  202. <if test="finishStatus != null">
  203. AND ot.finish_status = #{finishStatus}
  204. </if>
  205. <if test="tenantId != null and tenantId != ''">
  206. AND ot.tenant_id = #{tenantId}
  207. </if>
  208. <if test="orderSnList != null and orderSnList.size()!=0 ">
  209. AND ot.order_sn in
  210. <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
  211. #{item}
  212. </foreach>
  213. </if>
  214. <if test="keyword != null and keyword != ''">
  215. AND (
  216. ot.order_sn LIKE CONCAT( '%', #{keyword}, '%' )
  217. OR ot.create_no LIKE CONCAT( '%', #{keyword}, '%' )
  218. OR ot.purchase_org LIKE CONCAT( '%', #{keyword}, '%' ))
  219. </if>
  220. ) + (SELECT
  221. COUNT( DISTINCT o.order_sn ) AS num
  222. FROM
  223. `order` o
  224. LEFT JOIN order_goods og ON o.order_sn = og.order_sn
  225. LEFT JOIN `user` u ON o.user_id = u.user_id
  226. WHERE
  227. 1 = 1 AND o.`status` IN (0,1)
  228. AND (
  229. isnull( `o`.`input_order_sn` )
  230. OR (
  231. NOT (
  232. `o`.`input_order_sn` IN ( SELECT `top_old_order`.`input_order_sn` FROM `top_old_order` ))))
  233. <if test="businessFullName != null and businessFullName != ''">
  234. AND (
  235. SELECT
  236. COUNT(g.goods_id)
  237. FROM
  238. goods g
  239. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  240. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  241. LEFT JOIN course_business cb ON g.business_id = cb.id
  242. WHERE
  243. og.goods_id = g.goods_id
  244. AND
  245. INSTR( CONCAT('学校业务', cet.education_name, cb.business_name, cpt.project_name),#{businessFullName}) > 0) > 0
  246. </if>
  247. <if test="userCard != null and userCard != ''">
  248. AND o.user_id = (SELECT user_id FROM `user` WHERE id_card = #{userCard,typeHandler=com.zhongzheng.common.type.EncryptHandler})
  249. </if>
  250. <if test="userName != null and userName != ''">
  251. AND u.realname LIKE CONCAT( '%', #{userName}, '%' )
  252. </if>
  253. <if test="checkStatus != null">
  254. AND o.check_status = #{checkStatus}
  255. </if>
  256. <if test="refundStatus != null">
  257. AND o.order_refund_status = #{refundStatus}
  258. </if>
  259. <if test="refundStatusList != null and refundStatusList.size()!=0 ">
  260. AND o.order_refund_status in
  261. <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">
  262. #{item}
  263. </foreach>
  264. </if>
  265. <if test="orderOrg != null and orderOrg != ''">
  266. AND 'C端云学堂' LIKE CONCAT( '%', #{orderOrg}, '%' )
  267. </if>
  268. <if test="checkStartTime != null and checkStartTime != ''">
  269. AND o.pay_time <![CDATA[ >= ]]> #{checkStartTime}
  270. </if>
  271. <if test="checkEndTime != null and checkEndTime != ''">
  272. AND o.pay_time <![CDATA[ <= ]]> #{checkEndTime}
  273. </if>
  274. <if test="creditStatus != null and creditStatus != '' and creditStatus == 0">
  275. AND o.order_received <![CDATA[ < ]]> o.pay_price
  276. </if>
  277. <if test="creditStatus != null and creditStatus != '' and creditStatus == 1">
  278. AND o.pay_price = o.order_received
  279. </if>
  280. <if test="invoiceStatus != null and invoiceStatus != ''">
  281. AND o.invoice_status = #{invoiceStatus}
  282. </if>
  283. <if test="finishStatus != null">
  284. AND o.finish_status = #{finishStatus}
  285. </if>
  286. <if test="tenantId != null and tenantId != ''">
  287. AND o.tenant_id = #{tenantId}
  288. </if>
  289. <if test="startTime != null and startTime != ''">
  290. AND o.create_time <![CDATA[ >= ]]> #{startTime}
  291. </if>
  292. <if test="startTime == null">
  293. AND o.create_time <![CDATA[ > ]]> #{filtrationTime}
  294. </if>
  295. <if test="endTime != null and endTime != ''">
  296. AND o.create_time <![CDATA[ <= ]]> #{endTime}
  297. </if>
  298. <if test="orderSn != null and orderSn != ''">
  299. AND o.order_sn = #{orderSn}
  300. </if>
  301. <if test="orderSnList != null and orderSnList.size()!=0 ">
  302. AND o.order_sn in
  303. <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
  304. #{item}
  305. </foreach>
  306. </if>
  307. <if test="keyword != null and keyword != ''">
  308. AND o.order_sn LIKE CONCAT( '%', #{keyword}, '%' )
  309. </if>
  310. )) as number
  311. </select>
  312. <select id="queryById" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  313. SELECT * FROM v_top_order WHERE order_sn = #{orderSn}
  314. </select>
  315. <select id="queryBusinessBySn" parameterType="java.lang.String" resultType="java.lang.String">
  316. SELECT DISTINCT business_name FROM v_top_order_business WHERE order_sn = #{orderSn}
  317. </select>
  318. <select id="queryByOrderSns" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  319. SELECT * FROM v_top_order WHERE 1 =1
  320. <if test="orderSnList != null and orderSnList.size()!=0 ">
  321. AND order_sn in
  322. <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
  323. #{item}
  324. </foreach>
  325. </if>
  326. </select>
  327. <select id="queryReceiveUnSum" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="long">
  328. SELECT
  329. IFNULL(sum(
  330. too.order_uncollected),0)
  331. FROM
  332. top_old_order too
  333. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  334. LEFT JOIN top_order_rec_note rn ON too.tenant_id = rn.tenant_id and too.order_sn = rn.order_sn
  335. where too.check_status=1 AND too.order_uncollected >0
  336. <if test="tenantId != null and tenantId != ''">
  337. AND too.tenant_id = #{tenantId}
  338. </if>
  339. <if test="startTime != null and startTime != ''">
  340. AND too.buy_time <![CDATA[ >= ]]> #{startTime}
  341. </if>
  342. <if test="endTime != null and endTime != ''">
  343. AND too.buy_time <![CDATA[ <= ]]> #{endTime}
  344. </if>
  345. <if test="keyNo != null and keyNo != ''">
  346. AND (st.tenant_name like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  347. </if>
  348. <if test="creditStatus != null and creditStatus != ''">
  349. AND too.credit_status = #{creditStatus}
  350. </if>
  351. <if test="orderSn != null and orderSn != ''">
  352. AND too.order_sn = #{orderSn}
  353. </if>
  354. <if test="badBill != null and badBill == 1 and badBillList != null and badBillList.size()!=0 ">
  355. AND
  356. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  357. (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
  358. </foreach>
  359. </if>
  360. <if test="badBill != null and badBill == 2 and badBillList != null and badBillList.size()!=0 ">
  361. AND
  362. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  363. (too.check_time NOT BETWEEN #{item.startTime} and #{item.endTime})
  364. </foreach>
  365. </if>
  366. ORDER BY too.buy_time DESC
  367. </select>
  368. <select id="queryReceiveList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  369. SELECT
  370. too.*,
  371. st.tenant_name,
  372. rn.id as note_id,
  373. rn.note_type,
  374. rn.day_time,
  375. rn.week_time,
  376. rn.month_time,
  377. rn.last_time
  378. FROM
  379. top_old_order too
  380. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  381. LEFT JOIN top_order_rec_note rn ON too.tenant_id = rn.tenant_id and too.order_sn = rn.order_sn
  382. where too.check_status=1 AND too.order_uncollected >0
  383. <if test="tenantId != null and tenantId != ''">
  384. AND too.tenant_id = #{tenantId}
  385. </if>
  386. <if test="startTime != null and startTime != ''">
  387. AND too.buy_time <![CDATA[ >= ]]> #{startTime}
  388. </if>
  389. <if test="endTime != null and endTime != ''">
  390. AND too.buy_time <![CDATA[ <= ]]> #{endTime}
  391. </if>
  392. <if test="keyNo != null and keyNo != ''">
  393. AND (st.tenant_name like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  394. </if>
  395. <if test="creditStatus != null and creditStatus != ''">
  396. AND too.credit_status = #{creditStatus}
  397. </if>
  398. <if test="orderSn != null and orderSn != ''">
  399. AND too.order_sn = #{orderSn}
  400. </if>
  401. <if test="badBill != null and badBill == 1 and badBillList != null and badBillList.size()!=0 ">
  402. AND
  403. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  404. (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
  405. </foreach>
  406. </if>
  407. <if test="badBill != null and badBill == 2 and badBillList != null and badBillList.size()!=0 ">
  408. AND
  409. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  410. (too.check_time NOT BETWEEN #{item.startTime} and #{item.endTime})
  411. </foreach>
  412. </if>
  413. ORDER BY too.buy_time DESC
  414. </select>
  415. <select id="queryDivSellerList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  416. SELECT
  417. too.*,
  418. st.tenant_name,
  419. r.role_name,
  420. cl.check_status as divide_check_status
  421. FROM
  422. v_top_order too
  423. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  424. LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
  425. AND cl.check_sign = 1
  426. AND ( too.divide_model + 1 ) = cl.check_from
  427. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  428. where 1=1 AND too.divide_model = 2
  429. <if test="startTime != null and startTime != ''">
  430. AND too.create_time <![CDATA[ >= ]]> #{startTime}
  431. </if>
  432. <if test="endTime != null and endTime != ''">
  433. AND too.create_time <![CDATA[ <= ]]> #{endTime}
  434. </if>
  435. <if test="keyNo != null and keyNo != ''">
  436. AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  437. </if>
  438. <if test="divideStatusList != null and divideStatusList.size()!=0 ">
  439. AND too.divide_status in
  440. <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
  441. #{item}
  442. </foreach>
  443. </if>
  444. <if test="divideStatus != null and divideStatus != ''">
  445. AND too.divide_status = #{divideStatus}
  446. </if>
  447. <if test="roleId != null and roleId != ''">
  448. AND cl.role_id = #{roleId}
  449. </if>
  450. ORDER BY too.order_id DESC
  451. </select>
  452. <select id="queryTenantList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  453. SELECT
  454. too.*,
  455. st.tenant_name,
  456. r.role_name,
  457. cl.check_status as divide_check_status
  458. FROM
  459. top_old_order too
  460. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  461. LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
  462. AND cl.check_sign = 1
  463. AND ( too.divide_model + 1 ) = cl.check_from
  464. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  465. where 1=1 AND too.divide_model = 1
  466. <if test="startTime != null and startTime != ''">
  467. AND too.create_time <![CDATA[ >= ]]> #{startTime}
  468. </if>
  469. <if test="endTime != null and endTime != ''">
  470. AND too.create_time <![CDATA[ <= ]]> #{endTime}
  471. </if>
  472. <if test="keyNo != null and keyNo != ''">
  473. AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  474. </if>
  475. <if test="divideStatusList != null and divideStatusList.size()!=0 ">
  476. AND too.divide_status in
  477. <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
  478. #{item}
  479. </foreach>
  480. </if>
  481. <if test="divideStatus != null and divideStatus != ''">
  482. AND too.divide_status = #{divideStatus}
  483. </if>
  484. <if test="tenantId != null and tenantId != ''">
  485. AND too.tenant_id = #{tenantId}
  486. </if>
  487. <if test="roleId != null and roleId != ''">
  488. AND cl.role_id = #{roleId}
  489. </if>
  490. ORDER BY too.order_id DESC
  491. </select>
  492. <select id="tenantMoneyTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
  493. SELECT
  494. IFNULL( SUM( too.divide_company_money ), 0 )
  495. FROM
  496. v_top_order too
  497. WHERE
  498. too.divide_model = 1
  499. AND too.divide_status = 5
  500. </select>
  501. <select id="tenantSellerTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
  502. SELECT
  503. IFNULL( SUM( too.divide_seller_money ), 0 )
  504. FROM
  505. v_top_order too
  506. WHERE
  507. too.divide_model = 2
  508. AND too.divide_status = 5
  509. </select>
  510. <select id="queryListAll" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  511. SELECT * FROM v_top_order
  512. </select>
  513. <select id="getOrderBySn" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.domain.TopOldOrder">
  514. SELECT * FROM v_top_order WHERE order_sn = #{orderSn}
  515. </select>
  516. <select id="logList" parameterType="com.zhongzheng.modules.top.financial.bo.TopOrderLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopOrderLogVo">
  517. SELECT * FROM top_order_log WHERE order_sn = #{orderSn}
  518. </select>
  519. <select id="getRefundOrder" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
  520. SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn}
  521. </select>
  522. <select id="getRefundOrderByBo" parameterType="com.zhongzheng.modules.top.financial.bo.RefundOrderBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
  523. SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn} AND status = 1
  524. <if test="periodStatus != null and periodStatus != ''">
  525. AND period_status = #{periodStatus}
  526. </if>
  527. </select>
  528. <select id="getOrderSnByBusiness" parameterType="java.lang.String" resultType="java.lang.Long">
  529. SELECT DISTINCT order_sn FROM v_top_order_business WHERE INSTR(business_full_name,#{businessName}) > 0
  530. </select>
  531. </mapper>