SysUserMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.dtb.portal.mapper.SysUserMapper">
  4. <select id="page" resultType="com.dtb.portal.entity.SysUser">
  5. select *
  6. from users where 1=1
  7. <if test="accountName!=null and accountName!=''">
  8. and account_name like CONCAT('%',#{accountName,jdbcType=VARCHAR},'%')
  9. </if>
  10. <if test="phone!=null and phone!=''">
  11. and phone like CONCAT('%',#{phone,jdbcType=VARCHAR,jdbcType=VARCHAR},'%')
  12. </if>
  13. <if test="enable!=null and enable!=''">
  14. and enable =#{enable,jdbcType=VARCHAR}
  15. </if>
  16. and type='2'
  17. order by create_time desc
  18. </select>
  19. <select id="selectOne" resultType="com.dtb.portal.entity.SysUser">
  20. select *
  21. from users
  22. where id = #{id,jdbcType=VARCHAR}
  23. </select>
  24. <update id="updateEnable">
  25. update users
  26. <set>
  27. <if test="enable!=null">
  28. enable =#{enable},
  29. </if>
  30. <if test="updateTime!=null">
  31. update_time =#{updateTime,jdbcType=TIMESTAMP},
  32. </if>
  33. </set>
  34. where id=#{id,jdbcType=VARCHAR}
  35. </update>
  36. <update id="updatePassword">
  37. update users
  38. <set>
  39. <if test="password!=null and password!=''">
  40. password=#{password,jdbcType=VARCHAR},
  41. </if>
  42. <if test="updateTime!=null">
  43. update_time =#{updateTime,jdbcType=TIMESTAMP},
  44. </if>
  45. </set>
  46. where id=#{id,jdbcType=VARCHAR}
  47. </update>
  48. <select id="selectByAccountName" resultType="com.dtb.portal.entity.SysUser">
  49. select *
  50. from users
  51. where account_name = #{accountName,jdbcType=VARCHAR}
  52. </select>
  53. <select id="selectByOpenId" resultType="com.dtb.portal.entity.SysUser">
  54. select *
  55. from users
  56. where open_id = #{openId,jdbcType=VARCHAR}
  57. </select>
  58. <update id="update">
  59. UPDATE users
  60. <set>
  61. <if test="accountName!=null and accountName!=''">
  62. account_name=#{accountName,jdbcType=VARCHAR},
  63. </if>
  64. <if test="nickname!=null and nickname!=''">
  65. nickname=#{nickname,jdbcType=VARCHAR},
  66. </if>
  67. <if test="password!=null and password!=''">
  68. password=#{password,jdbcType=VARCHAR},
  69. </if>
  70. <if test="phone!=null and phone!=''">
  71. phone=#{phone,jdbcType=VARCHAR},
  72. </if>
  73. <if test="enable!=null">
  74. enable=#{enable},
  75. </if>
  76. <if test="gender!=null and gender!=''">
  77. gender=#{gender,jdbcType=VARCHAR},
  78. </if>
  79. <if test="location!=null and location!=''">
  80. location=#{location,jdbcType=VARCHAR},
  81. </if>
  82. <if test="nation!=null and nation!=''">
  83. nation=#{nation,jdbcType=VARCHAR},
  84. </if>
  85. <if test="birthday!=null">
  86. birthday=#{birthday,jdbcType=TIMESTAMP},
  87. </if>
  88. <if test="updateTime!=null">
  89. update_time=#{updateTime,jdbcType=TIMESTAMP},
  90. </if>
  91. <if test="isVip!=null">
  92. is_vip=#{isVip},
  93. </if>
  94. <if test="vipResidueDate!=null">
  95. vip_residue_date=#{vipResidueDate},
  96. </if>
  97. <if test="vipEndDate!=null">
  98. vip_end_date=#{vipEndDate},
  99. </if>
  100. logo_path=#{logoPath,jdbcType=VARCHAR},
  101. </set>
  102. where id=#{id,jdbcType=VARCHAR}
  103. </update>
  104. <insert id="save">
  105. insert into users (id, open_id, type, logo_path, account_name, nickname, password, phone, enable, gender,
  106. location,nation, birthday, create_time, update_time)
  107. values (#{id,jdbcType=VARCHAR},
  108. #{openId,jdbcType=VARCHAR},
  109. #{type,jdbcType=VARCHAR},
  110. #{logoPath,jdbcType=VARCHAR},
  111. #{accountName,jdbcType=VARCHAR},
  112. #{nickname,jdbcType=VARCHAR},
  113. #{password,jdbcType=VARCHAR},
  114. #{phone,jdbcType=VARCHAR},
  115. #{enable},
  116. #{gender,jdbcType=VARCHAR},
  117. #{location,jdbcType=VARCHAR},
  118. #{nation,jdbcType=VARCHAR},
  119. #{birthday,jdbcType=TIMESTAMP},
  120. #{createTime,jdbcType=TIMESTAMP},
  121. #{updateTime,jdbcType=TIMESTAMP})
  122. </insert>
  123. <select id="selectByPhone" resultType="com.dtb.portal.entity.SysUser">
  124. select *
  125. from users
  126. where phone = #{phone,jdbcType=VARCHAR}
  127. and type = '2'
  128. </select>
  129. <delete id="delete">
  130. delete
  131. from users
  132. where id = #{id,jdbcType=VARCHAR}
  133. </delete>
  134. </mapper>