UserLoginServiceDaoImplMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="userLoginServiceDaoImpl">
  6. <!-- 保存用户登录信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveUserLoginInfo" parameterType="Map">
  8. insert into u_user_login(
  9. password,login_id,login_time,source,user_name,user_id,token
  10. ) values (
  11. #{password},#{loginId},#{loginTime},#{source},#{userName},#{userId},#{token}
  12. )
  13. </insert>
  14. <!-- 查询用户登录信息 add by wuxw 2018-07-03 -->
  15. <select id="getUserLoginInfo" parameterType="Map" resultType="Map">
  16. select t.password,t.login_id,t.login_id loginId,t.login_time,t.login_time
  17. loginTime,t.source,t.user_name,t.user_name userName,t.user_id,t.user_id userId,t.token,
  18. puo.org_id parentOrgId,puo.org_name parentOrgName,uo.org_name orgName
  19. from u_user_login t
  20. left join u_org_staff_rel uosr on t.user_id = uosr.staff_id and uosr.status_cd = '0'
  21. left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
  22. left join u_org puo on uo.parent_org_id = puo.org_id and puo.status_cd = '0'
  23. where 1 =1
  24. <if test="parentOrgName !=null and parentOrgName != ''">
  25. and puo.org_name= #{parentOrgName}
  26. </if>
  27. <if test="orgName !=null and orgName != ''">
  28. and uo.org_name= #{orgName}
  29. </if>
  30. <if test="password !=null and password != ''">
  31. and t.password= #{password}
  32. </if>
  33. <if test="loginId !=null and loginId != ''">
  34. and t.login_id= #{loginId}
  35. </if>
  36. <if test="loginTime !=null and loginTime != ''">
  37. and t.login_time= #{loginTime}
  38. </if>
  39. <if test="source !=null and source != ''">
  40. and t.source= #{source}
  41. </if>
  42. <if test="userName !=null and userName != ''">
  43. and t.user_name= #{userName}
  44. </if>
  45. <if test="userId !=null and userId != ''">
  46. and t.user_id= #{userId}
  47. </if>
  48. <if test="token !=null and token != ''">
  49. and t.token= #{token}
  50. </if>
  51. order by t.login_time desc
  52. <if test="page != -1 and page != null ">
  53. limit #{page}, #{row}
  54. </if>
  55. </select>
  56. <!-- 修改用户登录信息 add by wuxw 2018-07-03 -->
  57. <update id="updateUserLoginInfo" parameterType="Map">
  58. update u_user_login t
  59. <set>
  60. <if test="newBId != null and newBId != ''">
  61. t.b_id = #{newBId},
  62. </if>
  63. <if test="password !=null and password != ''">
  64. t.password= #{password},
  65. </if>
  66. <if test="loginTime !=null and loginTime != ''">
  67. t.login_time= #{loginTime},
  68. </if>
  69. <if test="source !=null and source != ''">
  70. t.source= #{source},
  71. </if>
  72. <if test="userName !=null and userName != ''">
  73. t.user_name= #{userName},
  74. </if>
  75. <if test="userId !=null and userId != ''">
  76. t.user_id= #{userId},
  77. </if>
  78. <if test="token !=null and token != ''">
  79. t.token= #{token},
  80. </if>
  81. </set>
  82. where 1=1
  83. <if test="loginId !=null and loginId != ''">
  84. and t.login_id= #{loginId}
  85. </if>
  86. </update>
  87. <!-- 查询用户登录数量 add by wuxw 2018-07-03 -->
  88. <select id="queryUserLoginsCount" parameterType="Map" resultType="Map">
  89. select count(1) count
  90. from u_user_login t
  91. where 1 =1
  92. <if test="password !=null and password != ''">
  93. and t.password= #{password}
  94. </if>
  95. <if test="loginId !=null and loginId != ''">
  96. and t.login_id= #{loginId}
  97. </if>
  98. <if test="loginTime !=null and loginTime != ''">
  99. and t.login_time= #{loginTime}
  100. </if>
  101. <if test="source !=null and source != ''">
  102. and t.source= #{source}
  103. </if>
  104. <if test="userName !=null and userName != ''">
  105. and t.user_name= #{userName}
  106. </if>
  107. <if test="userId !=null and userId != ''">
  108. and t.user_id= #{userId}
  109. </if>
  110. <if test="token !=null and token != ''">
  111. and t.token= #{token}
  112. </if>
  113. </select>
  114. </mapper>