WxUserMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.framework.recovery.mapper.WxUserMapper">
  6. <resultMap type="WxUser" id="WxUserResult">
  7. <result property="id" column="id" />
  8. <result property="username" column="username" />
  9. <result property="password" column="password" />
  10. <result property="gender" column="gender" />
  11. <result property="birthday" column="birthday" />
  12. <result property="lastLoginTime" column="last_login_time" />
  13. <result property="lastLoginIp" column="last_login_ip" />
  14. <result property="userLevel" column="user_level" />
  15. <result property="nickname" column="nickname" />
  16. <result property="mobile" column="mobile" />
  17. <result property="avatar" column="avatar" />
  18. <result property="wxOpenid" column="wx_openid" />
  19. <result property="status" column="status" />
  20. <result property="addTime" column="add_time" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="deleted" column="deleted" />
  23. <result property="points" column="points" />
  24. <result property="vipStartTime" column="vip_start_time" />
  25. <result property="vipEndTime" column="vip_end_time" />
  26. </resultMap>
  27. <sql id="selectWxUserVo">
  28. select id, username, password, gender, birthday, last_login_time, last_login_ip, user_level, nickname, mobile, avatar, wx_openid, status, add_time, update_time, deleted, points, vip_start_time, vip_end_time from wx_user
  29. </sql>
  30. <select id="selectWxUserList" parameterType="WxUser" resultMap="WxUserResult">
  31. <include refid="selectWxUserVo"/>
  32. <where>
  33. <if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
  34. <if test="password != null and password != ''"> and password = #{password}</if>
  35. <if test="gender != null "> and gender = #{gender}</if>
  36. <if test="birthday != null "> and birthday = #{birthday}</if>
  37. <if test="lastLoginTime != null "> and last_login_time = #{lastLoginTime}</if>
  38. <if test="lastLoginIp != null and lastLoginIp != ''"> and last_login_ip = #{lastLoginIp}</if>
  39. <if test="userLevel != null "> and user_level = #{userLevel}</if>
  40. <if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
  41. <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
  42. <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
  43. <if test="wxOpenid != null and wxOpenid != ''"> and wx_openid = #{wxOpenid}</if>
  44. <if test="status != null "> and status = #{status}</if>
  45. <if test="addTime != null "> and add_time = #{addTime}</if>
  46. <if test="deleted != null "> and deleted = #{deleted}</if>
  47. <if test="points != null "> and points = #{points}</if>
  48. <if test="vipStartTime != null "> and vip_start_time = #{vipStartTime}</if>
  49. <if test="vipEndTime != null "> and vip_end_time = #{vipEndTime}</if>
  50. </where>
  51. </select>
  52. <select id="selectWxUserById" parameterType="Long" resultMap="WxUserResult">
  53. <include refid="selectWxUserVo"/>
  54. where id = #{id}
  55. </select>
  56. <select id="selectWxUserByOpenid" resultMap="WxUserResult">
  57. <include refid="selectWxUserVo" />
  58. where wx_openid = #{openid} and status = 0
  59. </select>
  60. <insert id="insertWxUser" parameterType="WxUser" useGeneratedKeys="true" keyProperty="id">
  61. insert into wx_user
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="username != null and username != ''">username,</if>
  64. <if test="password != null and password != ''">password,</if>
  65. <if test="gender != null">gender,</if>
  66. <if test="birthday != null">birthday,</if>
  67. <if test="lastLoginTime != null">last_login_time,</if>
  68. <if test="lastLoginIp != null and lastLoginIp != ''">last_login_ip,</if>
  69. <if test="userLevel != null">user_level,</if>
  70. <if test="nickname != null and nickname != ''">nickname,</if>
  71. <if test="mobile != null and mobile != ''">mobile,</if>
  72. <if test="avatar != null and avatar != ''">avatar,</if>
  73. <if test="wxOpenid != null and wxOpenid != ''">wx_openid,</if>
  74. <if test="status != null">status,</if>
  75. <if test="addTime != null">add_time,</if>
  76. <if test="updateTime != null">update_time,</if>
  77. <if test="deleted != null">deleted,</if>
  78. <if test="points != null">points,</if>
  79. <if test="vipStartTime != null">vip_start_time,</if>
  80. <if test="vipEndTime != null">vip_end_time,</if>
  81. </trim>
  82. <trim prefix="values (" suffix=")" suffixOverrides=",">
  83. <if test="username != null and username != ''">#{username},</if>
  84. <if test="password != null and password != ''">#{password},</if>
  85. <if test="gender != null">#{gender},</if>
  86. <if test="birthday != null">#{birthday},</if>
  87. <if test="lastLoginTime != null">#{lastLoginTime},</if>
  88. <if test="lastLoginIp != null and lastLoginIp != ''">#{lastLoginIp},</if>
  89. <if test="userLevel != null">#{userLevel},</if>
  90. <if test="nickname != null and nickname != ''">#{nickname},</if>
  91. <if test="mobile != null and mobile != ''">#{mobile},</if>
  92. <if test="avatar != null and avatar != ''">#{avatar},</if>
  93. <if test="wxOpenid != null and wxOpenid != ''">#{wxOpenid},</if>
  94. <if test="status != null">#{status},</if>
  95. <if test="addTime != null">#{addTime},</if>
  96. <if test="updateTime != null">#{updateTime},</if>
  97. <if test="deleted != null">#{deleted},</if>
  98. <if test="points != null">#{points},</if>
  99. <if test="vipStartTime != null">#{vipStartTime},</if>
  100. <if test="vipEndTime != null">#{vipEndTime},</if>
  101. </trim>
  102. </insert>
  103. <update id="updateWxUser" parameterType="WxUser">
  104. update wx_user
  105. <trim prefix="SET" suffixOverrides=",">
  106. <if test="username != null and username != ''">username = #{username},</if>
  107. <if test="password != null and password != ''">password = #{password},</if>
  108. <if test="gender != null">gender = #{gender},</if>
  109. <if test="birthday != null">birthday = #{birthday},</if>
  110. <if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
  111. <if test="lastLoginIp != null and lastLoginIp != ''">last_login_ip = #{lastLoginIp},</if>
  112. <if test="userLevel != null">user_level = #{userLevel},</if>
  113. <if test="nickname != null and nickname != ''">nickname = #{nickname},</if>
  114. <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
  115. <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
  116. <if test="wxOpenid != null and wxOpenid != ''">wx_openid = #{wxOpenid},</if>
  117. <if test="status != null">status = #{status},</if>
  118. <if test="addTime != null">add_time = #{addTime},</if>
  119. <if test="updateTime != null">update_time = #{updateTime},</if>
  120. <if test="deleted != null">deleted = #{deleted},</if>
  121. <if test="points != null">points = #{points},</if>
  122. <if test="vipStartTime != null">vip_start_time = #{vipStartTime},</if>
  123. <if test="vipEndTime != null">vip_end_time = #{vipEndTime},</if>
  124. </trim>
  125. where id = #{id}
  126. </update>
  127. <update id="updateWxUserByOpenId">
  128. update wx_user
  129. <trim prefix="SET" suffixOverrides=",">
  130. <if test="username != null and username != ''">username = #{username},</if>
  131. <if test="password != null and password != ''">password = #{password},</if>
  132. <if test="gender != null">gender = #{gender},</if>
  133. <if test="birthday != null">birthday = #{birthday},</if>
  134. <if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
  135. <if test="lastLoginIp != null and lastLoginIp != ''">last_login_ip = #{lastLoginIp},</if>
  136. <if test="userLevel != null">user_level = #{userLevel},</if>
  137. <if test="nickname != null and nickname != ''">nickname = #{nickname},</if>
  138. <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
  139. <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
  140. <if test="status != null">status = #{status},</if>
  141. <if test="addTime != null">add_time = #{addTime},</if>
  142. <if test="updateTime != null">update_time = #{updateTime},</if>
  143. <if test="deleted != null">deleted = #{deleted},</if>
  144. <if test="points != null">points = #{points},</if>
  145. <if test="vipStartTime != null">vip_start_time = #{vipStartTime},</if>
  146. <if test="vipEndTime != null">vip_end_time = #{vipEndTime},</if>
  147. </trim>
  148. where wxOpenid = #{wxOpenid}
  149. </update>
  150. <delete id="deleteWxUserById" parameterType="Long">
  151. delete from wx_user where id = #{id}
  152. </delete>
  153. <delete id="deleteWxUserByIds" parameterType="String">
  154. delete from wx_user where id in
  155. <foreach item="id" collection="array" open="(" separator="," close=")">
  156. #{id}
  157. </foreach>
  158. </delete>
  159. </mapper>