UserLoginServiceDaoImplMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 DISTINCT 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,
  18. 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. <if test="storeId !=null and storeId != ''">
  24. left join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  25. </if>
  26. where 1 =1
  27. <if test="parentOrgName !=null and parentOrgName != ''">
  28. and puo.org_name= #{parentOrgName}
  29. </if>
  30. <if test="orgName !=null and orgName != ''">
  31. and uo.org_name= #{orgName}
  32. </if>
  33. <if test="password !=null and password != ''">
  34. and t.password= #{password}
  35. </if>
  36. <if test="loginId !=null and loginId != ''">
  37. and t.login_id= #{loginId}
  38. </if>
  39. <if test="loginTime !=null and loginTime != ''">
  40. and t.login_time= #{loginTime}
  41. </if>
  42. <if test="startTime !=null and startTime != ''">
  43. and t.login_time &gt;= #{startTime}
  44. </if>
  45. <if test="endTime !=null and endTime != ''">
  46. and t.login_time &lt;= #{endTime}
  47. </if>
  48. <if test="source !=null and source != ''">
  49. and t.source= #{source}
  50. </if>
  51. <if test="userName !=null and userName != ''">
  52. and t.user_name= #{userName}
  53. </if>
  54. <if test="userId !=null and userId != ''">
  55. and t.user_id= #{userId}
  56. </if>
  57. <if test="token !=null and token != ''">
  58. and t.token= #{token}
  59. </if>
  60. <if test="storeId !=null and storeId != ''">
  61. and su.store_id= #{storeId}
  62. </if>
  63. order by t.login_time desc
  64. <if test="page != -1 and page != null ">
  65. limit #{page}, #{row}
  66. </if>
  67. </select>
  68. <!-- 修改用户登录信息 add by wuxw 2018-07-03 -->
  69. <update id="updateUserLoginInfo" parameterType="Map">
  70. update u_user_login t
  71. <set>
  72. <if test="newBId != null and newBId != ''">
  73. t.b_id = #{newBId},
  74. </if>
  75. <if test="password !=null and password != ''">
  76. t.password= #{password},
  77. </if>
  78. <if test="loginTime !=null and loginTime != ''">
  79. t.login_time= #{loginTime},
  80. </if>
  81. <if test="source !=null and source != ''">
  82. t.source= #{source},
  83. </if>
  84. <if test="userName !=null and userName != ''">
  85. t.user_name= #{userName},
  86. </if>
  87. <if test="userId !=null and userId != ''">
  88. t.user_id= #{userId},
  89. </if>
  90. <if test="token !=null and token != ''">
  91. t.token= #{token},
  92. </if>
  93. </set>
  94. where 1=1
  95. <if test="loginId !=null and loginId != ''">
  96. and t.login_id= #{loginId}
  97. </if>
  98. </update>
  99. <!-- 查询用户登录数量 add by wuxw 2018-07-03 -->
  100. <select id="queryUserLoginsCount" parameterType="Map" resultType="Map">
  101. select count(1) count
  102. from u_user_login t
  103. <if test="storeId !=null and storeId != ''">
  104. left join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  105. </if>
  106. where 1 =1
  107. <if test="password !=null and password != ''">
  108. and t.password= #{password}
  109. </if>
  110. <if test="loginId !=null and loginId != ''">
  111. and t.login_id= #{loginId}
  112. </if>
  113. <if test="loginTime !=null and loginTime != ''">
  114. and t.login_time= #{loginTime}
  115. </if>
  116. <if test="startTime !=null and startTime != ''">
  117. and t.login_time &gt;= #{startTime}
  118. </if>
  119. <if test="endTime !=null and endTime != ''">
  120. and t.login_time &lt;= #{endTime}
  121. </if>
  122. <if test="source !=null and source != ''">
  123. and t.source= #{source}
  124. </if>
  125. <if test="userName !=null and userName != ''">
  126. and t.user_name= #{userName}
  127. </if>
  128. <if test="userId !=null and userId != ''">
  129. and t.user_id= #{userId}
  130. </if>
  131. <if test="token !=null and token != ''">
  132. and t.token= #{token}
  133. </if>
  134. <if test="storeId !=null and storeId != ''">
  135. and su.store_id= #{storeId}
  136. </if>
  137. </select>
  138. </mapper>