WeComUserMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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.tzld.piaoquan.growth.common.dao.mapper.WeComUserMapper">
  4. <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.WeComUser">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="corp_id" jdbcType="BIGINT" property="corpId" />
  7. <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId" />
  8. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  9. <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty" />
  10. <result column="type" jdbcType="INTEGER" property="type" />
  11. <result column="name" jdbcType="VARCHAR" property="name" />
  12. <result column="avatar" jdbcType="VARCHAR" property="avatar" />
  13. <result column="gender" jdbcType="INTEGER" property="gender" />
  14. <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  15. <result column="group_msg_disabled" jdbcType="TINYINT" property="groupMsgDisabled" />
  16. <result column="created_at" jdbcType="BIGINT" property="createdAt" />
  17. <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
  18. <result column="deleted_at" jdbcType="BIGINT" property="deletedAt" />
  19. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  20. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  21. </resultMap>
  22. <sql id="Example_Where_Clause">
  23. <where>
  24. <foreach collection="oredCriteria" item="criteria" separator="or">
  25. <if test="criteria.valid">
  26. <trim prefix="(" prefixOverrides="and" suffix=")">
  27. <foreach collection="criteria.criteria" item="criterion">
  28. <choose>
  29. <when test="criterion.noValue">
  30. and ${criterion.condition}
  31. </when>
  32. <when test="criterion.singleValue">
  33. and ${criterion.condition} #{criterion.value}
  34. </when>
  35. <when test="criterion.betweenValue">
  36. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  37. </when>
  38. <when test="criterion.listValue">
  39. and ${criterion.condition}
  40. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  41. #{listItem}
  42. </foreach>
  43. </when>
  44. </choose>
  45. </foreach>
  46. </trim>
  47. </if>
  48. </foreach>
  49. </where>
  50. </sql>
  51. <sql id="Update_By_Example_Where_Clause">
  52. <where>
  53. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  54. <if test="criteria.valid">
  55. <trim prefix="(" prefixOverrides="and" suffix=")">
  56. <foreach collection="criteria.criteria" item="criterion">
  57. <choose>
  58. <when test="criterion.noValue">
  59. and ${criterion.condition}
  60. </when>
  61. <when test="criterion.singleValue">
  62. and ${criterion.condition} #{criterion.value}
  63. </when>
  64. <when test="criterion.betweenValue">
  65. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  66. </when>
  67. <when test="criterion.listValue">
  68. and ${criterion.condition}
  69. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  70. #{listItem}
  71. </foreach>
  72. </when>
  73. </choose>
  74. </foreach>
  75. </trim>
  76. </if>
  77. </foreach>
  78. </where>
  79. </sql>
  80. <sql id="Base_Column_List">
  81. id, corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`,
  82. avatar, gender, is_delete, group_msg_disabled, created_at, updated_at, deleted_at,
  83. create_time, update_time
  84. </sql>
  85. <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultMap="BaseResultMap">
  86. select
  87. <if test="distinct">
  88. distinct
  89. </if>
  90. <include refid="Base_Column_List" />
  91. from we_com_user
  92. <if test="_parameter != null">
  93. <include refid="Example_Where_Clause" />
  94. </if>
  95. <if test="orderByClause != null">
  96. order by ${orderByClause}
  97. </if>
  98. <if test="page != null">
  99. limit #{page.offset} , #{page.pageSize}
  100. </if>
  101. </select>
  102. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  103. select
  104. <include refid="Base_Column_List" />
  105. from we_com_user
  106. where id = #{id,jdbcType=BIGINT}
  107. </select>
  108. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  109. delete from we_com_user
  110. where id = #{id,jdbcType=BIGINT}
  111. </delete>
  112. <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample">
  113. delete from we_com_user
  114. <if test="_parameter != null">
  115. <include refid="Example_Where_Clause" />
  116. </if>
  117. </delete>
  118. <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
  119. insert into we_com_user (id, corp_id, external_user_id,
  120. union_id, external_user_id_3rd_party, `type`,
  121. `name`, avatar, gender,
  122. is_delete, group_msg_disabled, created_at,
  123. updated_at, deleted_at, create_time,
  124. update_time)
  125. values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR},
  126. #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
  127. #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
  128. #{isDelete,jdbcType=INTEGER}, #{groupMsgDisabled,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT},
  129. #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
  130. #{updateTime,jdbcType=TIMESTAMP})
  131. <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
  132. select LAST_INSERT_ID()
  133. </selectKey>
  134. </insert>
  135. <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
  136. insert into we_com_user
  137. <trim prefix="(" suffix=")" suffixOverrides=",">
  138. <if test="id != null">
  139. id,
  140. </if>
  141. <if test="corpId != null">
  142. corp_id,
  143. </if>
  144. <if test="externalUserId != null">
  145. external_user_id,
  146. </if>
  147. <if test="unionId != null">
  148. union_id,
  149. </if>
  150. <if test="externalUserId3rdParty != null">
  151. external_user_id_3rd_party,
  152. </if>
  153. <if test="type != null">
  154. `type`,
  155. </if>
  156. <if test="name != null">
  157. `name`,
  158. </if>
  159. <if test="avatar != null">
  160. avatar,
  161. </if>
  162. <if test="gender != null">
  163. gender,
  164. </if>
  165. <if test="isDelete != null">
  166. is_delete,
  167. </if>
  168. <if test="groupMsgDisabled != null">
  169. group_msg_disabled,
  170. </if>
  171. <if test="createdAt != null">
  172. created_at,
  173. </if>
  174. <if test="updatedAt != null">
  175. updated_at,
  176. </if>
  177. <if test="deletedAt != null">
  178. deleted_at,
  179. </if>
  180. <if test="createTime != null">
  181. create_time,
  182. </if>
  183. <if test="updateTime != null">
  184. update_time,
  185. </if>
  186. </trim>
  187. <trim prefix="values (" suffix=")" suffixOverrides=",">
  188. <if test="id != null">
  189. #{id,jdbcType=BIGINT},
  190. </if>
  191. <if test="corpId != null">
  192. #{corpId,jdbcType=BIGINT},
  193. </if>
  194. <if test="externalUserId != null">
  195. #{externalUserId,jdbcType=VARCHAR},
  196. </if>
  197. <if test="unionId != null">
  198. #{unionId,jdbcType=VARCHAR},
  199. </if>
  200. <if test="externalUserId3rdParty != null">
  201. #{externalUserId3rdParty,jdbcType=VARCHAR},
  202. </if>
  203. <if test="type != null">
  204. #{type,jdbcType=INTEGER},
  205. </if>
  206. <if test="name != null">
  207. #{name,jdbcType=VARCHAR},
  208. </if>
  209. <if test="avatar != null">
  210. #{avatar,jdbcType=VARCHAR},
  211. </if>
  212. <if test="gender != null">
  213. #{gender,jdbcType=INTEGER},
  214. </if>
  215. <if test="isDelete != null">
  216. #{isDelete,jdbcType=INTEGER},
  217. </if>
  218. <if test="groupMsgDisabled != null">
  219. #{groupMsgDisabled,jdbcType=TINYINT},
  220. </if>
  221. <if test="createdAt != null">
  222. #{createdAt,jdbcType=BIGINT},
  223. </if>
  224. <if test="updatedAt != null">
  225. #{updatedAt,jdbcType=BIGINT},
  226. </if>
  227. <if test="deletedAt != null">
  228. #{deletedAt,jdbcType=BIGINT},
  229. </if>
  230. <if test="createTime != null">
  231. #{createTime,jdbcType=TIMESTAMP},
  232. </if>
  233. <if test="updateTime != null">
  234. #{updateTime,jdbcType=TIMESTAMP},
  235. </if>
  236. </trim>
  237. <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
  238. select LAST_INSERT_ID()
  239. </selectKey>
  240. </insert>
  241. <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultType="java.lang.Long">
  242. select count(*) from we_com_user
  243. <if test="_parameter != null">
  244. <include refid="Example_Where_Clause" />
  245. </if>
  246. </select>
  247. <update id="updateByExampleSelective" parameterType="map">
  248. update we_com_user
  249. <set>
  250. <if test="record.id != null">
  251. id = #{record.id,jdbcType=BIGINT},
  252. </if>
  253. <if test="record.corpId != null">
  254. corp_id = #{record.corpId,jdbcType=BIGINT},
  255. </if>
  256. <if test="record.externalUserId != null">
  257. external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
  258. </if>
  259. <if test="record.unionId != null">
  260. union_id = #{record.unionId,jdbcType=VARCHAR},
  261. </if>
  262. <if test="record.externalUserId3rdParty != null">
  263. external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
  264. </if>
  265. <if test="record.type != null">
  266. `type` = #{record.type,jdbcType=INTEGER},
  267. </if>
  268. <if test="record.name != null">
  269. `name` = #{record.name,jdbcType=VARCHAR},
  270. </if>
  271. <if test="record.avatar != null">
  272. avatar = #{record.avatar,jdbcType=VARCHAR},
  273. </if>
  274. <if test="record.gender != null">
  275. gender = #{record.gender,jdbcType=INTEGER},
  276. </if>
  277. <if test="record.isDelete != null">
  278. is_delete = #{record.isDelete,jdbcType=INTEGER},
  279. </if>
  280. <if test="record.groupMsgDisabled != null">
  281. group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
  282. </if>
  283. <if test="record.createdAt != null">
  284. created_at = #{record.createdAt,jdbcType=BIGINT},
  285. </if>
  286. <if test="record.updatedAt != null">
  287. updated_at = #{record.updatedAt,jdbcType=BIGINT},
  288. </if>
  289. <if test="record.deletedAt != null">
  290. deleted_at = #{record.deletedAt,jdbcType=BIGINT},
  291. </if>
  292. <if test="record.createTime != null">
  293. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  294. </if>
  295. <if test="record.updateTime != null">
  296. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  297. </if>
  298. </set>
  299. <if test="_parameter != null">
  300. <include refid="Update_By_Example_Where_Clause" />
  301. </if>
  302. </update>
  303. <update id="updateByExample" parameterType="map">
  304. update we_com_user
  305. set id = #{record.id,jdbcType=BIGINT},
  306. corp_id = #{record.corpId,jdbcType=BIGINT},
  307. external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
  308. union_id = #{record.unionId,jdbcType=VARCHAR},
  309. external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
  310. `type` = #{record.type,jdbcType=INTEGER},
  311. `name` = #{record.name,jdbcType=VARCHAR},
  312. avatar = #{record.avatar,jdbcType=VARCHAR},
  313. gender = #{record.gender,jdbcType=INTEGER},
  314. is_delete = #{record.isDelete,jdbcType=INTEGER},
  315. group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
  316. created_at = #{record.createdAt,jdbcType=BIGINT},
  317. updated_at = #{record.updatedAt,jdbcType=BIGINT},
  318. deleted_at = #{record.deletedAt,jdbcType=BIGINT},
  319. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  320. update_time = #{record.updateTime,jdbcType=TIMESTAMP}
  321. <if test="_parameter != null">
  322. <include refid="Update_By_Example_Where_Clause" />
  323. </if>
  324. </update>
  325. <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
  326. update we_com_user
  327. <set>
  328. <if test="corpId != null">
  329. corp_id = #{corpId,jdbcType=BIGINT},
  330. </if>
  331. <if test="externalUserId != null">
  332. external_user_id = #{externalUserId,jdbcType=VARCHAR},
  333. </if>
  334. <if test="unionId != null">
  335. union_id = #{unionId,jdbcType=VARCHAR},
  336. </if>
  337. <if test="externalUserId3rdParty != null">
  338. external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
  339. </if>
  340. <if test="type != null">
  341. `type` = #{type,jdbcType=INTEGER},
  342. </if>
  343. <if test="name != null">
  344. `name` = #{name,jdbcType=VARCHAR},
  345. </if>
  346. <if test="avatar != null">
  347. avatar = #{avatar,jdbcType=VARCHAR},
  348. </if>
  349. <if test="gender != null">
  350. gender = #{gender,jdbcType=INTEGER},
  351. </if>
  352. <if test="isDelete != null">
  353. is_delete = #{isDelete,jdbcType=INTEGER},
  354. </if>
  355. <if test="groupMsgDisabled != null">
  356. group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
  357. </if>
  358. <if test="createdAt != null">
  359. created_at = #{createdAt,jdbcType=BIGINT},
  360. </if>
  361. <if test="updatedAt != null">
  362. updated_at = #{updatedAt,jdbcType=BIGINT},
  363. </if>
  364. <if test="deletedAt != null">
  365. deleted_at = #{deletedAt,jdbcType=BIGINT},
  366. </if>
  367. <if test="createTime != null">
  368. create_time = #{createTime,jdbcType=TIMESTAMP},
  369. </if>
  370. <if test="updateTime != null">
  371. update_time = #{updateTime,jdbcType=TIMESTAMP},
  372. </if>
  373. </set>
  374. where id = #{id,jdbcType=BIGINT}
  375. </update>
  376. <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
  377. update we_com_user
  378. set corp_id = #{corpId,jdbcType=BIGINT},
  379. external_user_id = #{externalUserId,jdbcType=VARCHAR},
  380. union_id = #{unionId,jdbcType=VARCHAR},
  381. external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
  382. `type` = #{type,jdbcType=INTEGER},
  383. `name` = #{name,jdbcType=VARCHAR},
  384. avatar = #{avatar,jdbcType=VARCHAR},
  385. gender = #{gender,jdbcType=INTEGER},
  386. is_delete = #{isDelete,jdbcType=INTEGER},
  387. group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
  388. created_at = #{createdAt,jdbcType=BIGINT},
  389. updated_at = #{updatedAt,jdbcType=BIGINT},
  390. deleted_at = #{deletedAt,jdbcType=BIGINT},
  391. create_time = #{createTime,jdbcType=TIMESTAMP},
  392. update_time = #{updateTime,jdbcType=TIMESTAMP}
  393. where id = #{id,jdbcType=BIGINT}
  394. </update>
  395. <select id="selectIdByExternalUserId" parameterType="String" resultType="Long">
  396. select id
  397. from we_com_user
  398. where external_user_id = #{externalUserId}
  399. </select>
  400. <insert id="insertList" parameterType="java.util.List">
  401. insert into we_com_user
  402. (
  403. corp_id,
  404. external_user_id,
  405. union_id,
  406. external_user_id_3rd_party,
  407. `type`,
  408. `name`,
  409. avatar,
  410. gender,
  411. created_at,
  412. updated_at,
  413. deleted_at,
  414. create_time,
  415. update_time
  416. )
  417. values
  418. <foreach collection="list" item="item" separator=",">
  419. (
  420. #{item.corpId,jdbcType=BIGINT}
  421. #{item.externalUserId,jdbcType=VARCHAR},
  422. #{item.unionId,jdbcType=VARCHAR},
  423. #{item.externalUserId3rdParty,jdbcType=VARCHAR},
  424. #{item.type,jdbcType=INTEGER},
  425. #{item.name,jdbcType=VARCHAR},
  426. #{item.avatar,jdbcType=VARCHAR},
  427. #{item.gender,jdbcType=INTEGER},
  428. #{item.createdAt,jdbcType=BIGINT},
  429. #{item.updatedAt,jdbcType=BIGINT},
  430. #{item.deletedAt,jdbcType=BIGINT},
  431. #{item.createTime,jdbcType=TIMESTAMP},
  432. #{item.updateTime,jdbcType=TIMESTAMP}
  433. )
  434. </foreach>
  435. </insert>
  436. </mapper>