UserMapper.xml 17 KB

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