UserMapper.xml 14 KB

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