UserMapper.xml 13 KB

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