GoldenOrder.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.crm.custom.dao.mapper.GoldenOrderMapper">
  6. <select id="countList" resultType="integer"
  7. parameterType="com.crm.rely.backend.model.entity.golden.order.GoldenOrderSearchEntity">
  8. select count(*) from golden_order der
  9. <where>
  10. <if test="customId!=null">
  11. and der.`custom_id` = #{customId}
  12. </if>
  13. <if test="cId!=null">
  14. and der.`c_id` = #{cId}
  15. </if>
  16. <if test="status!=null">
  17. and der.`c_id` = #{status}
  18. </if>
  19. <if test="serial!=null and serial!=''">
  20. and der.serial = #{serial}
  21. </if>
  22. <if test="channelCode!=null and channelCode!=''">
  23. and der.channel_code = #{channelCode}
  24. </if>
  25. <if test="payName!=null and payName!=''">
  26. and der.pay_name like concat('%',#{payName},'%')
  27. </if>
  28. <if test="startDate != null">
  29. and der.add_time <![CDATA[ >= ]]> #{startDate}
  30. </if>
  31. <if test="endDate != null">
  32. and der.add_time <![CDATA[ <= ]]> #{endDate}
  33. </if>
  34. </where>
  35. </select>
  36. <select id="pageList" resultType="com.crm.rely.backend.model.pojo.table.GoldenOrderTable"
  37. parameterType="com.crm.rely.backend.model.entity.golden.order.GoldenOrderSearchEntity">
  38. select * from golden_order der
  39. <where>
  40. <if test="customId!=null">
  41. and der.`custom_id` = #{customId}
  42. </if>
  43. <if test="cId!=null">
  44. and der.`c_id` = #{cId}
  45. </if>
  46. <if test="status!=null">
  47. and der.`c_id` = #{status}
  48. </if>
  49. <if test="serial!=null and serial!=''">
  50. and der.serial = #{serial}
  51. </if>
  52. <if test="channelCode!=null and channelCode!=''">
  53. and der.channel_code = #{channelCode}
  54. </if>
  55. <if test="payName!=null and payName!=''">
  56. and der.pay_name like concat('%',#{payName},'%')
  57. </if>
  58. <if test="startDate != null">
  59. and der.add_time <![CDATA[ >= ]]> #{startDate}
  60. </if>
  61. <if test="endDate != null">
  62. and der.add_time <![CDATA[ <= ]]> #{endDate}
  63. </if>
  64. </where>
  65. order by id desc
  66. <if test="page != null">
  67. limit #{page.offset},#{page.row}
  68. </if>
  69. </select>
  70. <select id="getListBySerial" resultType="com.crm.rely.backend.model.dto.golden.order.GoldenOrderDetailsDto">
  71. SELECT *
  72. FROM golden_order_details
  73. where serial in
  74. <foreach collection="serialList" index="index" item="item" open="(" separator="," close=")">
  75. #{item}
  76. </foreach>
  77. </select>
  78. <select id="getByCustomIdAndGoodsId" resultType="com.crm.rely.backend.model.pojo.table.GoldenOrderDetailsTable">
  79. SELECT *
  80. FROM golden_order_details der
  81. left join golden_order gor on der.serial = gor.serial
  82. where gor.`status` in (1,2) and der.custom_id = #{customId}
  83. and der.goods_id = #{goodsId} limit 1
  84. </select>
  85. </mapper>