LoginMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.travel.mapper.LoginMapper">
  5. <!-- 根据用户手机号查询 -->
  6. <select id="getUser" resultType="User">
  7. select * from sys_users where phone = #{phone}
  8. </select>
  9. <!-- 新增用户 -->
  10. <insert id="insetUser" parameterType="User">
  11. INSERT INTO sys_users (code,name,sex,age,pass,phone,jdrq,headpir,remake,wxid,wxtoken,flag,captcha)
  12. VALUES(#{code},#{name},#{sex},#{age},#{pass},#{phone},GETDATE(),#{headpir},#{remake},#{wxid},#{wxtoken},0,#{captcha})
  13. </insert>
  14. <!-- 校验手机号是否已注册 -->
  15. <select id="checkTele" resultType="int">
  16. select count(*) as count from sys_users where phone=#{phone}
  17. </select>
  18. <!-- 根据手机号删除用户 -->
  19. <delete id="delUser">
  20. delete from sys_users where phone=#{phone}
  21. </delete>
  22. <!-- 修改验证码 -->
  23. <update id="updateCaptcha">
  24. update sys_users set captcha=#{captcha} where phone=#{phone}
  25. </update>
  26. <!-- 根据code修改验证码 -->
  27. <update id="updateCaptchaCode">
  28. update sys_users set captcha=#{captcha} where code=#{code}
  29. </update>
  30. <!-- 校验验证码 -->
  31. <select id="checkCaptcha" resultType="int">
  32. select count(*) from sys_users where phone=#{phone} and captcha=#{captcha}
  33. </select>
  34. <!-- 校验验证码 -->
  35. <select id="checkCaptchaCode" resultType="int">
  36. select count(*) from sys_users where code=#{code} and captcha=#{captcha}
  37. </select>
  38. <!-- 手机号登录验证是否第一次登录 -->
  39. <select id="checkUser" resultType="User">
  40. select * from sys_users where phone=#{phone} and captcha=#{captcha}
  41. </select>
  42. <!-- 修改信息 -->
  43. <update id="updateUser" parameterType="User">
  44. update sys_users
  45. <set>
  46. <trim suffixOverrides=",">
  47. <if test="name != null and name != ''">
  48. name=#{name},
  49. </if>
  50. <if test="sex != null and sex != ''">
  51. sex=#{sex},
  52. </if>
  53. <if test="age != null and age != ''">
  54. age=#{age},
  55. </if>
  56. <if test="pass != null and pass != ''">
  57. pass=#{pass},
  58. </if>
  59. <if test="headpir != null and headpir != ''">
  60. headpir=#{headpir},
  61. </if>
  62. <if test="remake != null and remake != ''">
  63. remake=#{remake},
  64. </if>
  65. <if test="city != null and city != ''">
  66. city=#{city},
  67. </if>
  68. <if test="email != null and email != ''">
  69. email=#{email},
  70. </if>
  71. <if test="birthday != null and birthday != ''">
  72. birthday=#{birthday},
  73. </if>
  74. </trim>
  75. </set>
  76. where code = #{code}
  77. </update>
  78. <!-- 查询个人用户编号 -->
  79. <select id="getCode" resultType="User">
  80. select code from sys_users where phone=#{phone} and captcha=#{captcha}
  81. </select>
  82. <!-- 查询最大的id作为编号拼接 -->
  83. <select id="getMaxId" resultType="int">
  84. select id from sys_users where phone=#{phone}
  85. </select>
  86. <!-- 删除用户-->
  87. <delete id="deleteUser" parameterType="String">
  88. delete from sys_users where phone=#{phone}
  89. </delete>
  90. <!-- 查询无效用户 -->
  91. <select id="getInvalidUser" resultType="User">
  92. select id,phone from sys_users where jdrq &lt; GETDATE() and headpir is null
  93. </select>
  94. <!-- 添加一键登录用户 -->
  95. <update id="updateKeyToLog" parameterType="User">
  96. update sys_users set code=#{code},name=#{name},headpir=#{headpir} where id=#{id}
  97. </update>
  98. <!-- 查询用户信息 -->
  99. <select id="getUserPassLogin" parameterType="User" resultType="User">
  100. select * from sys_users where code=#{code} and pass =#{pass}
  101. </select>
  102. <!-- 查询密码是否正确 -->
  103. <select id="getUserPassLoginCount" parameterType="User" resultType="int">
  104. select count(*) from sys_users where code=#{code} and pass =#{pass}
  105. </select>
  106. <!-- 修改个人信息后回调 -->
  107. <select id="getUserVal" resultType="User">
  108. select * from sys_users where code=#{code}
  109. </select>
  110. <!-- 修改手机号提交 -->
  111. <update id="updatePhoneForm" parameterType="User">
  112. update sys_users set phone=#{phone} where code = #{code}
  113. </update>
  114. </mapper>