OrderItemMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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.dk.mdm.mapper.sale.OrderItemMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. item_id
  8. , order_id, item_index, sku_id, item_qty, price_std, amt_std, price_sale, item_amt, price_discount, non_std_code, out_status, outing_qty, outing_amt, out_qty, out_amt, return_qty, return_amt, remarks, flg_valid, cp_id, wh_id
  9. </sql>
  10. <sql id="Base_Column_List_Response">
  11. t.item_id, t.order_id, t.item_index, t.sku_id, t.item_qty, t.price_std, t.amt_std, t.price_sale, t.item_amt, t.price_discount, t.non_std_code,
  12. t.out_status, t.outing_qty, t.outing_amt, t.out_qty, t.out_amt, t.return_qty, t.return_amt, t.remarks, t.flg_valid, t.cp_id, t.wh_id
  13. </sql>
  14. <!-- 通用查询映射结果 -->
  15. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.sale.OrderItem">
  16. <id column="item_id" property="itemId"/>
  17. <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
  18. <result column="item_index" property="itemIndex"/>
  19. <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
  20. <result column="item_qty" property="itemQty"/>
  21. <result column="price_std" property="priceStd"/>
  22. <result column="amt_std" property="amtStd"/>
  23. <result column="price_sale" property="priceSale"/>
  24. <result column="item_amt" property="itemAmt"/>
  25. <result column="price_discount" property="priceDiscount"/>
  26. <result column="non_std_code" property="nonStdCode"/>
  27. <result column="out_status" property="outStatus"/>
  28. <result column="outing_qty" property="outingQty"/>
  29. <result column="outing_amt" property="outingAmt"/>
  30. <result column="out_qty" property="outQty"/>
  31. <result column="out_amt" property="outAmt"/>
  32. <result column="return_qty" property="returnQty"/>
  33. <result column="return_amt" property="returnAmt"/>
  34. <result column="remarks" property="remarks"/>
  35. <result column="flg_valid" property="flgValid"/>
  36. <result column="cp_id" property="cpId"/>
  37. <result column="wh_id" property="whId"/>
  38. </resultMap>
  39. <!-- 通用查询映射结果 -->
  40. <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.sale.OrderItemResponse">
  41. <id column="item_id" property="itemId"/>
  42. <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
  43. <result column="item_index" property="itemIndex"/>
  44. <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
  45. <result column="item_qty" property="itemQty"/>
  46. <result column="price_std" property="priceStd"/>
  47. <result column="amt_std" property="amtStd"/>
  48. <result column="price_sale" property="priceSale"/>
  49. <result column="item_amt" property="itemAmt"/>
  50. <result column="price_discount" property="priceDiscount"/>
  51. <result column="non_std_code" property="nonStdCode"/>
  52. <result column="out_status" property="outStatus"/>
  53. <result column="outing_qty" property="outingQty"/>
  54. <result column="outing_amt" property="outingAmt"/>
  55. <result column="out_qty" property="outQty"/>
  56. <result column="out_amt" property="outAmt"/>
  57. <result column="return_qty" property="returnQty"/>
  58. <result column="return_amt" property="returnAmt"/>
  59. <result column="remarks" property="remarks"/>
  60. <result column="flg_valid" property="flgValid"/>
  61. <result column="cp_id" property="cpId"/>
  62. <result column="wh_id" property="whId"/>
  63. <result column="wh_name" property="whName"/>
  64. <result column="order_no" property="orderNo"/>
  65. <result column="transferableQuantity" property="transferableQuantity"/>
  66. </resultMap>
  67. <!-- 通用条件列 -->
  68. <sql id="Condition">
  69. <where>
  70. <if test="orderId != null and orderId != ''">
  71. AND t.order_id = #{orderId}::uuid
  72. </if>
  73. <if test="itemIndex != null">
  74. AND t.item_index = #{itemIndex}
  75. </if>
  76. <if test="skuId != null and skuId != ''">
  77. AND t.sku_id = #{skuId}
  78. </if>
  79. <if test="itemQty != null">
  80. AND t.item_qty = #{itemQty}
  81. </if>
  82. <if test="priceStd != null">
  83. AND t.price_std = #{priceStd}
  84. </if>
  85. <if test="amtStd != null">
  86. AND t.amt_std = #{amtStd}
  87. </if>
  88. <if test="priceSale != null">
  89. AND t.price_sale = #{priceSale}
  90. </if>
  91. <if test="itemAmt != null">
  92. AND t.item_amt = #{itemAmt}
  93. </if>
  94. <if test="priceDiscount != null">
  95. AND t.price_discount = #{priceDiscount}
  96. </if>
  97. <if test="nonStdCode != null and nonStdCode != ''">
  98. AND t.non_std_code = #{nonStdCode}
  99. </if>
  100. <if test="outStatus != null and outStatus != ''">
  101. AND t.out_status = #{outStatus}
  102. </if>
  103. <if test="outingQty != null">
  104. AND t.outing_qty = #{outingQty}
  105. </if>
  106. <if test="outingAmt != null">
  107. AND t.outing_amt = #{outingAmt}
  108. </if>
  109. <if test="outQty != null">
  110. AND t.out_qty = #{outQty}
  111. </if>
  112. <if test="outAmt != null">
  113. AND t.out_amt = #{outAmt}
  114. </if>
  115. <if test="returnQty != null">
  116. AND t.return_qty = #{returnQty}
  117. </if>
  118. <if test="returnAmt != null">
  119. AND t.return_amt = #{returnAmt}
  120. </if>
  121. <if test="remarks != null and remarks != ''">
  122. AND t.remarks = #{remarks}
  123. </if>
  124. <if test="flgValid != null">
  125. AND t.flg_valid = #{flgValid}
  126. </if>
  127. <if test="cpId != null">
  128. AND t.cp_id = #{cpId}
  129. </if>
  130. </where>
  131. </sql>
  132. <sql id="idsForeach">
  133. <!-- 根据主键itemId批量操作 -->
  134. WHERE item_id in
  135. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  136. #{item}
  137. </foreach>
  138. </sql>
  139. <!-- 查询表t_psi_order_item,(条件查询+分页)列表 -->
  140. <select id="selectByCond" resultMap="BaseResultMapResponse">
  141. SELECT t.item_id,
  142. t.order_id,
  143. t.item_index,
  144. t.sku_id,
  145. tmgs.sku_code as "skuCode",
  146. tmgs.sku_model as "skuModel",
  147. tmgs.sku_name as "skuName",
  148. t.item_qty,
  149. t.price_std,
  150. t.amt_std,
  151. t.price_sale,
  152. t.item_amt,
  153. t.price_discount,
  154. t.non_std_code,
  155. t.out_status,
  156. t.outing_qty,
  157. t.outing_amt,
  158. t.out_qty,
  159. t.out_amt,
  160. t.return_qty,
  161. t.return_amt,
  162. t.remarks,
  163. t.wh_id,
  164. tmw.wh_name
  165. FROM dkic_b.t_psi_order_item as t
  166. inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
  167. left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
  168. <include refid="Condition"/>
  169. order by t.item_index
  170. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  171. limit #{end} offset #{start}
  172. </if>
  173. </select>
  174. <!-- 查询表t_psi_order_item,(条件查询)个数 -->
  175. <select id="countByCond" resultType="Long">
  176. SELECT
  177. count(1)
  178. FROM dkic_b.t_psi_order_item as t
  179. <include refid="Condition"/>
  180. </select>
  181. <!-- 根据主键查询表t_psi_order_item的一行数据 -->
  182. <select id="selectById" resultMap="BaseResultMapResponse">
  183. SELECT
  184. <include refid="Base_Column_List_Response"/>
  185. FROM dkic_b.t_psi_order_item t
  186. WHERE t.item_id = #{id}::uuid
  187. </select>
  188. <!-- 根据主键锁定表t_psi_order_item的一行数据 -->
  189. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  190. SELECT
  191. <include refid="Base_Column_List"/>
  192. FROM dkic_b.t_psi_order_item
  193. WHERE item_id = #{id}::uuid
  194. for update
  195. </select>
  196. <!-- 根据主表主键锁定表t_psi_order_item的一行数据 -->
  197. <select id="selectByZIdForUpdate" resultMap="BaseResultMap">
  198. SELECT
  199. <include refid="Base_Column_List"/>
  200. FROM dkic_b.t_psi_order_item
  201. WHERE order_id = #{id}::uuid
  202. for update
  203. </select>
  204. <!-- 根据主键锁定表t_psi_order_item的多行数据 -->
  205. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  206. SELECT
  207. <include refid="Base_Column_List"/>
  208. FROM dkic_b.t_psi_order_item
  209. <include refid="idsForeach"/>
  210. for update
  211. </select>
  212. <insert id="insertBatch">
  213. insert into dkic_b.t_psi_order_item
  214. (
  215. <trim suffixOverrides=",">
  216. order_id,
  217. item_index,
  218. sku_id,
  219. item_qty,
  220. price_std,
  221. amt_std,
  222. price_sale,
  223. item_amt,
  224. price_discount,
  225. non_std_code,
  226. out_status,
  227. outing_qty,
  228. outing_amt,
  229. out_qty,
  230. out_amt,
  231. return_qty,
  232. return_amt,
  233. remarks,
  234. cp_id,
  235. wh_id,
  236. </trim>
  237. )
  238. values
  239. <foreach collection="list" index="index" item="item" separator=",">
  240. (
  241. <trim suffixOverrides=",">
  242. #{item.orderId}::uuid,
  243. #{item.itemIndex},
  244. #{item.skuId}::uuid,
  245. #{item.itemQty},
  246. #{item.priceStd},
  247. #{item.amtStd},
  248. #{item.priceSale},
  249. #{item.itemAmt},
  250. #{item.priceDiscount},
  251. #{item.nonStdCode},
  252. #{item.outStatus},
  253. #{item.outingQty},
  254. #{item.outingAmt},
  255. #{item.outQty},
  256. #{item.outAmt},
  257. #{item.returnQty},
  258. #{item.returnAmt},
  259. #{item.remarks},
  260. #{item.cpId},
  261. #{item.whId},
  262. </trim>
  263. )
  264. </foreach>
  265. </insert>
  266. <delete id="deleteById">
  267. DELETE FROM dkic_b.t_psi_order_item
  268. WHERE item_id = #{id}::UUID;
  269. </delete>
  270. <!-- 根据条件进行查询(出库用) -->
  271. <select id="selectByCondForOut" resultMap="BaseResultMapResponse">
  272. SELECT t.item_id as "fromItemId",
  273. t.order_id as "fromId",
  274. t.item_index,
  275. t.sku_id,
  276. tmgs.sku_code as "skuCode",
  277. tmgs.sku_model as "skuModel",
  278. tmgs.sku_name as "skuName",
  279. t.item_qty as "orderQty",
  280. t.item_qty - t.outing_qty - t.out_qty as "canOutingQty",
  281. t.item_qty - t.outing_qty - t.out_qty as outing_qty,
  282. t.price_sale as "priceOut",
  283. t.price_sale * (t.item_qty - t.outing_qty - t.out_qty) as outing_amt,
  284. t.non_std_code,
  285. t.remarks,
  286. t.wh_id,
  287. tmw.wh_name,
  288. tpi.inv_id as "invId",
  289. tpi.inv_qty as "invQty",
  290. tpi.usable_qty as "usableQty"
  291. FROM dkic_b.t_psi_order_item as t
  292. inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
  293. left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
  294. left join dkic_b.t_psi_inventory as tpi
  295. on tpi.sku_id = t.sku_id and tpi.non_std_code = t.non_std_code
  296. and tpi.wh_id = t.wh_id and tpi.cp_id = t.cp_id
  297. where t.flg_valid
  298. and t.item_qty > t.outing_qty
  299. and t.order_id = #{orderId}::uuid
  300. order by t.item_index
  301. </select>
  302. <!-- 根据条件进行查询(退货用) -->
  303. <select id="selectByCondForReturn" resultMap="BaseResultMapResponse">
  304. SELECT tpobi.out_id as "sOutId",
  305. tpobi.item_id as "sOutItemId",
  306. t.order_id as "sOrderId",
  307. t.item_id as "sOrderItemId",
  308. t.sku_id,
  309. tmgs.sku_code as "skuCode",
  310. tmgs.sku_model as "skuModel",
  311. tmgs.sku_name as "skuName",
  312. tpobi.out_qty as "outboundOutQty",
  313. tpobi.out_qty - tpobi.return_qty as "canReturnQty",
  314. - (tpobi.out_qty - tpobi.return_qty) as outing_qty,
  315. t.price_sale as "priceOut",
  316. - t.price_sale * (tpobi.out_qty - tpobi.return_qty) as outing_amt,
  317. tpobi.inv_id as "invId",
  318. 0 as out_qty,
  319. 0 as out_amt,
  320. t.non_std_code,
  321. tpobi.remarks
  322. FROM dkic_b.t_psi_outbound_item as tpobi
  323. inner join dkic_b.t_psi_order_item as t on t.item_id = tpobi.from_item_id
  324. inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
  325. where tpobi.flg_valid
  326. and tpobi.out_type = '出库类型-销售出库'
  327. and tpobi.out_qty > tpobi.return_qty
  328. and t.order_id = #{orderId}::uuid
  329. order by t.item_index
  330. </select>
  331. <!-- 根据id修改-->
  332. <update id="updateById" parameterType="com.dk.mdm.model.pojo.sale.OrderItem">
  333. update dkic_b.t_psi_order_item
  334. <set>
  335. <if test=" et!=null and et.itemIndex != null">
  336. item_index = #{et.itemIndex,jdbcType=INTEGER},
  337. </if>
  338. <if test=" et!=null and et.skuId != null">
  339. sku_id = #{et.skuId,typeHandler=UuidTypeHandler},
  340. </if>
  341. <if test=" et!=null and et.itemQty != null">
  342. item_qty = #{et.itemQty,jdbcType=NUMERIC},
  343. </if>
  344. <if test=" et!=null and et.priceStd != null">
  345. price_std = #{et.priceStd,jdbcType=NUMERIC},
  346. </if>
  347. <if test=" et!=null and et.amtStd != null">
  348. amt_std = #{et.amtStd,jdbcType=NUMERIC},
  349. </if>
  350. <if test=" et!=null and et.priceSale != null">
  351. price_sale = #{et.priceSale,jdbcType=NUMERIC},
  352. </if>
  353. <if test=" et!=null and et.itemAmt != null">
  354. item_amt = #{et.itemAmt,jdbcType=NUMERIC},
  355. </if>
  356. <if test=" et!=null and et.priceDiscount != null">
  357. price_discount = #{et.priceDiscount,jdbcType=NUMERIC},
  358. </if>
  359. <if test=" et!=null and et.nonStdCode != null">
  360. non_std_code = #{et.nonStdCode,jdbcType=VARCHAR},
  361. </if>
  362. <if test=" et!=null and et.outStatus != null">
  363. out_status = #{et.outStatus,jdbcType=VARCHAR},
  364. </if>
  365. <if test=" et!=null and et.outingQty != null">
  366. outing_qty = outing_qty + #{et.outingQty,jdbcType=NUMERIC},
  367. </if>
  368. <if test=" et!=null and et.outingAmt != null">
  369. outing_amt = outing_amt + #{et.outingAmt,jdbcType=NUMERIC},
  370. </if>
  371. <if test=" et!=null and et.outQty != null">
  372. out_qty = out_qty + #{et.outQty,jdbcType=NUMERIC},
  373. </if>
  374. <if test=" et!=null and et.outAmt != null">
  375. out_amt = out_amt + #{et.outAmt,jdbcType=NUMERIC},
  376. </if>
  377. <if test=" et!=null and et.returnQty != null">
  378. return_qty = #{et.returnQty,jdbcType=NUMERIC},
  379. </if>
  380. <if test=" et!=null and et.returnAmt != null">
  381. return_amt = #{et.returnAmt,jdbcType=NUMERIC},
  382. </if>
  383. <if test=" et!=null and et.remarks != null">
  384. remarks = #{et.remarks,jdbcType=VARCHAR},
  385. </if>
  386. <if test=" et!=null and et.flgValid != null">
  387. flg_valid = #{et.flgValid,jdbcType=BOOLEAN},
  388. </if>
  389. <if test=" et!=null and et.cpId != null">
  390. cp_id = #{et.cpId,jdbcType=INTEGER},
  391. </if>
  392. </set>
  393. where item_id = #{et.itemId,typeHandler=UuidTypeHandler}
  394. and item_qty >=(out_qty + outing_qty)
  395. </update>
  396. <!--修改退货信息 -->
  397. <update id="updateReturnMessage" parameterType="com.dk.mdm.model.pojo.sale.OrderItem">
  398. update dkic_b.t_psi_order_item
  399. <set>
  400. <if test=" returnQty != null">
  401. return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
  402. </if>
  403. <if test=" returnAmt != null">
  404. return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
  405. </if>
  406. </set>
  407. where item_id = #{itemId,typeHandler=UuidTypeHandler}
  408. and item_qty >= return_qty
  409. </update>
  410. <!-- 通用条件列 -->
  411. <sql id="Condition_pur">
  412. <where>
  413. <if test="orderNo != null">
  414. AND tpo.order_no like concat('%', my_ex.likequery(#{orderNo}) , '%')
  415. </if>
  416. <if test="orderId != null and orderId != ''">
  417. AND t.order_id = #{orderId}::uuid
  418. </if>
  419. <if test="itemIndex != null">
  420. AND t.item_index = #{itemIndex}
  421. </if>
  422. <if test="skuId != null and skuId != ''">
  423. AND t.sku_id = #{skuId}
  424. </if>
  425. <if test="itemQty != null">
  426. AND t.item_qty = #{itemQty}
  427. </if>
  428. <if test="priceStd != null">
  429. AND t.price_std = #{priceStd}
  430. </if>
  431. <if test="amtStd != null">
  432. AND t.amt_std = #{amtStd}
  433. </if>
  434. <if test="priceSale != null">
  435. AND t.price_sale = #{priceSale}
  436. </if>
  437. <if test="itemAmt != null">
  438. AND t.item_amt = #{itemAmt}
  439. </if>
  440. <if test="priceDiscount != null">
  441. AND t.price_discount = #{priceDiscount}
  442. </if>
  443. <if test="nonStdCode != null and nonStdCode != ''">
  444. AND t.non_std_code = #{nonStdCode}
  445. </if>
  446. <if test="outStatus != null and outStatus != ''">
  447. AND t.out_status = #{outStatus}
  448. </if>
  449. <if test="outingQty != null">
  450. AND t.outing_qty = #{outingQty}
  451. </if>
  452. <if test="outingAmt != null">
  453. AND t.outing_amt = #{outingAmt}
  454. </if>
  455. <if test="outQty != null">
  456. AND t.out_qty = #{outQty}
  457. </if>
  458. <if test="outAmt != null">
  459. AND t.out_amt = #{outAmt}
  460. </if>
  461. <if test="returnQty != null">
  462. AND t.return_qty = #{returnQty}
  463. </if>
  464. <if test="returnAmt != null">
  465. AND t.return_amt = #{returnAmt}
  466. </if>
  467. <if test="remarks != null and remarks != ''">
  468. AND t.remarks = #{remarks}
  469. </if>
  470. <if test="flgValid != null">
  471. AND t.flg_valid = #{flgValid}
  472. </if>
  473. <if test="cpId != null">
  474. AND t.cp_id = #{cpId}
  475. </if>
  476. </where>
  477. </sql>
  478. <!-- 查询表t_psi_order_item,(条件查询+分页)列表 -->
  479. <select id="purchaseBasedOnSaleSelectByCond" resultMap="BaseResultMapResponse">
  480. SELECT t.item_id,
  481. t.order_id,
  482. tpo.order_no,
  483. t.item_index,
  484. t.sku_id,
  485. tmgs.sku_code as "skuCode",
  486. tmgs.sku_model as "skuModel",
  487. tmgs.sku_name as "skuName",
  488. t.item_qty,
  489. t.price_std,
  490. t.amt_std,
  491. t.price_sale,
  492. t.item_amt,
  493. t.price_discount,
  494. t.non_std_code,
  495. t.out_status,
  496. t.outing_qty,
  497. t.outing_amt,
  498. t.out_qty,
  499. t.out_amt,
  500. t.return_qty,
  501. t.return_amt,
  502. t.remarks,
  503. t.item_qty - coalesce(sumQty,0) as "transferableQuantity"
  504. FROM dkic_b.t_psi_order_item as t
  505. left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
  506. inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
  507. left join(select from_item_id,sum(item_qty) as sumQty from t_psi_purchase_item
  508. group by from_item_id) as pi on pi.from_item_id = t.item_id
  509. <where>
  510. t.item_qty - coalesce(sumQty,0) > 0
  511. <if test="orderNo != null">
  512. AND tpo.order_no like concat('%', my_ex.likequery(#{orderNo}) , '%')
  513. </if>
  514. </where>
  515. order by t.item_id
  516. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  517. limit #{end} offset #{start}
  518. </if>
  519. </select>
  520. <!-- 查询表t_psi_order_item,(条件查询+分页)列表 -->
  521. <select id="purchaseBasedOnSaleContByCond" resultType="Long">
  522. SELECT count(1)
  523. FROM dkic_b.t_psi_order_item as t
  524. left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
  525. inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
  526. left join(select from_item_id,sum(item_qty) as sumQty from t_psi_purchase_item
  527. group by from_item_id) as pi on pi.from_item_id = t.item_id
  528. <where>
  529. t.item_qty - coalesce(sumQty,0) > 0
  530. <if test="orderNo != null">
  531. AND tpo.order_no like concat('%', my_ex.likequery(#{orderNo}) , '%')
  532. </if>
  533. </where>
  534. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  535. limit #{end} offset #{start}
  536. </if>
  537. </select>
  538. </mapper>