JtOrderMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.goafanti.common.dao.JtOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtOrder">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  9. -->
  10. <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
  11. <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
  12. <result column="aid" jdbcType="VARCHAR" property="aid" />
  13. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="buyer_id" jdbcType="VARCHAR" property="buyerId" />
  15. <result column="seller_id" jdbcType="VARCHAR" property="sellerId" />
  16. <result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
  17. <result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
  18. <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
  19. <result column="pay_type" jdbcType="INTEGER" property="payType" />
  20. <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
  21. <result column="order_channel" jdbcType="INTEGER" property="orderChannel" />
  22. <result column="order_remarks" jdbcType="VARCHAR" property="orderRemarks" />
  23. <result column="delete_sign" jdbcType="INTEGER" property="deleteSign" />
  24. </resultMap>
  25. <sql id="Example_Where_Clause">
  26. <!--
  27. WARNING - @mbg.generated
  28. This element is automatically generated by MyBatis Generator, do not modify.
  29. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  30. -->
  31. <where>
  32. <foreach collection="oredCriteria" item="criteria" separator="or">
  33. <if test="criteria.valid">
  34. <trim prefix="(" prefixOverrides="and" suffix=")">
  35. <foreach collection="criteria.criteria" item="criterion">
  36. <choose>
  37. <when test="criterion.noValue">
  38. and ${criterion.condition}
  39. </when>
  40. <when test="criterion.singleValue">
  41. and ${criterion.condition} #{criterion.value}
  42. </when>
  43. <when test="criterion.betweenValue">
  44. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  45. </when>
  46. <when test="criterion.listValue">
  47. and ${criterion.condition}
  48. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  49. #{listItem}
  50. </foreach>
  51. </when>
  52. </choose>
  53. </foreach>
  54. </trim>
  55. </if>
  56. </foreach>
  57. </where>
  58. </sql>
  59. <sql id="Update_By_Example_Where_Clause">
  60. <!--
  61. WARNING - @mbg.generated
  62. This element is automatically generated by MyBatis Generator, do not modify.
  63. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  64. -->
  65. <where>
  66. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  67. <if test="criteria.valid">
  68. <trim prefix="(" prefixOverrides="and" suffix=")">
  69. <foreach collection="criteria.criteria" item="criterion">
  70. <choose>
  71. <when test="criterion.noValue">
  72. and ${criterion.condition}
  73. </when>
  74. <when test="criterion.singleValue">
  75. and ${criterion.condition} #{criterion.value}
  76. </when>
  77. <when test="criterion.betweenValue">
  78. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  79. </when>
  80. <when test="criterion.listValue">
  81. and ${criterion.condition}
  82. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  83. #{listItem}
  84. </foreach>
  85. </when>
  86. </choose>
  87. </foreach>
  88. </trim>
  89. </if>
  90. </foreach>
  91. </where>
  92. </sql>
  93. <sql id="Base_Column_List">
  94. <!--
  95. WARNING - @mbg.generated
  96. This element is automatically generated by MyBatis Generator, do not modify.
  97. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  98. -->
  99. order_no, order_time, aid, update_time, buyer_id, seller_id, order_amount, pay_amount,
  100. refund_amount, pay_type, order_status, order_channel, order_remarks, delete_sign
  101. </sql>
  102. <select id="selectByExample" parameterType="com.goafanti.common.model.JtOrderExample" resultMap="BaseResultMap">
  103. <!--
  104. WARNING - @mbg.generated
  105. This element is automatically generated by MyBatis Generator, do not modify.
  106. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  107. -->
  108. select
  109. <if test="distinct">
  110. distinct
  111. </if>
  112. <include refid="Base_Column_List" />
  113. from jt_order
  114. <if test="_parameter != null">
  115. <include refid="Example_Where_Clause" />
  116. </if>
  117. <if test="orderByClause != null">
  118. order by ${orderByClause}
  119. </if>
  120. </select>
  121. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  122. <!--
  123. WARNING - @mbg.generated
  124. This element is automatically generated by MyBatis Generator, do not modify.
  125. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  126. -->
  127. select
  128. <include refid="Base_Column_List" />
  129. from jt_order
  130. where order_no = #{orderNo,jdbcType=VARCHAR}
  131. </select>
  132. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  133. <!--
  134. WARNING - @mbg.generated
  135. This element is automatically generated by MyBatis Generator, do not modify.
  136. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  137. -->
  138. delete from jt_order
  139. where order_no = #{orderNo,jdbcType=VARCHAR}
  140. </delete>
  141. <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtOrderExample">
  142. <!--
  143. WARNING - @mbg.generated
  144. This element is automatically generated by MyBatis Generator, do not modify.
  145. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  146. -->
  147. delete from jt_order
  148. <if test="_parameter != null">
  149. <include refid="Example_Where_Clause" />
  150. </if>
  151. </delete>
  152. <insert id="insert" parameterType="com.goafanti.common.model.JtOrder">
  153. <!--
  154. WARNING - @mbg.generated
  155. This element is automatically generated by MyBatis Generator, do not modify.
  156. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  157. -->
  158. insert into jt_order (order_no, order_time, aid,
  159. update_time, buyer_id, seller_id,
  160. order_amount, pay_amount, refund_amount,
  161. pay_type, order_status, order_channel,
  162. order_remarks, delete_sign)
  163. values (#{orderNo,jdbcType=VARCHAR}, #{orderTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
  164. #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR}, #{sellerId,jdbcType=VARCHAR},
  165. #{orderAmount,jdbcType=DECIMAL}, #{payAmount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL},
  166. #{payType,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderChannel,jdbcType=INTEGER},
  167. #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER})
  168. </insert>
  169. <insert id="insertSelective" parameterType="com.goafanti.common.model.JtOrder">
  170. <!--
  171. WARNING - @mbg.generated
  172. This element is automatically generated by MyBatis Generator, do not modify.
  173. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  174. -->
  175. insert into jt_order
  176. <trim prefix="(" suffix=")" suffixOverrides=",">
  177. <if test="orderNo != null">
  178. order_no,
  179. </if>
  180. <if test="orderTime != null">
  181. order_time,
  182. </if>
  183. <if test="aid != null">
  184. aid,
  185. </if>
  186. <if test="updateTime != null">
  187. update_time,
  188. </if>
  189. <if test="buyerId != null">
  190. buyer_id,
  191. </if>
  192. <if test="sellerId != null">
  193. seller_id,
  194. </if>
  195. <if test="orderAmount != null">
  196. order_amount,
  197. </if>
  198. <if test="payAmount != null">
  199. pay_amount,
  200. </if>
  201. <if test="refundAmount != null">
  202. refund_amount,
  203. </if>
  204. <if test="payType != null">
  205. pay_type,
  206. </if>
  207. <if test="orderStatus != null">
  208. order_status,
  209. </if>
  210. <if test="orderChannel != null">
  211. order_channel,
  212. </if>
  213. <if test="orderRemarks != null">
  214. order_remarks,
  215. </if>
  216. <if test="deleteSign != null">
  217. delete_sign,
  218. </if>
  219. </trim>
  220. <trim prefix="values (" suffix=")" suffixOverrides=",">
  221. <if test="orderNo != null">
  222. #{orderNo,jdbcType=VARCHAR},
  223. </if>
  224. <if test="orderTime != null">
  225. #{orderTime,jdbcType=TIMESTAMP},
  226. </if>
  227. <if test="aid != null">
  228. #{aid,jdbcType=VARCHAR},
  229. </if>
  230. <if test="updateTime != null">
  231. #{updateTime,jdbcType=TIMESTAMP},
  232. </if>
  233. <if test="buyerId != null">
  234. #{buyerId,jdbcType=VARCHAR},
  235. </if>
  236. <if test="sellerId != null">
  237. #{sellerId,jdbcType=VARCHAR},
  238. </if>
  239. <if test="orderAmount != null">
  240. #{orderAmount,jdbcType=DECIMAL},
  241. </if>
  242. <if test="payAmount != null">
  243. #{payAmount,jdbcType=DECIMAL},
  244. </if>
  245. <if test="refundAmount != null">
  246. #{refundAmount,jdbcType=DECIMAL},
  247. </if>
  248. <if test="payType != null">
  249. #{payType,jdbcType=INTEGER},
  250. </if>
  251. <if test="orderStatus != null">
  252. #{orderStatus,jdbcType=INTEGER},
  253. </if>
  254. <if test="orderChannel != null">
  255. #{orderChannel,jdbcType=INTEGER},
  256. </if>
  257. <if test="orderRemarks != null">
  258. #{orderRemarks,jdbcType=VARCHAR},
  259. </if>
  260. <if test="deleteSign != null">
  261. #{deleteSign,jdbcType=INTEGER},
  262. </if>
  263. </trim>
  264. </insert>
  265. <select id="countByExample" parameterType="com.goafanti.common.model.JtOrderExample" resultType="java.lang.Long">
  266. <!--
  267. WARNING - @mbg.generated
  268. This element is automatically generated by MyBatis Generator, do not modify.
  269. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  270. -->
  271. select count(*) from jt_order
  272. <if test="_parameter != null">
  273. <include refid="Example_Where_Clause" />
  274. </if>
  275. </select>
  276. <update id="updateByExampleSelective" parameterType="map">
  277. <!--
  278. WARNING - @mbg.generated
  279. This element is automatically generated by MyBatis Generator, do not modify.
  280. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  281. -->
  282. update jt_order
  283. <set>
  284. <if test="record.orderNo != null">
  285. order_no = #{record.orderNo,jdbcType=VARCHAR},
  286. </if>
  287. <if test="record.orderTime != null">
  288. order_time = #{record.orderTime,jdbcType=TIMESTAMP},
  289. </if>
  290. <if test="record.aid != null">
  291. aid = #{record.aid,jdbcType=VARCHAR},
  292. </if>
  293. <if test="record.updateTime != null">
  294. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  295. </if>
  296. <if test="record.buyerId != null">
  297. buyer_id = #{record.buyerId,jdbcType=VARCHAR},
  298. </if>
  299. <if test="record.sellerId != null">
  300. seller_id = #{record.sellerId,jdbcType=VARCHAR},
  301. </if>
  302. <if test="record.orderAmount != null">
  303. order_amount = #{record.orderAmount,jdbcType=DECIMAL},
  304. </if>
  305. <if test="record.payAmount != null">
  306. pay_amount = #{record.payAmount,jdbcType=DECIMAL},
  307. </if>
  308. <if test="record.refundAmount != null">
  309. refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
  310. </if>
  311. <if test="record.payType != null">
  312. pay_type = #{record.payType,jdbcType=INTEGER},
  313. </if>
  314. <if test="record.orderStatus != null">
  315. order_status = #{record.orderStatus,jdbcType=INTEGER},
  316. </if>
  317. <if test="record.orderChannel != null">
  318. order_channel = #{record.orderChannel,jdbcType=INTEGER},
  319. </if>
  320. <if test="record.orderRemarks != null">
  321. order_remarks = #{record.orderRemarks,jdbcType=VARCHAR},
  322. </if>
  323. <if test="record.deleteSign != null">
  324. delete_sign = #{record.deleteSign,jdbcType=INTEGER},
  325. </if>
  326. </set>
  327. <if test="_parameter != null">
  328. <include refid="Update_By_Example_Where_Clause" />
  329. </if>
  330. </update>
  331. <update id="updateByExample" parameterType="map">
  332. <!--
  333. WARNING - @mbg.generated
  334. This element is automatically generated by MyBatis Generator, do not modify.
  335. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  336. -->
  337. update jt_order
  338. set order_no = #{record.orderNo,jdbcType=VARCHAR},
  339. order_time = #{record.orderTime,jdbcType=TIMESTAMP},
  340. aid = #{record.aid,jdbcType=VARCHAR},
  341. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  342. buyer_id = #{record.buyerId,jdbcType=VARCHAR},
  343. seller_id = #{record.sellerId,jdbcType=VARCHAR},
  344. order_amount = #{record.orderAmount,jdbcType=DECIMAL},
  345. pay_amount = #{record.payAmount,jdbcType=DECIMAL},
  346. refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
  347. pay_type = #{record.payType,jdbcType=INTEGER},
  348. order_status = #{record.orderStatus,jdbcType=INTEGER},
  349. order_channel = #{record.orderChannel,jdbcType=INTEGER},
  350. order_remarks = #{record.orderRemarks,jdbcType=VARCHAR},
  351. delete_sign = #{record.deleteSign,jdbcType=INTEGER}
  352. <if test="_parameter != null">
  353. <include refid="Update_By_Example_Where_Clause" />
  354. </if>
  355. </update>
  356. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtOrder">
  357. <!--
  358. WARNING - @mbg.generated
  359. This element is automatically generated by MyBatis Generator, do not modify.
  360. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  361. -->
  362. update jt_order
  363. <set>
  364. <if test="orderTime != null">
  365. order_time = #{orderTime,jdbcType=TIMESTAMP},
  366. </if>
  367. <if test="aid != null">
  368. aid = #{aid,jdbcType=VARCHAR},
  369. </if>
  370. <if test="updateTime != null">
  371. update_time = #{updateTime,jdbcType=TIMESTAMP},
  372. </if>
  373. <if test="buyerId != null">
  374. buyer_id = #{buyerId,jdbcType=VARCHAR},
  375. </if>
  376. <if test="sellerId != null">
  377. seller_id = #{sellerId,jdbcType=VARCHAR},
  378. </if>
  379. <if test="orderAmount != null">
  380. order_amount = #{orderAmount,jdbcType=DECIMAL},
  381. </if>
  382. <if test="payAmount != null">
  383. pay_amount = #{payAmount,jdbcType=DECIMAL},
  384. </if>
  385. <if test="refundAmount != null">
  386. refund_amount = #{refundAmount,jdbcType=DECIMAL},
  387. </if>
  388. <if test="payType != null">
  389. pay_type = #{payType,jdbcType=INTEGER},
  390. </if>
  391. <if test="orderStatus != null">
  392. order_status = #{orderStatus,jdbcType=INTEGER},
  393. </if>
  394. <if test="orderChannel != null">
  395. order_channel = #{orderChannel,jdbcType=INTEGER},
  396. </if>
  397. <if test="orderRemarks != null">
  398. order_remarks = #{orderRemarks,jdbcType=VARCHAR},
  399. </if>
  400. <if test="deleteSign != null">
  401. delete_sign = #{deleteSign,jdbcType=INTEGER},
  402. </if>
  403. </set>
  404. where order_no = #{orderNo,jdbcType=VARCHAR}
  405. </update>
  406. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtOrder">
  407. <!--
  408. WARNING - @mbg.generated
  409. This element is automatically generated by MyBatis Generator, do not modify.
  410. This element was generated on Wed Jul 18 08:33:51 CST 2018.
  411. -->
  412. update jt_order
  413. set order_time = #{orderTime,jdbcType=TIMESTAMP},
  414. aid = #{aid,jdbcType=VARCHAR},
  415. update_time = #{updateTime,jdbcType=TIMESTAMP},
  416. buyer_id = #{buyerId,jdbcType=VARCHAR},
  417. seller_id = #{sellerId,jdbcType=VARCHAR},
  418. order_amount = #{orderAmount,jdbcType=DECIMAL},
  419. pay_amount = #{payAmount,jdbcType=DECIMAL},
  420. refund_amount = #{refundAmount,jdbcType=DECIMAL},
  421. pay_type = #{payType,jdbcType=INTEGER},
  422. order_status = #{orderStatus,jdbcType=INTEGER},
  423. order_channel = #{orderChannel,jdbcType=INTEGER},
  424. order_remarks = #{orderRemarks,jdbcType=VARCHAR},
  425. delete_sign = #{deleteSign,jdbcType=INTEGER}
  426. where order_no = #{orderNo,jdbcType=VARCHAR}
  427. </update>
  428. <select id="searchJtOrderList" resultType="com.goafanti.order.bo.JtOrderResultDetail">
  429. select
  430. jto.order_no as orderNo,
  431. jtod.commodity_type as commodityType,
  432. jto.order_time as createTime,
  433. jto.order_amount as orderAmount,
  434. jtod.commodity_quantity as commodityQuantity,
  435. jtod.commodity_name as commodityName,
  436. jto.seller_id as sellerId,
  437. jto.buyer_id as buyerId,
  438. seller.identify_name as sellerName,
  439. buyer.identify_name as buyerName,
  440. seller.mobile as sellerMobile,
  441. jtod.commodity_id as commodityId,
  442. buyer.mobile as buyerMobile
  443. from jt_order jto
  444. left join jt_order_detail jtod on jtod.order_no=jto.order_no
  445. left join user seller on seller.id = jto.seller_id
  446. left join user buyer on buyer.id=jto.buyer_id
  447. where 1=1
  448. <if test="sellerId!=null">
  449. and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
  450. </if>
  451. <if test="buyerId!=null">
  452. and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
  453. </if>
  454. <if test="sellerName!=null">
  455. and ((seller.identify_name is not null and seller.identify_name like concat("%",#{sellerName,jdbcType=VARCHAR},"%")) or (seller.identify_name is null and #{sellerName,jdbcType=VARCHAR}=''))
  456. </if>
  457. <if test="buyerName!=null">
  458. and (( buyer.identify_name is not null and buyer.identify_name like concat("%",#{buyerName,jdbcType=VARCHAR},"%")) or (buyer.identify_name is null and #{buyerName,jdbcType=VARCHAR}=''))
  459. </if>
  460. <if test="orderNo!=null">
  461. and jto.order_no like concat("%",#{orderNo,jdbcType=VARCHAR},"%")
  462. </if>
  463. <if test="commodityName!=null">
  464. and jtod.commodity_name like concat("%",#{commodityName,jdbcType=VARCHAR},"%")
  465. </if>
  466. <if test="startCreateDate!=null">
  467. and jto.order_time <![CDATA[ >= ]]> #{startCreateDate,jdbcType=TIMESTAMP}
  468. </if>
  469. <if test="endCreateDate!=null">
  470. and jto.order_time <![CDATA[ <= ]]> #{endCreateDate,jdbcType=TIMESTAMP}
  471. </if>
  472. <if test="orderType!=null ">
  473. and (jtod.commodity_type=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (jtod.commodity_type=1 or jtod.commodity_type=0)))
  474. </if>
  475. order by jto.order_time desc
  476. <if test="page_sql!=null">
  477. ${page_sql}
  478. </if>
  479. </select>
  480. <select id="searchJtOrderListCount" resultType="java.lang.Integer">
  481. select
  482. count(0)
  483. from jt_order jto
  484. left join jt_order_detail jtod on jtod.order_no=jto.order_no
  485. left join user seller on seller.id = jto.seller_id
  486. left join user buyer on buyer.id=jto.buyer_id
  487. where 1=1
  488. <if test="sellerId!=null">
  489. and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
  490. </if>
  491. <if test="buyerId!=null">
  492. and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
  493. </if>
  494. <if test="sellerName!=null">
  495. and ((seller.identify_name is not null and seller.identify_name like concat("%",#{sellerName,jdbcType=VARCHAR},"%")) or (seller.identify_name is null and #{sellerName,jdbcType=VARCHAR}=''))
  496. </if>
  497. <if test="buyerName!=null">
  498. and (( buyer.identify_name is not null and buyer.identify_name like concat("%",#{buyerName,jdbcType=VARCHAR},"%")) or (buyer.identify_name is null and #{buyerName,jdbcType=VARCHAR}=''))
  499. </if>
  500. <if test="orderNo!=null">
  501. and jto.order_no like concat("%",#{orderNo,jdbcType=VARCHAR},"%")
  502. </if>
  503. <if test="commodityName!=null">
  504. and jtod.commodity_name like concat("%",#{commodityName,jdbcType=VARCHAR},"%")
  505. </if>
  506. <if test="startCreateDate!=null">
  507. and jto.order_time <![CDATA[ >= ]]> #{startCreateDate,jdbcType=TIMESTAMP}
  508. </if>
  509. <if test="endCreateDate!=null">
  510. and jto.order_time <![CDATA[ <= ]]> #{endCreateDate,jdbcType=TIMESTAMP}
  511. </if>
  512. <if test="orderType!=null ">
  513. and (jtod.commodity_type=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (jtod.commodity_type=1 or jtod.commodity_type=0)))
  514. </if>
  515. <!-- order by x.createTime desc -->
  516. <!-- <if test="page_sql!=null">
  517. ${page_sql}
  518. </if> -->
  519. </select>
  520. <select id="appSearchJtOrderList" resultType="com.goafanti.order.bo.JtOrderResultDetail">
  521. select x.* from
  522. (select jto.order_no as orderNo,
  523. jtod.commodity_type as commodityType,
  524. jto.order_time as createTime,
  525. jto.order_amount as orderAmount,
  526. jtod.commodity_quantity as commodityQuantity,
  527. jtod.commodity_name as commodityName,
  528. jto.seller_id as sellerId,
  529. jto.buyer_id as buyerId,
  530. seller.nickname as sellerName,
  531. buyer.nickname as buyerName,
  532. seller.mobile as sellerMobile,
  533. jtod.commodity_id as commodityId,
  534. buyer.mobile as buyerMobile from jt_order jto
  535. left join jt_order_detail jtod on jtod.order_no=jto.order_no
  536. left join user seller on seller.id = jto.seller_id
  537. left join user buyer on buyer.id=jto.buyer_id
  538. where 1=1
  539. <if test="sellerId!=null">
  540. and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
  541. </if>
  542. <if test="buyerId!=null">
  543. and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
  544. </if>
  545. UNION all
  546. select jco.order_no as orderNo ,
  547. (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
  548. jco.order_time as createTime,
  549. jco.order_amount as orderAmount,
  550. 1 as commodityQuantity,
  551. (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
  552. jco.seller_id as sellerId,
  553. jco.buyer_id as buyerId,
  554. seller.nickname as sellerName,
  555. buyer.nickname as buyerName,
  556. seller.mobile as sellerMobile,
  557. jco.seller_id as commodityId,
  558. buyer.mobile as buyerMobile
  559. from jt_consult_order jco
  560. left join user seller on seller.id = jco.seller_id
  561. left join user buyer on buyer.id=jco.buyer_id
  562. where 1=1
  563. <if test="sellerId!=null">
  564. and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
  565. </if>
  566. <if test="buyerId!=null">
  567. and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
  568. </if>
  569. ) x
  570. where 1=1
  571. <if test="orderType!=null ">
  572. and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
  573. </if>
  574. <if test="page_sql!=null">
  575. ${page_sql}
  576. </if>
  577. </select>
  578. <select id="appSearchJtOrderListCount" resultType="java.lang.Integer">
  579. select count(x.commodityType) from
  580. (select jto.order_no as orderNo,
  581. jtod.commodity_type as commodityType,
  582. jto.order_time as createTime,
  583. jto.order_amount as orderAmount,
  584. jtod.commodity_quantity as commodityQuantity,
  585. jtod.commodity_name as commodityName,
  586. jto.seller_id as sellerId,
  587. jto.buyer_id as buyerId,
  588. seller.identify_name as sellerName,
  589. buyer.identify_name as buyerName,
  590. seller.mobile as sellerMobile,
  591. jtod.commodity_id as commodityId,
  592. buyer.mobile as buyerMobile from jt_order jto
  593. left join jt_order_detail jtod on jtod.order_no=jto.order_no
  594. left join user seller on seller.id = jto.seller_id
  595. left join user buyer on buyer.id=jto.buyer_id
  596. where 1=1
  597. <if test="sellerId!=null">
  598. and jto.seller_id=#{sellerId,jdbcType=VARCHAR}
  599. </if>
  600. <if test="buyerId!=null">
  601. and jto.buyer_id=#{buyerId,jdbcType=VARCHAR}
  602. </if>
  603. UNION all
  604. select jco.order_no as orderNo ,
  605. (case when jco.consult_type = 0 then 6 when jco.consult_type = 1 then 5 end) as commodityType,
  606. jco.order_time as createTime,
  607. jco.order_amount as orderAmount,
  608. 1 as commodityQuantity,
  609. (case when jco.consult_type = 0 then '专家咨询' when jco.consult_type = 1 then '顾问咨询' end) as commodityName,
  610. jco.seller_id as sellerId,
  611. jco.buyer_id as buyerId,
  612. seller.identify_name as sellerName,
  613. buyer.identify_name as buyerName,
  614. seller.mobile as sellerMobile,
  615. jco.seller_id as commodityId,
  616. buyer.mobile as buyerMobile
  617. from jt_consult_order jco
  618. left join user seller on seller.id = jco.seller_id
  619. left join user buyer on buyer.id=jco.buyer_id
  620. where 1=1
  621. <if test="sellerId!=null">
  622. and jco.seller_id=#{sellerId,jdbcType=VARCHAR}
  623. </if>
  624. <if test="buyerId!=null">
  625. and jco.buyer_id=#{buyerId,jdbcType=VARCHAR}
  626. </if>
  627. ) x
  628. where 1=1
  629. <if test="orderType!=null ">
  630. and (x.commodityType=#{orderType,jdbcType=INTEGER} or (#{orderType,jdbcType=INTEGER}=10 and (x.commodityType=1 or x.commodityType=0)))
  631. </if>
  632. </select>
  633. </mapper>