UserChannelMapper.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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.UserChannelMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserChannel">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="uid" jdbcType="VARCHAR" property="uid" />
  12. <result column="aid" jdbcType="VARCHAR" property="aid" />
  13. <result column="status" jdbcType="INTEGER" property="status" />
  14. <result column="distribution_time" jdbcType="TIMESTAMP" property="distributionTime" />
  15. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  17. <result column="recovery" jdbcType="INTEGER" property="recovery" />
  18. </resultMap>
  19. <sql id="Base_Column_List">
  20. <!--
  21. WARNING - @mbg.generated
  22. This element is automatically generated by MyBatis Generator, do not modify.
  23. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  24. -->
  25. id, `uid`, aid, `status`, distribution_time, create_time, remarks, `recovery`
  26. </sql>
  27. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  28. <!--
  29. WARNING - @mbg.generated
  30. This element is automatically generated by MyBatis Generator, do not modify.
  31. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  32. -->
  33. select
  34. <include refid="Base_Column_List" />
  35. from user_channel
  36. where id = #{id,jdbcType=INTEGER}
  37. </select>
  38. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  39. <!--
  40. WARNING - @mbg.generated
  41. This element is automatically generated by MyBatis Generator, do not modify.
  42. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  43. -->
  44. delete from user_channel
  45. where id = #{id,jdbcType=INTEGER}
  46. </delete>
  47. <insert id="insert" parameterType="com.goafanti.common.model.UserChannel">
  48. <!--
  49. WARNING - @mbg.generated
  50. This element is automatically generated by MyBatis Generator, do not modify.
  51. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  52. -->
  53. insert into user_channel (id, `uid`, aid,
  54. `status`, distribution_time, create_time,
  55. remarks, `recovery`)
  56. values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  57. #{status,jdbcType=INTEGER}, #{distributionTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
  58. #{remarks,jdbcType=VARCHAR}, #{recovery,jdbcType=INTEGER})
  59. </insert>
  60. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserChannel">
  61. <!--
  62. WARNING - @mbg.generated
  63. This element is automatically generated by MyBatis Generator, do not modify.
  64. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  65. -->
  66. insert into user_channel
  67. <trim prefix="(" suffix=")" suffixOverrides=",">
  68. <if test="id != null">
  69. id,
  70. </if>
  71. <if test="uid != null">
  72. `uid`,
  73. </if>
  74. <if test="aid != null">
  75. aid,
  76. </if>
  77. <if test="status != null">
  78. `status`,
  79. </if>
  80. <if test="distributionTime != null">
  81. distribution_time,
  82. </if>
  83. <if test="createTime != null">
  84. create_time,
  85. </if>
  86. <if test="remarks != null">
  87. remarks,
  88. </if>
  89. <if test="recovery != null">
  90. `recovery`,
  91. </if>
  92. </trim>
  93. <trim prefix="values (" suffix=")" suffixOverrides=",">
  94. <if test="id != null">
  95. #{id,jdbcType=INTEGER},
  96. </if>
  97. <if test="uid != null">
  98. #{uid,jdbcType=VARCHAR},
  99. </if>
  100. <if test="aid != null">
  101. #{aid,jdbcType=VARCHAR},
  102. </if>
  103. <if test="status != null">
  104. #{status,jdbcType=INTEGER},
  105. </if>
  106. <if test="distributionTime != null">
  107. #{distributionTime,jdbcType=TIMESTAMP},
  108. </if>
  109. <if test="createTime != null">
  110. #{createTime,jdbcType=TIMESTAMP},
  111. </if>
  112. <if test="remarks != null">
  113. #{remarks,jdbcType=VARCHAR},
  114. </if>
  115. <if test="recovery != null">
  116. #{recovery,jdbcType=INTEGER},
  117. </if>
  118. </trim>
  119. </insert>
  120. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserChannel">
  121. <!--
  122. WARNING - @mbg.generated
  123. This element is automatically generated by MyBatis Generator, do not modify.
  124. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  125. -->
  126. update user_channel
  127. <set>
  128. <if test="uid != null">
  129. `uid` = #{uid,jdbcType=VARCHAR},
  130. </if>
  131. <if test="aid != null">
  132. aid = #{aid,jdbcType=VARCHAR},
  133. </if>
  134. <if test="status != null">
  135. `status` = #{status,jdbcType=INTEGER},
  136. </if>
  137. <if test="distributionTime != null">
  138. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  139. </if>
  140. <if test="createTime != null">
  141. create_time = #{createTime,jdbcType=TIMESTAMP},
  142. </if>
  143. <if test="remarks != null">
  144. remarks = #{remarks,jdbcType=VARCHAR},
  145. </if>
  146. <if test="recovery != null">
  147. `recovery` = #{recovery,jdbcType=INTEGER},
  148. </if>
  149. </set>
  150. where id = #{id,jdbcType=INTEGER}
  151. </update>
  152. <update id="updateByUid" parameterType="com.goafanti.common.model.UserChannel">
  153. update user_channel
  154. <set>
  155. <if test="aid != null">
  156. aid = #{aid,jdbcType=VARCHAR},
  157. </if>
  158. <if test="status != null">
  159. `status` = #{status,jdbcType=INTEGER},
  160. </if>
  161. <if test="distributionTime != null">
  162. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  163. </if>
  164. <if test="createTime != null">
  165. create_time = #{createTime,jdbcType=TIMESTAMP},
  166. </if>
  167. <if test="remarks != null">
  168. remarks = #{remarks,jdbcType=VARCHAR},
  169. </if>
  170. <if test="recovery != null">
  171. `recovery` = #{recovery,jdbcType=INTEGER},
  172. </if>
  173. </set>
  174. where uid = #{uid,jdbcType=VARCHAR} and status in (1,2)
  175. </update>
  176. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserChannel">
  177. <!--
  178. WARNING - @mbg.generated
  179. This element is automatically generated by MyBatis Generator, do not modify.
  180. This element was generated on Wed Apr 28 13:55:31 CST 2021.
  181. -->
  182. update user_channel
  183. set `uid` = #{uid,jdbcType=VARCHAR},
  184. aid = #{aid,jdbcType=VARCHAR},
  185. `status` = #{status,jdbcType=INTEGER},
  186. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  187. create_time = #{createTime,jdbcType=TIMESTAMP},
  188. remarks = #{remarks,jdbcType=VARCHAR},
  189. `recovery` = #{recovery,jdbcType=INTEGER}
  190. where id = #{id,jdbcType=INTEGER}
  191. </update>
  192. <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
  193. insert into user_channel ( `uid`, aid,
  194. `status`,remarks)VALUES
  195. <foreach collection="list" index="index" item="item" separator=",">
  196. (#{item.uid,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR},#{item.status},
  197. #{item.remarks})
  198. </foreach>
  199. </insert>
  200. <select id="selectByAidAndstatusList" resultType="com.goafanti.user.bo.OutUserChannel">
  201. select a.id,a.uid,b.nickname userName,a.aid,a.status,date_format(a.distribution_time,'%Y-%m-%d %H:%i:%S')distributionTimes,
  202. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes ,c.contacts ,c.contact_mobile contactMobile,a.remarks,
  203. b.society_tag societyTag ,d1.name province,d2.name city from user_channel a
  204. left join user b on a.uid=b.id left join organization_identity c on a.uid =c.uid
  205. left join district_glossory d1 on c.location_province =d1.id
  206. left join district_glossory d2 on c.location_city =d2.id
  207. where 1=1
  208. and a.status in (3,4,5,9)
  209. <if test="aid !=null">
  210. and a.aid= #{aid}
  211. </if>
  212. order by a.create_time desc
  213. <if test="page_sql != null">
  214. ${page_sql}
  215. </if>
  216. </select>
  217. <select id="selectByAidAndstatusCount" resultType="java.lang.Integer">
  218. select count(*) from user_channel a
  219. left join user b on a.uid=b.id left join organization_identity c on a.uid =c.uid
  220. left join district_glossory d1 on c.location_province =d1.id
  221. left join district_glossory d2 on c.location_city =d2.id
  222. where 1=1 and a.status in (3,4,5,9)
  223. <if test="aid !=null">
  224. and a.aid= #{aid}
  225. </if>
  226. </select>
  227. <update id="updateByuids">
  228. update user_channel set
  229. status = #{status}
  230. <if test="type == 2">
  231. ,recovery=1
  232. </if>
  233. <if test="date !=null">
  234. ,distribution_time= #{date}
  235. </if>
  236. <if test="maid !=null">
  237. ,maid= #{maid}
  238. </if>
  239. where 1=1
  240. <if test="type == 2">
  241. and status in (0,1,2)
  242. </if>
  243. <if test="type != 2">
  244. and status in (0,1,2,6)
  245. </if>
  246. and uid in(
  247. <foreach collection="list" index="index" item="item" separator=",">
  248. #{item}
  249. </foreach>
  250. )
  251. </update>
  252. <delete id="deleteByIds">
  253. delete from user_channel where id in (
  254. <foreach collection="list" index="index" item="item" separator=",">
  255. #{item}
  256. </foreach>
  257. )
  258. </delete>
  259. <delete id="deleteUser">
  260. delete user_channel ,user , organization_identity ,organization_contact_book
  261. from user_channel ,user , organization_identity ,organization_contact_book
  262. where user_channel.id in (
  263. <foreach collection="list" index="index" item="item" separator=",">
  264. #{item}
  265. </foreach>
  266. )
  267. and user_channel.uid =user.id and user.status =1
  268. and user.id=organization_identity.uid and user.id=organization_contact_book.uid
  269. </delete>
  270. <select id="checkRecovery" resultType="java.lang.String">
  271. select recovery from user_channel where uid in (
  272. <foreach collection="list" index="index" item="item" separator=",">
  273. #{item}
  274. </foreach>
  275. )
  276. </select>
  277. </mapper>