UserMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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.book.push.dao.mapper.UserMapper">
  4. <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.User">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="openid" jdbcType="VARCHAR" property="openid" />
  7. <result column="unionid" jdbcType="VARCHAR" property="unionid" />
  8. <result column="visitor" jdbcType="VARCHAR" property="visitor" />
  9. <result column="nickname" jdbcType="VARCHAR" property="nickname" />
  10. <result column="sex" jdbcType="OTHER" property="sex" />
  11. <result column="mobile" jdbcType="CHAR" property="mobile" />
  12. <result column="avatar" jdbcType="VARCHAR" property="avatar" />
  13. <result column="is_subscribe" jdbcType="OTHER" property="isSubscribe" />
  14. <result column="subscription_extend" jdbcType="OTHER" property="subscriptionExtend" />
  15. <result column="subscribe_time" jdbcType="INTEGER" property="subscribeTime" />
  16. <result column="book_category_ids" jdbcType="VARCHAR" property="bookCategoryIds" />
  17. <result column="operate_time" jdbcType="INTEGER" property="operateTime" />
  18. <result column="is_pay" jdbcType="OTHER" property="isPay" />
  19. <result column="kandian" jdbcType="INTEGER" property="kandian" />
  20. <result column="free_kandian" jdbcType="INTEGER" property="freeKandian" />
  21. <result column="vip_endtime" jdbcType="INTEGER" property="vipEndtime" />
  22. <result column="register_ip" jdbcType="VARCHAR" property="registerIp" />
  23. <result column="country" jdbcType="VARCHAR" property="country" />
  24. <result column="area" jdbcType="VARCHAR" property="area" />
  25. <result column="province" jdbcType="VARCHAR" property="province" />
  26. <result column="city" jdbcType="VARCHAR" property="city" />
  27. <result column="isp" jdbcType="VARCHAR" property="isp" />
  28. <result column="channel_id" jdbcType="INTEGER" property="channelId" />
  29. <result column="state" jdbcType="OTHER" property="state" />
  30. <result column="createtime" jdbcType="INTEGER" property="createtime" />
  31. <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
  32. </resultMap>
  33. <sql id="Base_Column_List">
  34. id, openid, unionid, visitor, nickname, sex, mobile, avatar, is_subscribe, subscription_extend,
  35. subscribe_time, book_category_ids, operate_time, is_pay, kandian, free_kandian, vip_endtime,
  36. register_ip, country, area, province, city, isp, channel_id, `state`, createtime,
  37. updatetime
  38. </sql>
  39. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  40. select
  41. <include refid="Base_Column_List" />
  42. from user
  43. where id = #{id,jdbcType=BIGINT}
  44. </select>
  45. <select id="selectByUser" resultType="com.book.push.dao.pojo.User" parameterType="com.book.push.dao.pojo.User">
  46. select id from user
  47. <trim prefix="WHERE" prefixOverrides="AND | OR">
  48. <if test="openid!=null and openid!=''">
  49. and openid != #{openid}
  50. </if>
  51. <if test="mobile!=null and mobile!=''">
  52. and mobile != #{mobile}
  53. </if>
  54. <if test="channel_id!=null and channel_id!=0">
  55. and channel_id != #{channel_id}
  56. </if>
  57. </trim>
  58. </select>
  59. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  60. delete from user
  61. where id = #{id,jdbcType=BIGINT}
  62. </delete>
  63. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.User" useGeneratedKeys="true">
  64. insert into user (openid, unionid, visitor,
  65. nickname, sex, mobile, avatar,
  66. is_subscribe, subscription_extend, subscribe_time,
  67. book_category_ids, operate_time, is_pay,
  68. kandian, free_kandian, vip_endtime,
  69. register_ip, country, area,
  70. province, city, isp,
  71. channel_id, `state`, createtime,
  72. updatetime)
  73. values (#{openid,jdbcType=VARCHAR}, #{unionid,jdbcType=VARCHAR}, #{visitor,jdbcType=VARCHAR},
  74. #{nickname,jdbcType=VARCHAR}, #{sex,jdbcType=OTHER}, #{mobile,jdbcType=CHAR}, #{avatar,jdbcType=VARCHAR},
  75. #{isSubscribe,jdbcType=OTHER}, #{subscriptionExtend,jdbcType=OTHER}, #{subscribeTime,jdbcType=INTEGER},
  76. #{bookCategoryIds,jdbcType=VARCHAR}, #{operateTime,jdbcType=INTEGER}, #{isPay,jdbcType=OTHER},
  77. #{kandian,jdbcType=INTEGER}, #{freeKandian,jdbcType=INTEGER}, #{vipEndtime,jdbcType=INTEGER},
  78. #{registerIp,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR},
  79. #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{isp,jdbcType=VARCHAR},
  80. #{channelId,jdbcType=INTEGER}, #{state,jdbcType=OTHER}, #{createtime,jdbcType=INTEGER},
  81. #{updatetime,jdbcType=INTEGER})
  82. </insert>
  83. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.User" useGeneratedKeys="true">
  84. insert into user
  85. <trim prefix="(" suffix=")" suffixOverrides=",">
  86. <if test="openid != null">
  87. openid,
  88. </if>
  89. <if test="unionid != null">
  90. unionid,
  91. </if>
  92. <if test="visitor != null">
  93. visitor,
  94. </if>
  95. <if test="nickname != null">
  96. nickname,
  97. </if>
  98. <if test="sex != null">
  99. sex,
  100. </if>
  101. <if test="mobile != null">
  102. mobile,
  103. </if>
  104. <if test="avatar != null">
  105. avatar,
  106. </if>
  107. <if test="isSubscribe != null">
  108. is_subscribe,
  109. </if>
  110. <if test="subscriptionExtend != null">
  111. subscription_extend,
  112. </if>
  113. <if test="subscribeTime != null">
  114. subscribe_time,
  115. </if>
  116. <if test="bookCategoryIds != null">
  117. book_category_ids,
  118. </if>
  119. <if test="operateTime != null">
  120. operate_time,
  121. </if>
  122. <if test="isPay != null">
  123. is_pay,
  124. </if>
  125. <if test="kandian != null">
  126. kandian,
  127. </if>
  128. <if test="freeKandian != null">
  129. free_kandian,
  130. </if>
  131. <if test="vipEndtime != null">
  132. vip_endtime,
  133. </if>
  134. <if test="registerIp != null">
  135. register_ip,
  136. </if>
  137. <if test="country != null">
  138. country,
  139. </if>
  140. <if test="area != null">
  141. area,
  142. </if>
  143. <if test="province != null">
  144. province,
  145. </if>
  146. <if test="city != null">
  147. city,
  148. </if>
  149. <if test="isp != null">
  150. isp,
  151. </if>
  152. <if test="channelId != null">
  153. channel_id,
  154. </if>
  155. <if test="state != null">
  156. `state`,
  157. </if>
  158. <if test="createtime != null">
  159. createtime,
  160. </if>
  161. <if test="updatetime != null">
  162. updatetime,
  163. </if>
  164. </trim>
  165. <trim prefix="values (" suffix=")" suffixOverrides=",">
  166. <if test="openid != null">
  167. #{openid,jdbcType=VARCHAR},
  168. </if>
  169. <if test="unionid != null">
  170. #{unionid,jdbcType=VARCHAR},
  171. </if>
  172. <if test="visitor != null">
  173. #{visitor,jdbcType=VARCHAR},
  174. </if>
  175. <if test="nickname != null">
  176. #{nickname,jdbcType=VARCHAR},
  177. </if>
  178. <if test="sex != null">
  179. #{sex,jdbcType=OTHER},
  180. </if>
  181. <if test="mobile != null">
  182. #{mobile,jdbcType=CHAR},
  183. </if>
  184. <if test="avatar != null">
  185. #{avatar,jdbcType=VARCHAR},
  186. </if>
  187. <if test="isSubscribe != null">
  188. #{isSubscribe,jdbcType=OTHER},
  189. </if>
  190. <if test="subscriptionExtend != null">
  191. #{subscriptionExtend,jdbcType=OTHER},
  192. </if>
  193. <if test="subscribeTime != null">
  194. #{subscribeTime,jdbcType=INTEGER},
  195. </if>
  196. <if test="bookCategoryIds != null">
  197. #{bookCategoryIds,jdbcType=VARCHAR},
  198. </if>
  199. <if test="operateTime != null">
  200. #{operateTime,jdbcType=INTEGER},
  201. </if>
  202. <if test="isPay != null">
  203. #{isPay,jdbcType=OTHER},
  204. </if>
  205. <if test="kandian != null">
  206. #{kandian,jdbcType=INTEGER},
  207. </if>
  208. <if test="freeKandian != null">
  209. #{freeKandian,jdbcType=INTEGER},
  210. </if>
  211. <if test="vipEndtime != null">
  212. #{vipEndtime,jdbcType=INTEGER},
  213. </if>
  214. <if test="registerIp != null">
  215. #{registerIp,jdbcType=VARCHAR},
  216. </if>
  217. <if test="country != null">
  218. #{country,jdbcType=VARCHAR},
  219. </if>
  220. <if test="area != null">
  221. #{area,jdbcType=VARCHAR},
  222. </if>
  223. <if test="province != null">
  224. #{province,jdbcType=VARCHAR},
  225. </if>
  226. <if test="city != null">
  227. #{city,jdbcType=VARCHAR},
  228. </if>
  229. <if test="isp != null">
  230. #{isp,jdbcType=VARCHAR},
  231. </if>
  232. <if test="channelId != null">
  233. #{channelId,jdbcType=INTEGER},
  234. </if>
  235. <if test="state != null">
  236. #{state,jdbcType=OTHER},
  237. </if>
  238. <if test="createtime != null">
  239. #{createtime,jdbcType=INTEGER},
  240. </if>
  241. <if test="updatetime != null">
  242. #{updatetime,jdbcType=INTEGER},
  243. </if>
  244. </trim>
  245. </insert>
  246. <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.User">
  247. update user
  248. <set>
  249. <if test="openid != null">
  250. openid = #{openid,jdbcType=VARCHAR},
  251. </if>
  252. <if test="unionid != null">
  253. unionid = #{unionid,jdbcType=VARCHAR},
  254. </if>
  255. <if test="visitor != null">
  256. visitor = #{visitor,jdbcType=VARCHAR},
  257. </if>
  258. <if test="nickname != null">
  259. nickname = #{nickname,jdbcType=VARCHAR},
  260. </if>
  261. <if test="sex != null">
  262. sex = #{sex,jdbcType=OTHER},
  263. </if>
  264. <if test="mobile != null">
  265. mobile = #{mobile,jdbcType=CHAR},
  266. </if>
  267. <if test="avatar != null">
  268. avatar = #{avatar,jdbcType=VARCHAR},
  269. </if>
  270. <if test="isSubscribe != null">
  271. is_subscribe = #{isSubscribe,jdbcType=OTHER},
  272. </if>
  273. <if test="subscriptionExtend != null">
  274. subscription_extend = #{subscriptionExtend,jdbcType=OTHER},
  275. </if>
  276. <if test="subscribeTime != null">
  277. subscribe_time = #{subscribeTime,jdbcType=INTEGER},
  278. </if>
  279. <if test="bookCategoryIds != null">
  280. book_category_ids = #{bookCategoryIds,jdbcType=VARCHAR},
  281. </if>
  282. <if test="operateTime != null">
  283. operate_time = #{operateTime,jdbcType=INTEGER},
  284. </if>
  285. <if test="isPay != null">
  286. is_pay = #{isPay,jdbcType=OTHER},
  287. </if>
  288. <if test="kandian != null">
  289. kandian = #{kandian,jdbcType=INTEGER},
  290. </if>
  291. <if test="freeKandian != null">
  292. free_kandian = #{freeKandian,jdbcType=INTEGER},
  293. </if>
  294. <if test="vipEndtime != null">
  295. vip_endtime = #{vipEndtime,jdbcType=INTEGER},
  296. </if>
  297. <if test="registerIp != null">
  298. register_ip = #{registerIp,jdbcType=VARCHAR},
  299. </if>
  300. <if test="country != null">
  301. country = #{country,jdbcType=VARCHAR},
  302. </if>
  303. <if test="area != null">
  304. area = #{area,jdbcType=VARCHAR},
  305. </if>
  306. <if test="province != null">
  307. province = #{province,jdbcType=VARCHAR},
  308. </if>
  309. <if test="city != null">
  310. city = #{city,jdbcType=VARCHAR},
  311. </if>
  312. <if test="isp != null">
  313. isp = #{isp,jdbcType=VARCHAR},
  314. </if>
  315. <if test="channelId != null">
  316. channel_id = #{channelId,jdbcType=INTEGER},
  317. </if>
  318. <if test="state != null">
  319. `state` = #{state,jdbcType=OTHER},
  320. </if>
  321. <if test="createtime != null">
  322. createtime = #{createtime,jdbcType=INTEGER},
  323. </if>
  324. <if test="updatetime != null">
  325. updatetime = #{updatetime,jdbcType=INTEGER},
  326. </if>
  327. </set>
  328. where id = #{id,jdbcType=BIGINT}
  329. </update>
  330. <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.User">
  331. update user
  332. set openid = #{openid,jdbcType=VARCHAR},
  333. unionid = #{unionid,jdbcType=VARCHAR},
  334. visitor = #{visitor,jdbcType=VARCHAR},
  335. nickname = #{nickname,jdbcType=VARCHAR},
  336. sex = #{sex,jdbcType=OTHER},
  337. mobile = #{mobile,jdbcType=CHAR},
  338. avatar = #{avatar,jdbcType=VARCHAR},
  339. is_subscribe = #{isSubscribe,jdbcType=OTHER},
  340. subscription_extend = #{subscriptionExtend,jdbcType=OTHER},
  341. subscribe_time = #{subscribeTime,jdbcType=INTEGER},
  342. book_category_ids = #{bookCategoryIds,jdbcType=VARCHAR},
  343. operate_time = #{operateTime,jdbcType=INTEGER},
  344. is_pay = #{isPay,jdbcType=OTHER},
  345. kandian = #{kandian,jdbcType=INTEGER},
  346. free_kandian = #{freeKandian,jdbcType=INTEGER},
  347. vip_endtime = #{vipEndtime,jdbcType=INTEGER},
  348. register_ip = #{registerIp,jdbcType=VARCHAR},
  349. country = #{country,jdbcType=VARCHAR},
  350. area = #{area,jdbcType=VARCHAR},
  351. province = #{province,jdbcType=VARCHAR},
  352. city = #{city,jdbcType=VARCHAR},
  353. isp = #{isp,jdbcType=VARCHAR},
  354. channel_id = #{channelId,jdbcType=INTEGER},
  355. `state` = #{state,jdbcType=OTHER},
  356. createtime = #{createtime,jdbcType=INTEGER},
  357. updatetime = #{updatetime,jdbcType=INTEGER}
  358. where id = #{id,jdbcType=BIGINT}
  359. </update>
  360. </mapper>