ConsultOrderMapperExt.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.ConsultOrderMapper">
  4. <select id="findConsultOrderListByPage" resultType="org.springframework.ui.ModelMap">
  5. select
  6. co.id as id,
  7. co.price as price,
  8. co.order_state as orderState,
  9. co.order_time as orderTime,
  10. DATE_FORMAT(co.order_time, '%Y-%m-%d %H:%I:%S') as orderTimeFormatted,
  11. co.user_id as userId,
  12. co.to_user_id as toUserId,
  13. co.payment_time as paymentTime,
  14. DATE_FORMAT(co.payment_time, '%Y-%m-%d %H:%I:%S') as paymentTimeFormatted,
  15. co.payment_value as paymentValue,
  16. co.payment_type as paymentType,
  17. co.payment_id as paymentId,
  18. u.nickname as nickname,
  19. u.number as number,
  20. tu.nickname as toNickname,
  21. tui.username as toUsername,
  22. tu.number as toNumber
  23. from consult_order co
  24. left join `user` u on co.user_id = u.id
  25. left join `user` tu on co.to_user_id = tu.id
  26. left join `user_identity` tui on co.to_user_id = tui.uid
  27. where 1=1
  28. <if test="number != null">
  29. and u.number= #{number,jdbcType=INTEGER}
  30. </if>
  31. <if test="tnumber != null">
  32. and tu.number= #{tnumber,jdbcType=INTEGER}
  33. </if>
  34. <if test="uid != null">
  35. and u.id= #{uid,jdbcType=VARCHAR}
  36. </if>
  37. <if test="id != null">
  38. and co.id= #{id,jdbcType=BIGINT}
  39. </if>
  40. <if test="pid != null">
  41. and co.payment_id= #{pid,jdbcType=VARCHAR}
  42. </if>
  43. <if test="state != null">
  44. and co.order_state= #{state,jdbcType=INTEGER}
  45. </if>
  46. <if test="state == null">
  47. and co.order_state &lt; 9
  48. </if>
  49. order by co.id DESC
  50. <if test="page_sql!=null">
  51. ${page_sql}
  52. </if>
  53. </select>
  54. <select id="findConsultOrderCount" resultType="java.lang.Integer">
  55. select count(*)
  56. from consult_order co
  57. <if test="number != null">
  58. left join `user` u on co.user_id = u.id
  59. </if>
  60. <if test="tnumber != null">
  61. left join `user` tu on co.to_user_id = tu.id
  62. </if>
  63. where 1=1
  64. <if test="number != null">
  65. and u.number= #{number,jdbcType=INTEGER}
  66. </if>
  67. <if test="tnumber != null">
  68. and tu.number= #{tnumber,jdbcType=INTEGER}
  69. </if>
  70. <if test="uid != null">
  71. and co.user_id= #{uid,jdbcType=VARCHAR}
  72. </if>
  73. <if test="id != null">
  74. and co.id= #{id,jdbcType=BIGINT}
  75. </if>
  76. <if test="pid != null">
  77. and co.payment_id= #{pid,jdbcType=VARCHAR}
  78. </if>
  79. <if test="state != null">
  80. and co.order_state= #{state,jdbcType=INTEGER}
  81. </if>
  82. <if test="state == null">
  83. and co.order_state &lt; 9
  84. </if>
  85. </select>
  86. </mapper>