UserMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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="cn.kdan.cloud.pdf.office.account.mapper.UserMapper">
  4. <resultMap id="BaseResultMap" type="cn.kdan.cloud.pdf.office.account.model.User">
  5. <id column="id" jdbcType="VARCHAR" property="id" />
  6. <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  7. <result column="app_id" jdbcType="VARCHAR" property="appId" />
  8. <result column="email" jdbcType="VARCHAR" property="email" />
  9. <result column="full_name" jdbcType="VARCHAR" property="fullName" />
  10. <result column="subscriber_type" jdbcType="INTEGER" property="subscriberType" />
  11. <result column="subscribed" jdbcType="INTEGER" property="subscribed" />
  12. <result column="digest_password" jdbcType="VARCHAR" property="digestPassword" />
  13. <result column="phone" jdbcType="VARCHAR" property="phone" />
  14. <result column="industry" jdbcType="VARCHAR" property="industry" />
  15. <result column="last_popularize_at" jdbcType="INTEGER" property="lastPopularizeAt" />
  16. <result column="last_presented_coupon_at" jdbcType="TIMESTAMP" property="lastPresentedCouponAt" />
  17. <result column="mailable" jdbcType="INTEGER" property="mailable" />
  18. <result column="reset_token" jdbcType="INTEGER" property="resetToken" />
  19. <result column="role" jdbcType="VARCHAR" property="role" />
  20. <result column="job" jdbcType="VARCHAR" property="job" />
  21. <result column="area" jdbcType="VARCHAR" property="area" />
  22. <result column="platform_type" jdbcType="TINYINT" property="platformType" />
  23. <result column="account_type" jdbcType="TINYINT" property="accountType" />
  24. <result column="account_source" jdbcType="TINYINT" property="accountSource" />
  25. <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
  26. <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
  27. <result column="remark" jdbcType="VARCHAR" property="remark" />
  28. <result column="valid_flag" jdbcType="VARCHAR" property="validFlag" />
  29. </resultMap>
  30. <sql id="Example_Where_Clause">
  31. <where>
  32. <foreach collection="oredCriteria" item="criteria" separator="or">
  33. <if test="criteria.valid">
  34. <trim prefix="(" prefixOverrides="and" suffix=")">
  35. <foreach collection="criteria.criteria" item="criterion">
  36. <choose>
  37. <when test="criterion.noValue">
  38. and ${criterion.condition}
  39. </when>
  40. <when test="criterion.singleValue">
  41. and ${criterion.condition} #{criterion.value}
  42. </when>
  43. <when test="criterion.betweenValue">
  44. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  45. </when>
  46. <when test="criterion.listValue">
  47. and ${criterion.condition}
  48. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  49. #{listItem}
  50. </foreach>
  51. </when>
  52. </choose>
  53. </foreach>
  54. </trim>
  55. </if>
  56. </foreach>
  57. </where>
  58. </sql>
  59. <sql id="Update_By_Example_Where_Clause">
  60. <where>
  61. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  62. <if test="criteria.valid">
  63. <trim prefix="(" prefixOverrides="and" suffix=")">
  64. <foreach collection="criteria.criteria" item="criterion">
  65. <choose>
  66. <when test="criterion.noValue">
  67. and ${criterion.condition}
  68. </when>
  69. <when test="criterion.singleValue">
  70. and ${criterion.condition} #{criterion.value}
  71. </when>
  72. <when test="criterion.betweenValue">
  73. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  74. </when>
  75. <when test="criterion.listValue">
  76. and ${criterion.condition}
  77. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  78. #{listItem}
  79. </foreach>
  80. </when>
  81. </choose>
  82. </foreach>
  83. </trim>
  84. </if>
  85. </foreach>
  86. </where>
  87. </sql>
  88. <sql id="Base_Column_List">
  89. id, company_id, app_id, email, full_name, subscriber_type, subscribed, digest_password,
  90. phone, industry, last_popularize_at, last_presented_coupon_at, mailable, reset_token,
  91. `role`, job, area, platform_type, account_type, account_source, created_at, updated_at,
  92. remark, valid_flag
  93. </sql>
  94. <select id="selectByExample" parameterType="cn.kdan.cloud.pdf.office.account.model.UserExample" resultMap="BaseResultMap">
  95. select
  96. <if test="distinct">
  97. distinct
  98. </if>
  99. <include refid="Base_Column_List" />
  100. from user
  101. <if test="_parameter != null">
  102. <include refid="Example_Where_Clause" />
  103. </if>
  104. <if test="orderByClause != null">
  105. order by ${orderByClause}
  106. </if>
  107. </select>
  108. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  109. select
  110. <include refid="Base_Column_List" />
  111. from user
  112. where id = #{id,jdbcType=VARCHAR}
  113. </select>
  114. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  115. delete from user
  116. where id = #{id,jdbcType=VARCHAR}
  117. </delete>
  118. <delete id="deleteByExample" parameterType="cn.kdan.cloud.pdf.office.account.model.UserExample">
  119. delete from user
  120. <if test="_parameter != null">
  121. <include refid="Example_Where_Clause" />
  122. </if>
  123. </delete>
  124. <insert id="insert" parameterType="cn.kdan.cloud.pdf.office.account.model.User">
  125. insert into user (id, company_id, app_id,
  126. email, full_name, subscriber_type,
  127. subscribed, digest_password, phone,
  128. industry, last_popularize_at, last_presented_coupon_at,
  129. mailable, reset_token, `role`,
  130. job, area, platform_type,
  131. account_type, account_source, created_at,
  132. updated_at, remark, valid_flag
  133. )
  134. values (#{id,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR},
  135. #{email,jdbcType=VARCHAR}, #{fullName,jdbcType=VARCHAR}, #{subscriberType,jdbcType=INTEGER},
  136. #{subscribed,jdbcType=INTEGER}, #{digestPassword,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
  137. #{industry,jdbcType=VARCHAR}, #{lastPopularizeAt,jdbcType=INTEGER}, #{lastPresentedCouponAt,jdbcType=TIMESTAMP},
  138. #{mailable,jdbcType=INTEGER}, #{resetToken,jdbcType=INTEGER}, #{role,jdbcType=VARCHAR},
  139. #{job,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR}, #{platformType,jdbcType=TINYINT},
  140. #{accountType,jdbcType=TINYINT}, #{accountSource,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP},
  141. #{updatedAt,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{validFlag,jdbcType=VARCHAR}
  142. )
  143. </insert>
  144. <insert id="insertSelective" parameterType="cn.kdan.cloud.pdf.office.account.model.User">
  145. insert into user
  146. <trim prefix="(" suffix=")" suffixOverrides=",">
  147. <if test="id != null">
  148. id,
  149. </if>
  150. <if test="companyId != null">
  151. company_id,
  152. </if>
  153. <if test="appId != null">
  154. app_id,
  155. </if>
  156. <if test="email != null">
  157. email,
  158. </if>
  159. <if test="fullName != null">
  160. full_name,
  161. </if>
  162. <if test="subscriberType != null">
  163. subscriber_type,
  164. </if>
  165. <if test="subscribed != null">
  166. subscribed,
  167. </if>
  168. <if test="digestPassword != null">
  169. digest_password,
  170. </if>
  171. <if test="phone != null">
  172. phone,
  173. </if>
  174. <if test="industry != null">
  175. industry,
  176. </if>
  177. <if test="lastPopularizeAt != null">
  178. last_popularize_at,
  179. </if>
  180. <if test="lastPresentedCouponAt != null">
  181. last_presented_coupon_at,
  182. </if>
  183. <if test="mailable != null">
  184. mailable,
  185. </if>
  186. <if test="resetToken != null">
  187. reset_token,
  188. </if>
  189. <if test="role != null">
  190. `role`,
  191. </if>
  192. <if test="job != null">
  193. job,
  194. </if>
  195. <if test="area != null">
  196. area,
  197. </if>
  198. <if test="platformType != null">
  199. platform_type,
  200. </if>
  201. <if test="accountType != null">
  202. account_type,
  203. </if>
  204. <if test="accountSource != null">
  205. account_source,
  206. </if>
  207. <if test="createdAt != null">
  208. created_at,
  209. </if>
  210. <if test="updatedAt != null">
  211. updated_at,
  212. </if>
  213. <if test="remark != null">
  214. remark,
  215. </if>
  216. <if test="validFlag != null">
  217. valid_flag,
  218. </if>
  219. </trim>
  220. <trim prefix="values (" suffix=")" suffixOverrides=",">
  221. <if test="id != null">
  222. #{id,jdbcType=VARCHAR},
  223. </if>
  224. <if test="companyId != null">
  225. #{companyId,jdbcType=VARCHAR},
  226. </if>
  227. <if test="appId != null">
  228. #{appId,jdbcType=VARCHAR},
  229. </if>
  230. <if test="email != null">
  231. #{email,jdbcType=VARCHAR},
  232. </if>
  233. <if test="fullName != null">
  234. #{fullName,jdbcType=VARCHAR},
  235. </if>
  236. <if test="subscriberType != null">
  237. #{subscriberType,jdbcType=INTEGER},
  238. </if>
  239. <if test="subscribed != null">
  240. #{subscribed,jdbcType=INTEGER},
  241. </if>
  242. <if test="digestPassword != null">
  243. #{digestPassword,jdbcType=VARCHAR},
  244. </if>
  245. <if test="phone != null">
  246. #{phone,jdbcType=VARCHAR},
  247. </if>
  248. <if test="industry != null">
  249. #{industry,jdbcType=VARCHAR},
  250. </if>
  251. <if test="lastPopularizeAt != null">
  252. #{lastPopularizeAt,jdbcType=INTEGER},
  253. </if>
  254. <if test="lastPresentedCouponAt != null">
  255. #{lastPresentedCouponAt,jdbcType=TIMESTAMP},
  256. </if>
  257. <if test="mailable != null">
  258. #{mailable,jdbcType=INTEGER},
  259. </if>
  260. <if test="resetToken != null">
  261. #{resetToken,jdbcType=INTEGER},
  262. </if>
  263. <if test="role != null">
  264. #{role,jdbcType=VARCHAR},
  265. </if>
  266. <if test="job != null">
  267. #{job,jdbcType=VARCHAR},
  268. </if>
  269. <if test="area != null">
  270. #{area,jdbcType=VARCHAR},
  271. </if>
  272. <if test="platformType != null">
  273. #{platformType,jdbcType=TINYINT},
  274. </if>
  275. <if test="accountType != null">
  276. #{accountType,jdbcType=TINYINT},
  277. </if>
  278. <if test="accountSource != null">
  279. #{accountSource,jdbcType=TINYINT},
  280. </if>
  281. <if test="createdAt != null">
  282. #{createdAt,jdbcType=TIMESTAMP},
  283. </if>
  284. <if test="updatedAt != null">
  285. #{updatedAt,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="remark != null">
  288. #{remark,jdbcType=VARCHAR},
  289. </if>
  290. <if test="validFlag != null">
  291. #{validFlag,jdbcType=VARCHAR},
  292. </if>
  293. </trim>
  294. </insert>
  295. <select id="countByExample" parameterType="cn.kdan.cloud.pdf.office.account.model.UserExample" resultType="java.lang.Long">
  296. select count(*) from user
  297. <if test="_parameter != null">
  298. <include refid="Example_Where_Clause" />
  299. </if>
  300. </select>
  301. <update id="updateByExampleSelective" parameterType="map">
  302. update user
  303. <set>
  304. <if test="record.id != null">
  305. id = #{record.id,jdbcType=VARCHAR},
  306. </if>
  307. <if test="record.companyId != null">
  308. company_id = #{record.companyId,jdbcType=VARCHAR},
  309. </if>
  310. <if test="record.appId != null">
  311. app_id = #{record.appId,jdbcType=VARCHAR},
  312. </if>
  313. <if test="record.email != null">
  314. email = #{record.email,jdbcType=VARCHAR},
  315. </if>
  316. <if test="record.fullName != null">
  317. full_name = #{record.fullName,jdbcType=VARCHAR},
  318. </if>
  319. <if test="record.subscriberType != null">
  320. subscriber_type = #{record.subscriberType,jdbcType=INTEGER},
  321. </if>
  322. <if test="record.subscribed != null">
  323. subscribed = #{record.subscribed,jdbcType=INTEGER},
  324. </if>
  325. <if test="record.digestPassword != null">
  326. digest_password = #{record.digestPassword,jdbcType=VARCHAR},
  327. </if>
  328. <if test="record.phone != null">
  329. phone = #{record.phone,jdbcType=VARCHAR},
  330. </if>
  331. <if test="record.industry != null">
  332. industry = #{record.industry,jdbcType=VARCHAR},
  333. </if>
  334. <if test="record.lastPopularizeAt != null">
  335. last_popularize_at = #{record.lastPopularizeAt,jdbcType=INTEGER},
  336. </if>
  337. <if test="record.lastPresentedCouponAt != null">
  338. last_presented_coupon_at = #{record.lastPresentedCouponAt,jdbcType=TIMESTAMP},
  339. </if>
  340. <if test="record.mailable != null">
  341. mailable = #{record.mailable,jdbcType=INTEGER},
  342. </if>
  343. <if test="record.resetToken != null">
  344. reset_token = #{record.resetToken,jdbcType=INTEGER},
  345. </if>
  346. <if test="record.role != null">
  347. `role` = #{record.role,jdbcType=VARCHAR},
  348. </if>
  349. <if test="record.job != null">
  350. job = #{record.job,jdbcType=VARCHAR},
  351. </if>
  352. <if test="record.area != null">
  353. area = #{record.area,jdbcType=VARCHAR},
  354. </if>
  355. <if test="record.platformType != null">
  356. platform_type = #{record.platformType,jdbcType=TINYINT},
  357. </if>
  358. <if test="record.accountType != null">
  359. account_type = #{record.accountType,jdbcType=TINYINT},
  360. </if>
  361. <if test="record.accountSource != null">
  362. account_source = #{record.accountSource,jdbcType=TINYINT},
  363. </if>
  364. <if test="record.createdAt != null">
  365. created_at = #{record.createdAt,jdbcType=TIMESTAMP},
  366. </if>
  367. <if test="record.updatedAt != null">
  368. updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
  369. </if>
  370. <if test="record.remark != null">
  371. remark = #{record.remark,jdbcType=VARCHAR},
  372. </if>
  373. <if test="record.validFlag != null">
  374. valid_flag = #{record.validFlag,jdbcType=VARCHAR},
  375. </if>
  376. </set>
  377. <if test="_parameter != null">
  378. <include refid="Update_By_Example_Where_Clause" />
  379. </if>
  380. </update>
  381. <update id="updateByExample" parameterType="map">
  382. update user
  383. set id = #{record.id,jdbcType=VARCHAR},
  384. company_id = #{record.companyId,jdbcType=VARCHAR},
  385. app_id = #{record.appId,jdbcType=VARCHAR},
  386. email = #{record.email,jdbcType=VARCHAR},
  387. full_name = #{record.fullName,jdbcType=VARCHAR},
  388. subscriber_type = #{record.subscriberType,jdbcType=INTEGER},
  389. subscribed = #{record.subscribed,jdbcType=INTEGER},
  390. digest_password = #{record.digestPassword,jdbcType=VARCHAR},
  391. phone = #{record.phone,jdbcType=VARCHAR},
  392. industry = #{record.industry,jdbcType=VARCHAR},
  393. last_popularize_at = #{record.lastPopularizeAt,jdbcType=INTEGER},
  394. last_presented_coupon_at = #{record.lastPresentedCouponAt,jdbcType=TIMESTAMP},
  395. mailable = #{record.mailable,jdbcType=INTEGER},
  396. reset_token = #{record.resetToken,jdbcType=INTEGER},
  397. `role` = #{record.role,jdbcType=VARCHAR},
  398. job = #{record.job,jdbcType=VARCHAR},
  399. area = #{record.area,jdbcType=VARCHAR},
  400. platform_type = #{record.platformType,jdbcType=TINYINT},
  401. account_type = #{record.accountType,jdbcType=TINYINT},
  402. account_source = #{record.accountSource,jdbcType=TINYINT},
  403. created_at = #{record.createdAt,jdbcType=TIMESTAMP},
  404. updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
  405. remark = #{record.remark,jdbcType=VARCHAR},
  406. valid_flag = #{record.validFlag,jdbcType=VARCHAR}
  407. <if test="_parameter != null">
  408. <include refid="Update_By_Example_Where_Clause" />
  409. </if>
  410. </update>
  411. <update id="updateByPrimaryKeySelective" parameterType="cn.kdan.cloud.pdf.office.account.model.User">
  412. update user
  413. <set>
  414. <if test="companyId != null">
  415. company_id = #{companyId,jdbcType=VARCHAR},
  416. </if>
  417. <if test="appId != null">
  418. app_id = #{appId,jdbcType=VARCHAR},
  419. </if>
  420. <if test="email != null">
  421. email = #{email,jdbcType=VARCHAR},
  422. </if>
  423. <if test="fullName != null">
  424. full_name = #{fullName,jdbcType=VARCHAR},
  425. </if>
  426. <if test="subscriberType != null">
  427. subscriber_type = #{subscriberType,jdbcType=INTEGER},
  428. </if>
  429. <if test="subscribed != null">
  430. subscribed = #{subscribed,jdbcType=INTEGER},
  431. </if>
  432. <if test="digestPassword != null">
  433. digest_password = #{digestPassword,jdbcType=VARCHAR},
  434. </if>
  435. <if test="phone != null">
  436. phone = #{phone,jdbcType=VARCHAR},
  437. </if>
  438. <if test="industry != null">
  439. industry = #{industry,jdbcType=VARCHAR},
  440. </if>
  441. <if test="lastPopularizeAt != null">
  442. last_popularize_at = #{lastPopularizeAt,jdbcType=INTEGER},
  443. </if>
  444. <if test="lastPresentedCouponAt != null">
  445. last_presented_coupon_at = #{lastPresentedCouponAt,jdbcType=TIMESTAMP},
  446. </if>
  447. <if test="mailable != null">
  448. mailable = #{mailable,jdbcType=INTEGER},
  449. </if>
  450. <if test="resetToken != null">
  451. reset_token = #{resetToken,jdbcType=INTEGER},
  452. </if>
  453. <if test="role != null">
  454. `role` = #{role,jdbcType=VARCHAR},
  455. </if>
  456. <if test="job != null">
  457. job = #{job,jdbcType=VARCHAR},
  458. </if>
  459. <if test="area != null">
  460. area = #{area,jdbcType=VARCHAR},
  461. </if>
  462. <if test="platformType != null">
  463. platform_type = #{platformType,jdbcType=TINYINT},
  464. </if>
  465. <if test="accountType != null">
  466. account_type = #{accountType,jdbcType=TINYINT},
  467. </if>
  468. <if test="accountSource != null">
  469. account_source = #{accountSource,jdbcType=TINYINT},
  470. </if>
  471. <if test="createdAt != null">
  472. created_at = #{createdAt,jdbcType=TIMESTAMP},
  473. </if>
  474. <if test="updatedAt != null">
  475. updated_at = #{updatedAt,jdbcType=TIMESTAMP},
  476. </if>
  477. <if test="remark != null">
  478. remark = #{remark,jdbcType=VARCHAR},
  479. </if>
  480. <if test="validFlag != null">
  481. valid_flag = #{validFlag,jdbcType=VARCHAR},
  482. </if>
  483. </set>
  484. where id = #{id,jdbcType=VARCHAR}
  485. </update>
  486. <update id="updateByPrimaryKey" parameterType="cn.kdan.cloud.pdf.office.account.model.User">
  487. update user
  488. set company_id = #{companyId,jdbcType=VARCHAR},
  489. app_id = #{appId,jdbcType=VARCHAR},
  490. email = #{email,jdbcType=VARCHAR},
  491. full_name = #{fullName,jdbcType=VARCHAR},
  492. subscriber_type = #{subscriberType,jdbcType=INTEGER},
  493. subscribed = #{subscribed,jdbcType=INTEGER},
  494. digest_password = #{digestPassword,jdbcType=VARCHAR},
  495. phone = #{phone,jdbcType=VARCHAR},
  496. industry = #{industry,jdbcType=VARCHAR},
  497. last_popularize_at = #{lastPopularizeAt,jdbcType=INTEGER},
  498. last_presented_coupon_at = #{lastPresentedCouponAt,jdbcType=TIMESTAMP},
  499. mailable = #{mailable,jdbcType=INTEGER},
  500. reset_token = #{resetToken,jdbcType=INTEGER},
  501. `role` = #{role,jdbcType=VARCHAR},
  502. job = #{job,jdbcType=VARCHAR},
  503. area = #{area,jdbcType=VARCHAR},
  504. platform_type = #{platformType,jdbcType=TINYINT},
  505. account_type = #{accountType,jdbcType=TINYINT},
  506. account_source = #{accountSource,jdbcType=TINYINT},
  507. created_at = #{createdAt,jdbcType=TIMESTAMP},
  508. updated_at = #{updatedAt,jdbcType=TIMESTAMP},
  509. remark = #{remark,jdbcType=VARCHAR},
  510. valid_flag = #{validFlag,jdbcType=VARCHAR}
  511. where id = #{id,jdbcType=VARCHAR}
  512. </update>
  513. <select id="selectByExampleWithRowbounds" parameterType="cn.kdan.cloud.pdf.office.account.model.UserExample" resultMap="BaseResultMap">
  514. select
  515. <if test="distinct">
  516. distinct
  517. </if>
  518. <include refid="Base_Column_List" />
  519. from user
  520. <if test="_parameter != null">
  521. <include refid="Example_Where_Clause" />
  522. </if>
  523. <if test="orderByClause != null">
  524. order by ${orderByClause}
  525. </if>
  526. </select>
  527. </mapper>