CustomerServiceBatchSendingMapper.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.yonge.cooleshow.biz.dal.mapper.CustomerServiceBatchSendingMapper">
  4. <!-- 表字段 -->
  5. <sql id="baseColumns">
  6. t.id_ AS id
  7. , t.target_group_ AS targetGroup
  8. , t.send_subject_ AS sendSubject
  9. , t.send_number_ AS sendNumber
  10. , t.receive_number_ AS receiveNumber
  11. , t.receive_type_ AS receiveType
  12. , t.send_type_ AS sendType
  13. , t.send_status_ AS sendStatus
  14. , t.send_time_ AS sendTime
  15. , t.condition_ AS `condition`
  16. , t.title_ AS title
  17. , t.text_message_ AS textMessage
  18. , t.img_message_ AS imgMessage
  19. , t.img_url_ AS imgUrl
  20. , t.sender_id_ AS senderId
  21. , t.create_by_ AS createBy
  22. , t.create_time_ AS createTime
  23. </sql>
  24. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.im.CustomerServiceBatchSendingWrapper$CustomerServiceBatchSending">
  25. SELECT
  26. <include refid="baseColumns" />
  27. FROM customer_service_batch_sending t
  28. <where>
  29. <if test="param.keyword != null">
  30. AND t.id_ = #{param.keyword}
  31. </if>
  32. <if test="param.sendSubject != null">
  33. AND FIND_IN_SET(#{param.sendSubject}, t.send_subject_)
  34. </if>
  35. <if test="param.targetGroup != null">
  36. AND FIND_IN_SET(#{param.targetGroup}, t.target_group_)
  37. </if>
  38. <if test="param.sendType != null">
  39. AND t.send_type_ = #{param.sendType}
  40. </if>
  41. <if test="param.sendStatus != null">
  42. AND t.send_status_ = #{param.sendStatus}
  43. </if>
  44. <if test="param.startTime != null and param.endTime != null">
  45. AND (#{param.startTime} &lt;= t.create_time_ AND t.create_time_ &lt;= #{param.endTime})
  46. </if>
  47. <if test="param.sendStartTime != null and param.sendEndTime != null">
  48. AND (#{param.sendStartTime} &lt;= t.send_time_ AND t.send_time_ &lt;= #{param.sendEndTime})
  49. </if>
  50. </where>
  51. ORDER BY t.id_ DESC
  52. </select>
  53. <!--客服消息接收者-->
  54. <select id="selectMessageReceives"
  55. resultType="com.yonge.cooleshow.biz.dal.wrapper.im.CustomerService$MessageReceives">
  56. SELECT t1.id_ AS userId, t1.username_ FROM sys_user t1
  57. <if test="param.clientType != null">
  58. <if test="param.clientType.code == 'TEACHER'"> LEFT JOIN teacher t2 ON (t1.id_ = t2.user_id_)</if>
  59. <if test="param.clientType.code == 'STUDENT'"> LEFT JOIN student t2 ON (t1.id_ = t2.user_id_)</if>
  60. </if>
  61. <where>
  62. <if test="param.subjectIds != null">
  63. AND (<foreach collection="param.subjectIds" separator="OR" item="item"> FIND_IN_SET(#{item}, t2.subject_id_) </foreach>)
  64. </if>
  65. <if test="param.tenantFlag != null">
  66. <if test="param.tenantFlag == 1">
  67. AND t2.tenant_id_ &gt; 0
  68. </if>
  69. <if test="param.tenantFlag == 0">
  70. AND (t2.tenant_id_ is null or t2.tenant_id_ &lt; 0)
  71. </if>
  72. </if>
  73. </where>
  74. </select>
  75. <!--客服消息接收者-->
  76. </mapper>