ErrandComplaintMapper.xml 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.ErrandComplaintDao">
  4. <select id="findAppComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  5. select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
  6. ti.user_address_detail as userAddressDetail
  7. from errand_complaint ec
  8. left join errand_illegal_type eit on ec.illegal_id = eit.id
  9. left join tb_user tu on ec.rider_user_id = tu.user_id
  10. left join tb_indent ti on ec.indent_number = ti.indent_number
  11. where 1 = 1
  12. <if test="userId!=null">
  13. and ec.rider_user_id = #{userId}
  14. </if>
  15. <if test="illegalId!=null">
  16. and ec.illegal_id = #{illegalId}
  17. </if>
  18. <if test="complaintState!=null">
  19. and ec.complaint_state = #{complaintState}
  20. </if>
  21. <if test="complaintState==null">
  22. and ec.complaint_state in (1, 2, 3, 4)
  23. </if>
  24. order by ec.complaint_time desc
  25. </select>
  26. <select id="findComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  27. select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
  28. ti.user_address_detail as userAddressDetail, sit.illegal as shopIllegal
  29. from errand_complaint ec
  30. left join errand_illegal_type eit on ec.illegal_id = eit.id
  31. left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
  32. left join tb_user tu on ec.rider_user_id = tu.user_id
  33. left join tb_indent ti on ec.indent_number = ti.indent_number
  34. where complaint_id = #{complaintId}
  35. </select>
  36. <select id="findAllComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  37. select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
  38. ti.user_address_detail as userAddressDetail, sit.illegal as shopIllegal
  39. from errand_complaint ec
  40. left join errand_illegal_type eit on ec.illegal_id = eit.id
  41. left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
  42. left join tb_user tu on ec.rider_user_id = tu.user_id
  43. left join tb_indent ti on ec.indent_number = ti.indent_number
  44. where 1 = 1
  45. <if test="userId!=null">
  46. and ec.rider_user_id = #{userId}
  47. </if>
  48. <if test="illegalId!=null">
  49. and ec.illegal_id = #{illegalId}
  50. </if>
  51. <if test="complaintState!=null">
  52. and ec.complaint_state = #{complaintState}
  53. </if>
  54. <if test="indentNumber!=null and indentNumber!=''">
  55. and ec.indent_number = #{indentNumber}
  56. </if>
  57. order by ec.complaint_time desc
  58. </select>
  59. <select id="deductMoneySum" resultType="java.math.BigDecimal">
  60. select ifnull(sum(deduct_money), 0) from errand_complaint where 1 = 1
  61. <if test="query.startTime!=null and query.startTime!=''">
  62. and complaint_time>=#{query.startTime}
  63. </if>
  64. <if test="query.endTime!=null and query.endTime!=''">
  65. and complaint_time <![CDATA[<=]]> #{query.endTime}
  66. </if>
  67. and complaint_state = 3
  68. </select>
  69. <select id="selectComplaintList" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  70. select * from errand_complaint where rider_user_id = #{userId} and complaint_state = 5
  71. </select>
  72. <select id="selectComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  73. select ec.*, ti.shop_address_detail as shopAddressDetail, ti.user_address_detail as userAddressDetail,
  74. sit.illegal as shopIllegal, sit.forfeit_money as shopForfeitMoney, tu.nick_name as nickName, tu.avatar as avatar
  75. from errand_complaint ec left join tb_indent ti on ec.indent_number = ti.indent_number
  76. left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
  77. left join tb_user tu on ec.rider_user_id = tu.user_id
  78. where ec.shop_id = #{shopId} and ec.complaint_state in (1, 5, 6)
  79. order by complaint_time desc
  80. </select>
  81. <select id="selectUserComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
  82. select ec.*, ti.shop_address_detail as shopAddressDetail, ti.user_address_detail as userAddressDetail,
  83. eit.illegal as illegal, eit.forfeit_money as forfeitMoney, tu.nick_name as nickName, tu.avatar as avatar
  84. from errand_complaint ec left join tb_indent ti on ec.indent_number = ti.indent_number
  85. left join errand_illegal_type eit on ec.illegal_id = eit.id
  86. left join tb_user tu on ec.rider_user_id = tu.user_id
  87. where ec.user_id = #{userId}
  88. order by complaint_time desc
  89. </select>
  90. </mapper>