TopOldOrderMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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="queryBusinessFullNameBySn" parameterType="java.lang.String" resultType="java.lang.String">
  319. SELECT
  320. DISTINCT business_full_name
  321. FROM
  322. top_old_order_goods
  323. WHERE
  324. order_sn = #{orderSn}
  325. AND `status` = 1
  326. AND check_status = 1
  327. </select>
  328. <select id="queryByOrderSns" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  329. SELECT * FROM v_top_order WHERE 1 =1
  330. <if test="orderSnList != null and orderSnList.size()!=0 ">
  331. AND order_sn in
  332. <foreach collection="orderSnList" item="item" index="index" open="(" close=")" separator=",">
  333. #{item}
  334. </foreach>
  335. </if>
  336. </select>
  337. <select id="queryReceiveUnSum" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="long">
  338. SELECT
  339. IFNULL(sum(
  340. too.order_uncollected),0)
  341. FROM
  342. top_old_order too
  343. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  344. LEFT JOIN top_order_rec_note rn ON too.tenant_id = rn.tenant_id and too.order_sn = rn.order_sn
  345. where too.check_status=1 AND too.order_uncollected >0
  346. <if test="tenantId != null and tenantId != ''">
  347. AND too.tenant_id = #{tenantId}
  348. </if>
  349. <if test="startTime != null and startTime != ''">
  350. AND too.buy_time <![CDATA[ >= ]]> #{startTime}
  351. </if>
  352. <if test="endTime != null and endTime != ''">
  353. AND too.buy_time <![CDATA[ <= ]]> #{endTime}
  354. </if>
  355. <if test="keyNo != null and keyNo != ''">
  356. AND (st.tenant_name like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  357. </if>
  358. <if test="creditStatus != null and creditStatus != ''">
  359. AND too.credit_status = #{creditStatus}
  360. </if>
  361. <if test="orderSn != null and orderSn != ''">
  362. AND too.order_sn = #{orderSn}
  363. </if>
  364. <if test="badBill != null and badBill == 1 and badBillList != null and badBillList.size()!=0 ">
  365. AND
  366. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  367. (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
  368. </foreach>
  369. </if>
  370. <if test="badBill != null and badBill == 2 and badBillList != null and badBillList.size()!=0 ">
  371. AND
  372. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  373. (too.check_time NOT BETWEEN #{item.startTime} and #{item.endTime})
  374. </foreach>
  375. </if>
  376. ORDER BY too.buy_time DESC
  377. </select>
  378. <select id="queryReceiveList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  379. SELECT
  380. too.*,
  381. st.tenant_name,
  382. rn.id as note_id,
  383. rn.note_type,
  384. rn.day_time,
  385. rn.week_time,
  386. rn.month_time,
  387. rn.last_time
  388. FROM
  389. top_old_order too
  390. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  391. LEFT JOIN top_order_rec_note rn ON too.tenant_id = rn.tenant_id and too.order_sn = rn.order_sn
  392. where too.check_status=1 AND too.order_uncollected >0
  393. <if test="tenantId != null and tenantId != ''">
  394. AND too.tenant_id = #{tenantId}
  395. </if>
  396. <if test="startTime != null and startTime != ''">
  397. AND too.buy_time <![CDATA[ >= ]]> #{startTime}
  398. </if>
  399. <if test="endTime != null and endTime != ''">
  400. AND too.buy_time <![CDATA[ <= ]]> #{endTime}
  401. </if>
  402. <if test="keyNo != null and keyNo != ''">
  403. AND (st.tenant_name like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  404. </if>
  405. <if test="creditStatus != null and creditStatus != ''">
  406. AND too.credit_status = #{creditStatus}
  407. </if>
  408. <if test="orderSn != null and orderSn != ''">
  409. AND too.order_sn = #{orderSn}
  410. </if>
  411. <if test="badBill != null and badBill == 1 and badBillList != null and badBillList.size()!=0 ">
  412. AND
  413. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  414. (too.check_time BETWEEN #{item.startTime} and #{item.endTime})
  415. </foreach>
  416. </if>
  417. <if test="badBill != null and badBill == 2 and badBillList != null and badBillList.size()!=0 ">
  418. AND
  419. <foreach collection="badBillList" item="item" index="index" open="(" close=")" separator="or">
  420. (too.check_time NOT BETWEEN #{item.startTime} and #{item.endTime})
  421. </foreach>
  422. </if>
  423. ORDER BY too.buy_time DESC
  424. </select>
  425. <select id="queryDivSellerList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  426. SELECT
  427. too.*,
  428. st.tenant_name,
  429. r.role_name,
  430. cl.check_status as divide_check_status
  431. FROM
  432. v_top_order too
  433. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  434. LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
  435. AND cl.check_sign = 1
  436. AND ( too.divide_model + 1 ) = cl.check_from
  437. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  438. where 1=1 AND too.divide_model = 2
  439. <if test="startTime != null and startTime != ''">
  440. AND too.create_time <![CDATA[ >= ]]> #{startTime}
  441. </if>
  442. <if test="endTime != null and endTime != ''">
  443. AND too.create_time <![CDATA[ <= ]]> #{endTime}
  444. </if>
  445. <if test="keyNo != null and keyNo != ''">
  446. AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  447. </if>
  448. <if test="divideStatusList != null and divideStatusList.size()!=0 ">
  449. AND too.divide_status in
  450. <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
  451. #{item}
  452. </foreach>
  453. </if>
  454. <if test="divideStatus != null and divideStatus != ''">
  455. AND too.divide_status = #{divideStatus}
  456. </if>
  457. <if test="roleId != null and roleId != ''">
  458. AND cl.role_id = #{roleId}
  459. </if>
  460. ORDER BY too.order_id DESC
  461. </select>
  462. <select id="queryTenantList" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  463. SELECT
  464. too.*,
  465. st.tenant_name,
  466. r.role_name,
  467. cl.check_status as divide_check_status
  468. FROM
  469. top_old_order too
  470. LEFT JOIN sys_tenant st ON too.tenant_id = st.tenant_id
  471. LEFT JOIN top_old_order_check_log cl ON too.order_sn = cl.order_sn
  472. AND cl.check_sign = 1
  473. AND ( too.divide_model + 1 ) = cl.check_from
  474. LEFT JOIN top_sys_role r ON cl.role_id = r.role_id
  475. where 1=1 AND too.divide_model = 1
  476. <if test="startTime != null and startTime != ''">
  477. AND too.create_time <![CDATA[ >= ]]> #{startTime}
  478. </if>
  479. <if test="endTime != null and endTime != ''">
  480. AND too.create_time <![CDATA[ <= ]]> #{endTime}
  481. </if>
  482. <if test="keyNo != null and keyNo != ''">
  483. AND (too.tenant_id like concat('%', #{keyNo}, '%') or too.create_no like concat('%', #{keyNo}, '%'))
  484. </if>
  485. <if test="divideStatusList != null and divideStatusList.size()!=0 ">
  486. AND too.divide_status in
  487. <foreach collection="divideStatusList" item="item" index="index" open="(" close=")" separator=",">
  488. #{item}
  489. </foreach>
  490. </if>
  491. <if test="divideStatus != null and divideStatus != ''">
  492. AND too.divide_status = #{divideStatus}
  493. </if>
  494. <if test="tenantId != null and tenantId != ''">
  495. AND too.tenant_id = #{tenantId}
  496. </if>
  497. <if test="roleId != null and roleId != ''">
  498. AND cl.role_id = #{roleId}
  499. </if>
  500. ORDER BY too.order_id DESC
  501. </select>
  502. <select id="tenantMoneyTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
  503. SELECT
  504. IFNULL( SUM( too.divide_company_money ), 0 )
  505. FROM
  506. v_top_order too
  507. WHERE
  508. too.divide_model = 1
  509. AND too.divide_status = 5
  510. </select>
  511. <select id="tenantSellerTotal" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderQueryBo" resultType="BigDecimal">
  512. SELECT
  513. IFNULL( SUM( too.divide_seller_money ), 0 )
  514. FROM
  515. v_top_order too
  516. WHERE
  517. too.divide_model = 2
  518. AND too.divide_status = 5
  519. </select>
  520. <select id="queryListAll" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderVo">
  521. SELECT * FROM v_top_order
  522. </select>
  523. <select id="getOrderBySn" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.domain.TopOldOrder">
  524. SELECT * FROM v_top_order WHERE order_sn = #{orderSn}
  525. </select>
  526. <select id="logList" parameterType="com.zhongzheng.modules.top.financial.bo.TopOrderLogQueryBo" resultType="com.zhongzheng.modules.top.financial.vo.TopOrderLogVo">
  527. SELECT * FROM top_order_log WHERE order_sn = #{orderSn}
  528. </select>
  529. <select id="getRefundOrder" parameterType="java.lang.String" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
  530. SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn}
  531. </select>
  532. <select id="getRefundOrderByBo" parameterType="com.zhongzheng.modules.top.financial.bo.RefundOrderBo" resultType="com.zhongzheng.modules.top.goods.vo.TopOldOrderRefundVo">
  533. SELECT * FROM v_top_order_refund WHERE order_sn = #{orderSn} AND status = 1
  534. <if test="periodStatus != null and periodStatus != ''">
  535. AND period_status = #{periodStatus}
  536. </if>
  537. </select>
  538. <select id="getOrderSnByBusiness" parameterType="java.lang.String" resultType="java.lang.Long">
  539. SELECT DISTINCT order_sn FROM v_top_order_business WHERE INSTR(business_full_name,#{businessName}) > 0
  540. </select>
  541. </mapper>