CustomerServiceBatchSendingMapper.xml 3.4 KB

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