UserChannelMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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 Fri May 07 15:11:33 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. <result column="maid" jdbcType="VARCHAR" property="maid" />
  19. <result column="sign_time" jdbcType="TIMESTAMP" property="signTime" />
  20. <result column="province" jdbcType="VARCHAR" property="province" />
  21. <result column="city" jdbcType="VARCHAR" property="city" />
  22. <result column="society_tag" jdbcType="VARCHAR" property="societyTag" />
  23. <result column="contacts" jdbcType="VARCHAR" property="contacts" />
  24. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  25. </resultMap>
  26. <sql id="Base_Column_List">
  27. <!--
  28. WARNING - @mbg.generated
  29. This element is automatically generated by MyBatis Generator, do not modify.
  30. This element was generated on Fri May 07 15:11:33 CST 2021.
  31. -->
  32. id, `uid`, aid, `status`, distribution_time, create_time, remarks, `recovery`, maid,
  33. sign_time, province, city, society_tag, contacts, contact_mobile
  34. </sql>
  35. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  36. <!--
  37. WARNING - @mbg.generated
  38. This element is automatically generated by MyBatis Generator, do not modify.
  39. This element was generated on Fri May 07 15:11:33 CST 2021.
  40. -->
  41. select
  42. <include refid="Base_Column_List" />
  43. from user_channel
  44. where id = #{id,jdbcType=INTEGER}
  45. </select>
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  47. <!--
  48. WARNING - @mbg.generated
  49. This element is automatically generated by MyBatis Generator, do not modify.
  50. This element was generated on Fri May 07 15:11:33 CST 2021.
  51. -->
  52. delete from user_channel
  53. where id = #{id,jdbcType=INTEGER}
  54. </delete>
  55. <insert id="insert" parameterType="com.goafanti.common.model.UserChannel">
  56. <!--
  57. WARNING - @mbg.generated
  58. This element is automatically generated by MyBatis Generator, do not modify.
  59. This element was generated on Fri May 07 15:11:33 CST 2021.
  60. -->
  61. insert into user_channel (id, `uid`, aid,
  62. `status`, distribution_time, create_time,
  63. remarks, `recovery`, maid,
  64. sign_time, province, city,
  65. society_tag, contacts, contact_mobile
  66. )
  67. values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  68. #{status,jdbcType=INTEGER}, #{distributionTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
  69. #{remarks,jdbcType=VARCHAR}, #{recovery,jdbcType=INTEGER}, #{maid,jdbcType=VARCHAR},
  70. #{signTime,jdbcType=TIMESTAMP}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR},
  71. #{societyTag,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}
  72. )
  73. </insert>
  74. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserChannel">
  75. <!--
  76. WARNING - @mbg.generated
  77. This element is automatically generated by MyBatis Generator, do not modify.
  78. This element was generated on Fri May 07 15:11:33 CST 2021.
  79. -->
  80. insert into user_channel
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="id != null">
  83. id,
  84. </if>
  85. <if test="uid != null">
  86. `uid`,
  87. </if>
  88. <if test="aid != null">
  89. aid,
  90. </if>
  91. <if test="status != null">
  92. `status`,
  93. </if>
  94. <if test="distributionTime != null">
  95. distribution_time,
  96. </if>
  97. <if test="createTime != null">
  98. create_time,
  99. </if>
  100. <if test="remarks != null">
  101. remarks,
  102. </if>
  103. <if test="recovery != null">
  104. `recovery`,
  105. </if>
  106. <if test="maid != null">
  107. maid,
  108. </if>
  109. <if test="signTime != null">
  110. sign_time,
  111. </if>
  112. <if test="province != null">
  113. province,
  114. </if>
  115. <if test="city != null">
  116. city,
  117. </if>
  118. <if test="societyTag != null">
  119. society_tag,
  120. </if>
  121. <if test="contacts != null">
  122. contacts,
  123. </if>
  124. <if test="contactMobile != null">
  125. contact_mobile,
  126. </if>
  127. </trim>
  128. <trim prefix="values (" suffix=")" suffixOverrides=",">
  129. <if test="id != null">
  130. #{id,jdbcType=INTEGER},
  131. </if>
  132. <if test="uid != null">
  133. #{uid,jdbcType=VARCHAR},
  134. </if>
  135. <if test="aid != null">
  136. #{aid,jdbcType=VARCHAR},
  137. </if>
  138. <if test="status != null">
  139. #{status,jdbcType=INTEGER},
  140. </if>
  141. <if test="distributionTime != null">
  142. #{distributionTime,jdbcType=TIMESTAMP},
  143. </if>
  144. <if test="createTime != null">
  145. #{createTime,jdbcType=TIMESTAMP},
  146. </if>
  147. <if test="remarks != null">
  148. #{remarks,jdbcType=VARCHAR},
  149. </if>
  150. <if test="recovery != null">
  151. #{recovery,jdbcType=INTEGER},
  152. </if>
  153. <if test="maid != null">
  154. #{maid,jdbcType=VARCHAR},
  155. </if>
  156. <if test="signTime != null">
  157. #{signTime,jdbcType=TIMESTAMP},
  158. </if>
  159. <if test="province != null">
  160. #{province,jdbcType=VARCHAR},
  161. </if>
  162. <if test="city != null">
  163. #{city,jdbcType=VARCHAR},
  164. </if>
  165. <if test="societyTag != null">
  166. #{societyTag,jdbcType=VARCHAR},
  167. </if>
  168. <if test="contacts != null">
  169. #{contacts,jdbcType=VARCHAR},
  170. </if>
  171. <if test="contactMobile != null">
  172. #{contactMobile,jdbcType=VARCHAR},
  173. </if>
  174. </trim>
  175. </insert>
  176. <update id="updateByPrimaryKeySelective" 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 Fri May 07 15:11:33 CST 2021.
  181. -->
  182. update user_channel
  183. <set>
  184. <if test="uid != null">
  185. `uid` = #{uid,jdbcType=VARCHAR},
  186. </if>
  187. <if test="aid != null">
  188. aid = #{aid,jdbcType=VARCHAR},
  189. </if>
  190. <if test="status != null">
  191. `status` = #{status,jdbcType=INTEGER},
  192. </if>
  193. <if test="distributionTime != null">
  194. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  195. </if>
  196. <if test="createTime != null">
  197. create_time = #{createTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="remarks != null">
  200. remarks = #{remarks,jdbcType=VARCHAR},
  201. </if>
  202. <if test="recovery != null">
  203. `recovery` = #{recovery,jdbcType=INTEGER},
  204. </if>
  205. <if test="maid != null">
  206. maid = #{maid,jdbcType=VARCHAR},
  207. </if>
  208. <if test="signTime != null">
  209. sign_time = #{signTime,jdbcType=TIMESTAMP},
  210. </if>
  211. <if test="province != null">
  212. province = #{province,jdbcType=VARCHAR},
  213. </if>
  214. <if test="city != null">
  215. city = #{city,jdbcType=VARCHAR},
  216. </if>
  217. <if test="societyTag != null">
  218. society_tag = #{societyTag,jdbcType=VARCHAR},
  219. </if>
  220. <if test="contacts != null">
  221. contacts = #{contacts,jdbcType=VARCHAR},
  222. </if>
  223. <if test="contactMobile != null">
  224. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  225. </if>
  226. </set>
  227. where id = #{id,jdbcType=INTEGER}
  228. </update>
  229. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserChannel">
  230. <!--
  231. WARNING - @mbg.generated
  232. This element is automatically generated by MyBatis Generator, do not modify.
  233. This element was generated on Fri May 07 15:11:33 CST 2021.
  234. -->
  235. update user_channel
  236. set `uid` = #{uid,jdbcType=VARCHAR},
  237. aid = #{aid,jdbcType=VARCHAR},
  238. `status` = #{status,jdbcType=INTEGER},
  239. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  240. create_time = #{createTime,jdbcType=TIMESTAMP},
  241. remarks = #{remarks,jdbcType=VARCHAR},
  242. `recovery` = #{recovery,jdbcType=INTEGER},
  243. maid = #{maid,jdbcType=VARCHAR},
  244. sign_time = #{signTime,jdbcType=TIMESTAMP},
  245. province = #{province,jdbcType=VARCHAR},
  246. city = #{city,jdbcType=VARCHAR},
  247. society_tag = #{societyTag,jdbcType=VARCHAR},
  248. contacts = #{contacts,jdbcType=VARCHAR},
  249. contact_mobile = #{contactMobile,jdbcType=VARCHAR}
  250. where id = #{id,jdbcType=INTEGER}
  251. </update>
  252. <update id="updateByUid" parameterType="com.goafanti.common.model.UserChannel">
  253. update user_channel
  254. <set>
  255. <if test="aid != null">
  256. aid = #{aid,jdbcType=VARCHAR},
  257. </if>
  258. <if test="status != null">
  259. `status` = #{status,jdbcType=INTEGER},
  260. </if>
  261. <if test="distributionTime != null">
  262. distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
  263. </if>
  264. <if test="createTime != null">
  265. create_time = #{createTime,jdbcType=TIMESTAMP},
  266. </if>
  267. <if test="remarks != null">
  268. remarks = #{remarks,jdbcType=VARCHAR},
  269. </if>
  270. <if test="recovery != null">
  271. `recovery` = #{recovery,jdbcType=INTEGER},
  272. </if>
  273. <if test="signTime != null ">
  274. sign_time = #{signTime,jdbcType=TIMESTAMP},
  275. </if>
  276. </set>
  277. where uid = #{uid,jdbcType=VARCHAR} and status in (1,2)
  278. </update>
  279. <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
  280. insert into user_channel ( `uid`, aid,
  281. `status`,remarks,province,city,society_tag,contacts,contact_mobile)VALUES
  282. <foreach collection="list" index="index" item="item" separator=",">
  283. (#{item.uid,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR},#{item.status},
  284. #{item.remarks},#{item.provinces},#{item.citys},#{item.societyTags},
  285. #{item.contacts},#{item.contactMobile})
  286. </foreach>
  287. </insert>
  288. <select id="selectByAidAndstatusList" resultType="com.goafanti.user.bo.OutUserChannel">
  289. select a.id,a.uid,b.nickname userName,a.aid,a.status,date_format(a.distribution_time,'%Y-%m-%d %H:%i:%S')distributionTimes,
  290. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes ,a.contacts ,a.contact_mobile contactMobile,a.remarks,
  291. a.society_tag societyTag ,a.province,a.city from user_channel a
  292. left join user b on a.uid=b.id
  293. where 1=1
  294. and a.status in (3,4,5,9,10,11,12,13)
  295. <if test="aid !=null">
  296. and a.aid= #{aid}
  297. </if>
  298. order by a.create_time desc
  299. <if test="page_sql != null">
  300. ${page_sql}
  301. </if>
  302. </select>
  303. <select id="selectByAidAndstatusCount" resultType="java.lang.Integer">
  304. select count(*) from user_channel a
  305. left join user b on a.uid=b.id left join organization_identity c on a.uid =c.uid
  306. left join district_glossory d1 on c.location_province =d1.id
  307. left join district_glossory d2 on c.location_city =d2.id
  308. where 1=1 and a.status in (3,4,5,9,10,11,12,13)
  309. <if test="aid !=null">
  310. and a.aid= #{aid}
  311. </if>
  312. </select>
  313. <update id="updateByuids">
  314. update user_channel set
  315. status = #{status}
  316. <if test="type == 2">
  317. ,recovery=1
  318. </if>
  319. <if test="date !=null">
  320. ,distribution_time= #{date}
  321. </if>
  322. <if test="maid !=null">
  323. ,maid= #{maid}
  324. </if>
  325. where 1=1
  326. <if test="type == 2">
  327. and status in (0,1,2)
  328. </if>
  329. <if test="type != 2">
  330. and status in (0,1,2,6)
  331. </if>
  332. and uid in(
  333. <foreach collection="list" index="index" item="item" separator=",">
  334. #{item}
  335. </foreach>
  336. )
  337. </update>
  338. <delete id="deleteByIds">
  339. delete from user_channel where id in (
  340. <foreach collection="list" index="index" item="item" separator=",">
  341. #{item}
  342. </foreach>
  343. )
  344. </delete>
  345. <delete id="deleteUser">
  346. delete user_channel ,user , organization_identity ,organization_contact_book
  347. from user_channel ,user , organization_identity ,organization_contact_book
  348. where user_channel.id in (
  349. <foreach collection="list" index="index" item="item" separator=",">
  350. #{item}
  351. </foreach>
  352. )
  353. and user_channel.uid =user.id and user.status =1
  354. and user.id=organization_identity.uid and user.id=organization_contact_book.uid
  355. </delete>
  356. <select id="checkRecovery" resultType="java.lang.String">
  357. select recovery from user_channel where uid in (
  358. <foreach collection="list" index="index" item="item" separator=",">
  359. #{item}
  360. </foreach>
  361. )
  362. </select>
  363. <select id="selectByUid" resultMap="BaseResultMap">
  364. select
  365. <include refid="Base_Column_List" />
  366. from user_channel
  367. where uid = #{id}
  368. </select>
  369. </mapper>