AppUserInfoMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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.platform.yijia.dao.AppUserInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.AppUserInfo">
  5. <id column="user_id" jdbcType="INTEGER" property="userId" />
  6. <result column="user_type" jdbcType="VARCHAR" property="userType" />
  7. <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
  8. <result column="mina_openid" jdbcType="VARCHAR" property="minaOpenid" />
  9. <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
  10. <result column="blog_nick_name" jdbcType="VARCHAR" property="blogNickName" />
  11. <result column="sex_flag" jdbcType="VARCHAR" property="sexFlag" />
  12. <result column="registe_date" jdbcType="TIMESTAMP" property="registeDate" />
  13. <result column="blog_profile_photo" jdbcType="VARCHAR" property="blogProfilePhoto" />
  14. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  15. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  16. <result column="ali_id" jdbcType="VARCHAR" property="aLiId" />
  17. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  18. </resultMap>
  19. <sql id="Example_Where_Clause">
  20. <!--
  21. WARNING - @mbg.generated
  22. This element is automatically generated by MyBatis Generator, do not modify.
  23. -->
  24. <where>
  25. <foreach collection="oredCriteria" item="criteria" separator="or">
  26. <if test="criteria.valid">
  27. <trim prefix="(" prefixOverrides="and" suffix=")">
  28. <foreach collection="criteria.criteria" item="criterion">
  29. <choose>
  30. <when test="criterion.noValue">
  31. and ${criterion.condition}
  32. </when>
  33. <when test="criterion.singleValue">
  34. and ${criterion.condition} #{criterion.value}
  35. </when>
  36. <when test="criterion.betweenValue">
  37. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  38. </when>
  39. <when test="criterion.listValue">
  40. and ${criterion.condition}
  41. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  42. #{listItem}
  43. </foreach>
  44. </when>
  45. </choose>
  46. </foreach>
  47. </trim>
  48. </if>
  49. </foreach>
  50. </where>
  51. </sql>
  52. <sql id="Update_By_Example_Where_Clause">
  53. <!--
  54. WARNING - @mbg.generated
  55. This element is automatically generated by MyBatis Generator, do not modify.
  56. -->
  57. <where>
  58. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  59. <if test="criteria.valid">
  60. <trim prefix="(" prefixOverrides="and" suffix=")">
  61. <foreach collection="criteria.criteria" item="criterion">
  62. <choose>
  63. <when test="criterion.noValue">
  64. and ${criterion.condition}
  65. </when>
  66. <when test="criterion.singleValue">
  67. and ${criterion.condition} #{criterion.value}
  68. </when>
  69. <when test="criterion.betweenValue">
  70. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  71. </when>
  72. <when test="criterion.listValue">
  73. and ${criterion.condition}
  74. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  75. #{listItem}
  76. </foreach>
  77. </when>
  78. </choose>
  79. </foreach>
  80. </trim>
  81. </if>
  82. </foreach>
  83. </where>
  84. </sql>
  85. <sql id="Base_Column_List">
  86. user_id, user_type, blog_openid, mina_openid, mobile_phone, blog_nick_name, sex_flag,
  87. registe_date blog_profile_photo, update_date, union_id, ali_id, station_id
  88. </sql>
  89. <!-- 获取用户信息-->
  90. <select id="getAppUserInfo" parameterType="com.platform.yijia.pojo.AppUserInfo" resultMap="BaseResultMap">
  91. SELECT
  92. <include refid="Base_Column_List" />
  93. FROM
  94. app_user_info
  95. <where>
  96. <if test="stationId !=null and stationId !=''">
  97. station_id = #{stationId}
  98. </if>
  99. <if test="mobilePhone !=null and mobilePhone !=''">
  100. AND mobile_phone = #{mobilePhone}
  101. </if>
  102. <if test="unionId !=null and unionId !=''">
  103. AND union_id = #{unionId}
  104. </if>
  105. <if test="minaOpenid !=null and minaOpenid !=''">
  106. AND mina_openid = #{minaOpenid}
  107. </if>
  108. <if test="aLiId !=null and aLiId !=''">
  109. AND ali_id = #{aLiId}
  110. </if>
  111. </where>
  112. </select>
  113. <!-- selectAppUserInfoByMobilePhoneAndStationId -->
  114. <!-- 根据手机号和油站ID获取用户信息-->
  115. <select id="selectAppUserInfoByMobilePhoneAndStationId" parameterType="com.platform.yijia.pojo.AppUserInfo" resultMap="BaseResultMap">
  116. SELECT
  117. <include refid="Base_Column_List" />
  118. FROM
  119. app_user_info
  120. <where>
  121. <if test="stationId !=null and stationId !=''">
  122. station_id = #{stationId}
  123. </if>
  124. <if test="mobilePhone !=null and mobilePhone !=''">
  125. AND mobile_phone = #{mobilePhone}
  126. </if>
  127. </where>
  128. </select>
  129. <!-- 判断注册账户是否已存在-->
  130. <select id="isExistAppUser" parameterType="map" resultType="int">
  131. SELECT
  132. COUNT(user_id)
  133. FROM
  134. app_user_info
  135. <where>
  136. <if test="userType !=null and userType !=''">
  137. user_type = #{userType}
  138. </if>
  139. <if test="userType !=null and userType ==1 ">
  140. AND blog_openid = #{openId}
  141. </if>
  142. <if test="userType !=null and userType ==2 ">
  143. AND mina_openid = #{openId}
  144. </if>
  145. <if test="stationId !=null and stationId !=''">
  146. AND station_id = #{stationId}
  147. </if>
  148. </where>
  149. </select>
  150. <select id="selectByExample" parameterType="com.platform.yijia.pojo.AppUserInfoExample" resultMap="BaseResultMap">
  151. <!--
  152. WARNING - @mbg.generated
  153. This element is automatically generated by MyBatis Generator, do not modify.
  154. -->
  155. select
  156. <if test="distinct">
  157. distinct
  158. </if>
  159. <include refid="Base_Column_List" />
  160. from app_user_info
  161. <if test="_parameter != null">
  162. <include refid="Example_Where_Clause" />
  163. </if>
  164. <if test="orderByClause != null">
  165. order by ${orderByClause}
  166. </if>
  167. </select>
  168. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  169. <!--
  170. WARNING - @mbg.generated
  171. This element is automatically generated by MyBatis Generator, do not modify.
  172. -->
  173. select
  174. <include refid="Base_Column_List" />
  175. from app_user_info
  176. where user_id = #{userId,jdbcType=INTEGER}
  177. </select>
  178. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  179. <!--
  180. WARNING - @mbg.generated
  181. This element is automatically generated by MyBatis Generator, do not modify.
  182. -->
  183. delete from app_user_info
  184. where user_id = #{userId,jdbcType=INTEGER}
  185. </delete>
  186. <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.AppUserInfoExample">
  187. <!--
  188. WARNING - @mbg.generated
  189. This element is automatically generated by MyBatis Generator, do not modify.
  190. -->
  191. delete from app_user_info
  192. <if test="_parameter != null">
  193. <include refid="Example_Where_Clause" />
  194. </if>
  195. </delete>
  196. <insert id="insert" parameterType="com.platform.yijia.pojo.AppUserInfo">
  197. <!--
  198. WARNING - @mbg.generated
  199. This element is automatically generated by MyBatis Generator, do not modify.
  200. -->
  201. insert into app_user_info (user_id, user_type, blog_openid,
  202. mina_openid, mobile_phone, blog_nick_name,
  203. sex_flag, registe_date, blog_profile_photo, update_date, union_id,station_id
  204. )
  205. values (#{userId,jdbcType=INTEGER}, #{userType,jdbcType=VARCHAR}, #{blogOpenid,jdbcType=VARCHAR},
  206. #{minaOpenid,jdbcType=VARCHAR}, #{mobilePhone,jdbcType=VARCHAR}, #{blogNickName,jdbcType=VARCHAR},
  207. #{sexFlag,jdbcType=VARCHAR}, #{registeDate,jdbcType=TIMESTAMP}, #{blogProfilePhoto,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP},
  208. #{unionId,jdbcType=VARCHAR},#{stationId,jdbcType=INTEGER}
  209. )
  210. </insert>
  211. <insert id="insertSelective" parameterType="com.platform.yijia.pojo.AppUserInfo">
  212. <!--
  213. WARNING - @mbg.generated
  214. This element is automatically generated by MyBatis Generator, do not modify.
  215. -->
  216. insert into app_user_info
  217. <trim prefix="(" suffix=")" suffixOverrides=",">
  218. <if test="userId != null">
  219. user_id,
  220. </if>
  221. <if test="userType != null">
  222. user_type,
  223. </if>
  224. <if test="blogOpenid != null">
  225. blog_openid,
  226. </if>
  227. <if test="minaOpenid != null">
  228. mina_openid,
  229. </if>
  230. <if test="mobilePhone != null">
  231. mobile_phone,
  232. </if>
  233. <if test="blogNickName != null">
  234. blog_nick_name,
  235. </if>
  236. <if test="sexFlag != null">
  237. sex_flag,
  238. </if>
  239. <if test="registeDate != null">
  240. registe_date,
  241. </if>
  242. <if test="blogToken != null">
  243. blog_token,
  244. </if>
  245. <if test="minaToken != null">
  246. mina_token,
  247. </if>
  248. <if test="blogProfilePhoto != null">
  249. blog_profile_photo,
  250. </if>
  251. <if test="updateDate != null">
  252. update_date,
  253. </if>
  254. <if test="unionId != null">
  255. union_id,
  256. </if>
  257. </trim>
  258. <trim prefix="values (" suffix=")" suffixOverrides=",">
  259. <if test="userId != null">
  260. #{userId,jdbcType=INTEGER},
  261. </if>
  262. <if test="userType != null">
  263. #{userType,jdbcType=VARCHAR},
  264. </if>
  265. <if test="blogOpenid != null">
  266. #{blogOpenid,jdbcType=VARCHAR},
  267. </if>
  268. <if test="minaOpenid != null">
  269. #{minaOpenid,jdbcType=VARCHAR},
  270. </if>
  271. <if test="mobilePhone != null">
  272. #{mobilePhone,jdbcType=VARCHAR},
  273. </if>
  274. <if test="blogNickName != null">
  275. #{blogNickName,jdbcType=VARCHAR},
  276. </if>
  277. <if test="sexFlag != null">
  278. #{sexFlag,jdbcType=VARCHAR},
  279. </if>
  280. <if test="registeDate != null">
  281. #{registeDate,jdbcType=TIMESTAMP},
  282. </if>
  283. <if test="blogToken != null">
  284. #{blogToken,jdbcType=VARCHAR},
  285. </if>
  286. <if test="minaToken != null">
  287. #{minaToken,jdbcType=VARCHAR},
  288. </if>
  289. <if test="blogProfilePhoto != null">
  290. #{blogProfilePhoto,jdbcType=VARCHAR},
  291. </if>
  292. <if test="updateDate != null">
  293. #{updateDate,jdbcType=TIMESTAMP},
  294. </if>
  295. <if test="unionId != null">
  296. #{unionId,jdbcType=VARCHAR},
  297. </if>
  298. </trim>
  299. </insert>
  300. <select id="countByExample" parameterType="com.platform.yijia.pojo.AppUserInfoExample" resultType="java.lang.Long">
  301. <!--
  302. WARNING - @mbg.generated
  303. This element is automatically generated by MyBatis Generator, do not modify.
  304. -->
  305. select count(*) from app_user_info
  306. <if test="_parameter != null">
  307. <include refid="Example_Where_Clause" />
  308. </if>
  309. </select>
  310. <update id="updateByExampleSelective" parameterType="map">
  311. <!--
  312. WARNING - @mbg.generated
  313. This element is automatically generated by MyBatis Generator, do not modify.
  314. -->
  315. update app_user_info
  316. <set>
  317. <if test="record.userId != null">
  318. user_id = #{record.userId,jdbcType=INTEGER},
  319. </if>
  320. <if test="record.userType != null">
  321. user_type = #{record.userType,jdbcType=VARCHAR},
  322. </if>
  323. <if test="record.blogOpenid != null">
  324. blog_openid = #{record.blogOpenid,jdbcType=VARCHAR},
  325. </if>
  326. <if test="record.minaOpenid != null">
  327. mina_openid = #{record.minaOpenid,jdbcType=VARCHAR},
  328. </if>
  329. <if test="record.mobilePhone != null">
  330. mobile_phone = #{record.mobilePhone,jdbcType=VARCHAR},
  331. </if>
  332. <if test="record.blogNickName != null">
  333. blog_nick_name = #{record.blogNickName,jdbcType=VARCHAR},
  334. </if>
  335. <if test="record.sexFlag != null">
  336. sex_flag = #{record.sexFlag,jdbcType=VARCHAR},
  337. </if>
  338. <if test="record.registeDate != null">
  339. registe_date = #{record.registeDate,jdbcType=TIMESTAMP},
  340. </if>
  341. <if test="record.blogToken != null">
  342. blog_token = #{record.blogToken,jdbcType=VARCHAR},
  343. </if>
  344. <if test="record.minaToken != null">
  345. mina_token = #{record.minaToken,jdbcType=VARCHAR},
  346. </if>
  347. <if test="record.blogProfilePhoto != null">
  348. blog_profile_photo = #{record.blogProfilePhoto,jdbcType=VARCHAR},
  349. </if>
  350. <if test="record.updateDate != null">
  351. update_date = #{record.updateDate,jdbcType=TIMESTAMP},
  352. </if>
  353. <if test="record.unionId != null">
  354. union_id = #{record.unionId,jdbcType=VARCHAR},
  355. </if>
  356. </set>
  357. <if test="_parameter != null">
  358. <include refid="Update_By_Example_Where_Clause" />
  359. </if>
  360. </update>
  361. <update id="updateByExample" parameterType="map">
  362. <!--
  363. WARNING - @mbg.generated
  364. This element is automatically generated by MyBatis Generator, do not modify.
  365. -->
  366. update app_user_info
  367. set user_id = #{record.userId,jdbcType=INTEGER},
  368. user_type = #{record.userType,jdbcType=VARCHAR},
  369. blog_openid = #{record.blogOpenid,jdbcType=VARCHAR},
  370. mina_openid = #{record.minaOpenid,jdbcType=VARCHAR},
  371. mobile_phone = #{record.mobilePhone,jdbcType=VARCHAR},
  372. blog_nick_name = #{record.blogNickName,jdbcType=VARCHAR},
  373. sex_flag = #{record.sexFlag,jdbcType=VARCHAR},
  374. registe_date = #{record.registeDate,jdbcType=TIMESTAMP},
  375. blog_token = #{record.blogToken,jdbcType=VARCHAR},
  376. mina_token = #{record.minaToken,jdbcType=VARCHAR},
  377. blog_profile_photo = #{record.blogProfilePhoto,jdbcType=VARCHAR},
  378. update_date = #{record.updateDate,jdbcType=TIMESTAMP}
  379. union_id = #{record.unionId,jdbcType=VARCHAR}
  380. <if test="_parameter != null">
  381. <include refid="Update_By_Example_Where_Clause" />
  382. </if>
  383. </update>
  384. <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.AppUserInfo">
  385. <!--
  386. WARNING - @mbg.generated
  387. This element is automatically generated by MyBatis Generator, do not modify.
  388. -->
  389. update app_user_info
  390. <set>
  391. <if test="userType != null">
  392. user_type = #{userType,jdbcType=VARCHAR},
  393. </if>
  394. <if test="blogOpenid != null">
  395. blog_openid = #{blogOpenid,jdbcType=VARCHAR},
  396. </if>
  397. <if test="minaOpenid != null">
  398. mina_openid = #{minaOpenid,jdbcType=VARCHAR},
  399. </if>
  400. <if test="mobilePhone != null">
  401. mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
  402. </if>
  403. <if test="blogNickName != null">
  404. blog_nick_name = #{blogNickName,jdbcType=VARCHAR},
  405. </if>
  406. <if test="sexFlag != null">
  407. sex_flag = #{sexFlag,jdbcType=VARCHAR},
  408. </if>
  409. <if test="registeDate != null">
  410. registe_date = #{registeDate,jdbcType=TIMESTAMP},
  411. </if>
  412. <if test="blogToken != null">
  413. blog_token = #{blogToken,jdbcType=VARCHAR},
  414. </if>
  415. <if test="minaToken != null">
  416. mina_token = #{minaToken,jdbcType=VARCHAR},
  417. </if>
  418. <if test="blogProfilePhoto != null">
  419. blog_profile_photo = #{blogProfilePhoto,jdbcType=VARCHAR},
  420. </if>
  421. <if test="updateDate != null">
  422. update_date = #{updateDate,jdbcType=TIMESTAMP},
  423. </if>
  424. <if test="unionId != null">
  425. union_id = #{unionId,jdbcType=VARCHAR},
  426. </if>
  427. </set>
  428. where user_id = #{userId,jdbcType=INTEGER}
  429. </update>
  430. <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.AppUserInfo">
  431. <!--
  432. WARNING - @mbg.generated
  433. This element is automatically generated by MyBatis Generator, do not modify.
  434. -->
  435. update app_user_info
  436. set user_type = #{userType,jdbcType=VARCHAR},
  437. blog_openid = #{blogOpenid,jdbcType=VARCHAR},
  438. mina_openid = #{minaOpenid,jdbcType=VARCHAR},
  439. mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
  440. blog_nick_name = #{blogNickName,jdbcType=VARCHAR},
  441. sex_flag = #{sexFlag,jdbcType=VARCHAR},
  442. registe_date = #{registeDate,jdbcType=TIMESTAMP},
  443. blog_token = #{blogToken,jdbcType=VARCHAR},
  444. mina_token = #{minaToken,jdbcType=VARCHAR},
  445. blog_profile_photo = #{blogProfilePhoto,jdbcType=VARCHAR},
  446. update_date = #{updateDate,jdbcType=TIMESTAMP},
  447. union_id = #{unionId,jdbcType=VARCHAR}
  448. where user_id = #{userId,jdbcType=INTEGER}
  449. </update>
  450. <!--查询客户unionId-->
  451. <select id="getUserInfo" parameterType="com.platform.yijia.pojo.AppUserInfo" resultMap="BaseResultMap">
  452. SELECT
  453. <include refid="Base_Column_List" />
  454. FROM app_user_info
  455. <where>
  456. <if test="userType !=null and userType !=''">
  457. user_type = #{userType}
  458. </if>
  459. <if test="stationId !=null and stationId !=''">
  460. station_id = #{stationId}
  461. </if>
  462. <if test="blogOpenid !=null and blogOpenid !=''">
  463. AND blog_openid = #{blogOpenid}
  464. </if>
  465. <if test="minaOpenid !=null and minaOpenid !=''">
  466. AND mina_openid = #{minaOpenid}
  467. </if>
  468. <if test="mobilePhone !=null and mobilePhone !=''">
  469. AND mobile_phone = #{mobilePhone}
  470. </if>
  471. </where>
  472. </select>
  473. <!--更新用户信息-->
  474. <update id="updateAppUserInfo" parameterType="com.platform.yijia.pojo.AppUserInfo">
  475. UPDATE app_user_info
  476. <set>
  477. <if test="userType != null">
  478. user_type = #{userType},
  479. </if>
  480. <if test="blogOpenid != null">
  481. blog_openid = #{blogOpenid},
  482. </if>
  483. <if test="minaOpenid != null">
  484. mina_openid = #{minaOpenid},
  485. </if>
  486. <if test="mobilePhone != null">
  487. mobile_phone = #{mobilePhone},
  488. </if>
  489. <if test="blogNickName != null">
  490. blog_nick_name = #{blogNickName},
  491. </if>
  492. <if test="sexFlag != null">
  493. sex_flag = #{sexFlag},
  494. </if>
  495. <if test="registeDate != null">
  496. registe_date = #{registeDate},
  497. </if>
  498. <if test="blogProfilePhoto != null">
  499. blog_profile_photo = #{blogProfilePhoto},
  500. </if>
  501. <if test="updateDate != null">
  502. update_date = #{updateDate},
  503. </if>
  504. </set>
  505. <where>
  506. <if test="stationId !=null and stationId !=''">
  507. station_id = #{stationId}
  508. </if>
  509. <if test="unionId !=null and unionId !=''">
  510. AND union_id = #{unionId}
  511. </if>
  512. <if test="mobilePhone !=null and mobilePhone !=''">
  513. AND mobile_phone = #{mobilePhone}
  514. </if>
  515. </where>
  516. </update>
  517. <!-- 判断使用小程序支付的用户是否关注公众号-->
  518. <select id="whetherFollowGzh" parameterType="map" resultType="String">
  519. SELECT
  520. blog_openid AS openId
  521. FROM
  522. app_user_info
  523. <where>
  524. <if test="userType !=null and userType !=''">
  525. user_type = #{userType}
  526. </if>
  527. <if test="unionId !=null and unionId !=''">
  528. AND union_id = #{unionId}
  529. </if>
  530. <if test="stationId !=null and stationId !=''">
  531. AND station_id = #{stationId}
  532. </if>
  533. </where>
  534. </select>
  535. </mapper>