SopRulePushMapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.gree.mall.manager.commonmapper.SopRulePushMapper">
  4. <resultMap id="BaseResultMap" type="com.gree.mall.manager.bean.sop.SopRuleData">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="rule_name" jdbcType="VARCHAR" property="ruleName"/>
  7. <result column="company_wechat_id" jdbcType="VARCHAR" property="companyWechatId"/>
  8. <result column="company_name" jdbcType="VARCHAR" property="companyName"/>
  9. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  10. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  11. <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
  12. <result column="status" jdbcType="TINYINT" property="status"/>
  13. <collection property="sopPushTask" ofType="com.gree.mall.manager.bean.sop.SopPushTaskData" select="task" column="id">
  14. <id column="id" jdbcType="VARCHAR" property="id"/>
  15. <result column="task_name" jdbcType="VARCHAR" property="taskName"/>
  16. <result column="type" jdbcType="TINYINT" property="type"/>
  17. <result column="status" jdbcType="TINYINT" property="status"/>
  18. <result column="push_type" jdbcType="TINYINT" property="pushType"/>
  19. <result column="push_min" jdbcType="INTEGER" property="pushMin"/>
  20. <result column="push_day" jdbcType="INTEGER" property="pushDay"/>
  21. <result column="push_day_min" jdbcType="VARCHAR" property="pushDayMin"/>
  22. <result column="send_type" jdbcType="TINYINT" property="sendType"/>
  23. <result column="send_url_name" jdbcType="VARCHAR" property="sendUrlName"/>
  24. <result column="send_url" jdbcType="VARCHAR" property="sendUrl"/>
  25. <result column="send_file_name" jdbcType="VARCHAR" property="sendFileName"/>
  26. <result column="send_appid" jdbcType="VARCHAR" property="sendAppid"/>
  27. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  28. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  29. <collection property="tags" ofType="com.gree.mall.manager.plus.entity.Tag" select="tag" column="id">
  30. <id column="tag_id" jdbcType="VARCHAR" property="tagId"/>
  31. <result column="group_id" jdbcType="VARCHAR" property="groupId"/>
  32. <result column="group_name" jdbcType="VARCHAR" property="groupName"/>
  33. <result column="name" jdbcType="VARCHAR" property="name"/>
  34. <result column="sort_num" jdbcType="INTEGER" property="sortNum"/>
  35. <result column="deleted" jdbcType="BIT" property="deleted"/>
  36. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  37. <result column="company_wechat_id" jdbcType="VARCHAR" property="companyWechatId"/>
  38. <result column="company_name" jdbcType="VARCHAR" property="companyName"/>
  39. </collection>
  40. </collection>
  41. <collection property="enterpriseWechatWorkers" ofType="com.gree.mall.manager.plus.entity.EnterpriseWechatWorker"
  42. select="worker" column="id">
  43. <id column="id" jdbcType="INTEGER" property="id"/>
  44. <result column="wechat_user_id" jdbcType="VARCHAR" property="wechatUserId"/>
  45. <result column="name" jdbcType="VARCHAR" property="name"/>
  46. <result column="gender" jdbcType="INTEGER" property="gender"/>
  47. <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
  48. <result column="email" jdbcType="VARCHAR" property="email"/>
  49. <result column="main_department" jdbcType="VARCHAR" property="mainDepartment"/>
  50. <result column="department_name" jdbcType="VARCHAR" property="departmentName"/>
  51. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  52. <result column="config_id" jdbcType="VARCHAR" property="configId"/>
  53. <result column="qr_code2" jdbcType="VARCHAR" property="qrCode2"/>
  54. <result column="department_ids" jdbcType="VARCHAR" property="departmentIds"/>
  55. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  56. <result column="position" jdbcType="VARCHAR" property="position"/>
  57. <result column="corp_id" jdbcType="VARCHAR" property="corpId"/>
  58. </collection>
  59. </resultMap>
  60. <select id="list" resultMap="BaseResultMap">
  61. SELECT sr.*
  62. FROM sop_rule sr
  63. where 1=1
  64. <if test="id != null and id != ''">
  65. and sr.id =#{id}
  66. </if>
  67. <if test="ruleName != null and ruleName != ''">
  68. and sr.rule_name like concat('%',#{ruleName},'%')
  69. </if>
  70. <if test="status != null and status != ''">
  71. and sr.status = #{status}
  72. </if>
  73. <if test="companyWechatIds != null">
  74. and sr.company_wechat_id in
  75. <foreach collection="companyWechatIds" item="item" open="(" separator="," close=")" index="index">
  76. #{item}
  77. </foreach>
  78. </if>
  79. order by sr.create_time desc
  80. </select>
  81. <select id="task" resultType="com.gree.mall.manager.plus.entity.SopPushTask">
  82. SELECT spt.*
  83. FROM sop_rule_task srt
  84. LEFT JOIN sop_push_task spt ON spt.id = srt.task_id
  85. where srt.rule_id = #{id}
  86. </select>
  87. <select id="worker" resultType="com.gree.mall.manager.plus.entity.EnterpriseWechatWorker">
  88. SELECT
  89. eww.*
  90. FROM
  91. sop_rule_worker srw
  92. LEFT JOIN enterprise_wechat_worker eww ON eww.wechat_user_id = srw.wechat_user_id
  93. AND srw.corp_id = eww.corp_id
  94. where srw.rule_id = #{id}
  95. </select>
  96. <resultMap id="detailTaskMap" type="com.gree.mall.manager.bean.sop.SopPushTaskData">
  97. <id column="id" jdbcType="VARCHAR" property="id"/>
  98. <result column="task_name" jdbcType="VARCHAR" property="taskName"/>
  99. <result column="type" jdbcType="TINYINT" property="type"/>
  100. <result column="status" jdbcType="TINYINT" property="status"/>
  101. <result column="push_type" jdbcType="TINYINT" property="pushType"/>
  102. <result column="push_min" jdbcType="INTEGER" property="pushMin"/>
  103. <result column="push_day" jdbcType="INTEGER" property="pushDay"/>
  104. <result column="push_day_min" jdbcType="VARCHAR" property="pushDayMin"/>
  105. <result column="send_type" jdbcType="TINYINT" property="sendType"/>
  106. <result column="send_url_name" jdbcType="VARCHAR" property="sendUrlName"/>
  107. <result column="send_url" jdbcType="VARCHAR" property="sendUrl"/>
  108. <result column="send_file_name" jdbcType="VARCHAR" property="sendFileName"/>
  109. <result column="send_appid" jdbcType="VARCHAR" property="sendAppid"/>
  110. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  111. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  112. <collection property="tags" ofType="com.gree.mall.manager.plus.entity.Tag" select="tag" column="id">
  113. <id column="tag_id" jdbcType="VARCHAR" property="tagId"/>
  114. <result column="group_id" jdbcType="VARCHAR" property="groupId"/>
  115. <result column="group_name" jdbcType="VARCHAR" property="groupName"/>
  116. <result column="name" jdbcType="VARCHAR" property="name"/>
  117. <result column="sort_num" jdbcType="INTEGER" property="sortNum"/>
  118. <result column="deleted" jdbcType="BIT" property="deleted"/>
  119. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  120. <result column="company_wechat_id" jdbcType="VARCHAR" property="companyWechatId"/>
  121. <result column="company_name" jdbcType="VARCHAR" property="companyName"/>
  122. </collection>
  123. </resultMap>
  124. <select id="detailTask" resultMap="detailTaskMap">
  125. SELECT spt.*
  126. FROM
  127. sop_push_task spt
  128. where spt.id = #{id}
  129. </select>
  130. <select id="tag" resultType="com.gree.mall.manager.plus.entity.Tag">
  131. SELECT
  132. t.*
  133. FROM
  134. sop_push_task_tag ptt
  135. LEFT JOIN tag t ON ptt.tag_id = t.tag_id
  136. where ptt.task_id = #{id}
  137. </select>
  138. <select id="getTaskPush" resultMap="detailTaskMap">
  139. SELECT spt.*
  140. FROM sop_rule_task srt
  141. LEFT JOIN sop_push_task spt ON spt.id = srt.task_id
  142. where srt.rule_id = #{id}
  143. </select>
  144. </mapper>