TbIndentSmsSendLogMapper.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.sqx.modules.errand.dao.TbIndentSmsSendLogDao">
  4. <select id="logPageByRider" resultType="com.sqx.modules.errand.IndentSmsSendLogVO">
  5. select
  6. issl.*, o.delivery_imgs as imgs, u.phone as sendFromPhone
  7. from
  8. tb_indent_sms_send_log issl
  9. left join tb_indent i on i.indent_id = issl.order_id
  10. left join tb_order o on o.order_id = i.order_id
  11. left join tb_user u on u.user_id = issl.send_from_id
  12. <where>
  13. and issl.send_source = '1'
  14. <if test="query.orderId != null">
  15. and issl.order_id = #{query.orderId}
  16. </if>
  17. <if test="query.successFlag != null and query.successFlag != ''">
  18. and issl.success_flag = #{query.successFlag}
  19. </if>
  20. <if test="query.fromTo != null and query.fromTo != ''">
  21. and u.phone = #{query.fromTo}
  22. </if>
  23. <if test="query.sendTo != null and query.sendTo != ''">
  24. and issl.send_to = #{query.sendTo}
  25. </if>
  26. <if test="query.startTime != null">
  27. and issl.send_time >= #{query.startTime}
  28. </if>
  29. <if test="query.endTime != null">
  30. and issl.send_time <![CDATA[<=]]> concat(#{query.endTime},' 23:59:59')
  31. </if>
  32. </where>
  33. order by issl.send_time desc
  34. </select>
  35. <select id="logPageByShop" resultType="com.sqx.modules.errand.IndentSmsSendLogVO">
  36. select
  37. issl.*, o.delivery_imgs as imgs, gs.shop_name as sendFromShopName
  38. from
  39. tb_indent_sms_send_log issl
  40. left join tb_indent i on i.indent_id = issl.order_id
  41. left join tb_order o on o.order_id = i.order_id
  42. left join goods_shop gs on gs.shop_id = issl.send_from_id
  43. <where>
  44. and issl.send_source = '2'
  45. <if test="query.orderId != null">
  46. and issl.order_id = #{query.orderId}
  47. </if>
  48. <if test="query.successFlag != null and query.successFlag != ''">
  49. and issl.success_flag = #{query.successFlag}
  50. </if>
  51. <if test="query.fromTo != null and query.fromTo != ''">
  52. and gs.phone = #{query.fromTo}
  53. </if>
  54. <if test="query.sendTo != null and query.sendTo != ''">
  55. and issl.send_to = #{query.sendTo}
  56. </if>
  57. <if test="query.startTime != null">
  58. and issl.send_time >= #{query.startTime}
  59. </if>
  60. <if test="query.endTime != null">
  61. and issl.send_time <![CDATA[<=]]> concat(#{query.endTime},' 23:59:59')
  62. </if>
  63. </where>
  64. order by issl.send_time desc
  65. </select>
  66. <select id="countOfSendSuccess" resultType="java.lang.Integer">
  67. select
  68. count(1)
  69. from
  70. tb_indent_sms_send_log issl
  71. left join tb_user u on u.user_id = issl.send_from_id
  72. where
  73. issl.success_flag = '1'
  74. <if test="query.fromTo != null and query.fromTo != ''">
  75. and u.phone = #{query.fromTo}
  76. </if>
  77. <if test="query.startTime != null">
  78. and issl.send_time >= #{query.startTime}
  79. </if>
  80. <if test="query.endTime != null">
  81. and issl.send_time <![CDATA[<=]]> #{query.endTime}
  82. </if>
  83. </select>
  84. </mapper>