WxMessageMapper.xml 3.7 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.tofly.feesapi.wxgl.wechatbasicmgt.mapper.WxMessageMapper">
  4. <resultMap id="wxMessageMap" type="com.tofly.feesapi.wxgl.wechatbasicmgt.entity.WxMessage">
  5. <id property="id" column="ID"/>
  6. <result property="msgType" column="MSG_TYPE"/>
  7. <result property="openid" column="OPENID"/>
  8. <result property="first" column="FIRST"/>
  9. <result property="keyword1" column="KEYWORD1"/>
  10. <result property="keyword2" column="KEYWORD2"/>
  11. <result property="keyword3" column="KEYWORD3"/>
  12. <result property="keyword4" column="KEYWORD4"/>
  13. <result property="keyword5" column="KEYWORD5"/>
  14. <result property="keyword6" column="KEYWORD6"/>
  15. <result property="remark" column="REMARK"/>
  16. <result property="addDate" column="ADD_DATE"/>
  17. <result property="addOcode" column="ADD_OCODE"/>
  18. <result property="sendState" column="SEND_STATE"/>
  19. <result property="handleOcode" column="HANDLE_OCODE"/>
  20. <result property="handleDate" column="HANDLE_DATE"/>
  21. <result property="handleRemark" column="HANDLE_REMARK"/>
  22. <result property="isLock" column="IS_LOCK"/>
  23. <result property="pch" column="PCH"/>
  24. <result property="userid" column="USERID"/>
  25. </resultMap>
  26. <select id="getWxMessagePage" resultType="com.tofly.feesapi.wxgl.wechatbasicmgt.entity.WxMessage">
  27. select a.*
  28. from wx_message a
  29. left join yh_khjbxx b on
  30. <choose>
  31. <when test="filter.msgType==02">
  32. a.keyword2 = b.yhbh
  33. </when>
  34. <when test="filter.msgType==15">
  35. a.keyword1 = b.yhbh
  36. </when>
  37. <otherwise>
  38. a.keyword2 = b.yhbh or a.keyword1 = b.yhbh
  39. </otherwise>
  40. </choose>
  41. where 1=1
  42. <if test="filter.yhbh!=null">
  43. and a.keyword2 = #{filter.yhbh}
  44. </if>
  45. <if test="filter.addDate!=null">
  46. and a.add_date >= #{filter.addDate} and a.add_date <![CDATA[<=]]> #{filter.addDate}+1
  47. </if>
  48. <if test="filter.msgType!=null">
  49. and a.msg_type = #{filter.msgType}
  50. </if>
  51. <if test="filter.sendState!=null">
  52. and a.send_state = #{filter.sendState}
  53. </if>
  54. <if test="filter.searchText!=null">
  55. and (a.keyword1 like concat('%',#{filter.searchText},'%')
  56. or a.keyword2 like concat('%',#{filter.searchText},'%')
  57. or a.keyword3 like concat('%',#{filter.searchText},'%')
  58. or a.keyword4 like concat('%',#{filter.searchText},'%')
  59. or a.keyword5 like concat('%',#{filter.searchText},'%')
  60. )
  61. </if>
  62. <if test="filter.sccbb != null and filter.sccbb != ''">
  63. <if test="filter.sccbb.indexOf(',') != -1">
  64. and b.sscbb in
  65. <foreach item="item" index="index" collection="filter.sccbb.split(',')" open="(" separator=","
  66. close=")">
  67. #{item}
  68. </foreach>
  69. </if>
  70. <if test="filter.sccbb.indexOf(',') == -1">
  71. and b.sscbb=#{filter.sccbb}
  72. </if>
  73. </if>
  74. <if test="filter.userid != null">
  75. and b.sscbb in (select cbbbm from yh_sjqx where user_id=#{filter.userid})
  76. </if>
  77. <if test="filter.sscbpq != null">
  78. and b.sscbpq = #{filter.sscbpq}
  79. </if>
  80. <if test="filter.sccbb != null">
  81. and b.sscbb = #{filter.sccbb}
  82. </if>
  83. order by a.add_date desc,a.pch asc
  84. </select>
  85. </mapper>