Browse Source

用户登录优化

zhijiezhao 2 years ago
parent
commit
b3d1d147b4
1 changed files with 30 additions and 9 deletions
  1. 30 9
      src/main/resources/mapper/LoginMapper.xml

+ 30 - 9
src/main/resources/mapper/LoginMapper.xml

@@ -45,15 +45,36 @@
                cu.status            as operationStatus,
                cu.mobile            as operationMobile
         from user u
-                 left join cm_mall_operation_user cu on cu.userID = u.userID
-        where (u.bindMobile = #{mobileOrEmail}
-            or u.email = #{mobileOrEmail}
-            or (cu.mobile = #{mobileOrEmail} and cu.delFlag != 1)
-            )
-          and u.userIdentity in (1, 2, 3, 4)
-          and u.userOrganizeID = 0
-          and u.userId>0
-          and cu.id >0
+        left join cm_mall_operation_user cu on cu.userID = u.userID
+        where (u.bindMobile = #{mobileOrEmail} or u.email = #{mobileOrEmail})
+            and u.userIdentity in (1, 2, 3, 4)
+            and u.userOrganizeID = 0
+        union
+        SELECT u.userID             AS userId,
+               u.clubID             AS clubId,
+               u.shopID             AS shopId,
+               u.serviceProviderId  AS serviceProviderId,
+               u.userName           AS userName,
+               u.name               AS NAME,
+               u.mobile             AS mobile,
+               u.bindMobile         AS bindMobile,
+               u.email              AS email,
+               u.userPermission     AS userPermission,
+               u.userIdentity       AS userIdentity,
+               u.password           AS PASSWORD,
+               u.guideFlag          AS guideFlag,
+               u.clubStatus         AS clubStatus,
+               u.manufacturerStatus AS shopStatus,
+               cu.id                AS operationId,
+               cu.status            AS operationStatus,
+               cu.mobile            AS operationMobile
+        FROM USER u
+        LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
+        WHERE
+            cu.mobile = #{mobileOrEmail}
+          and cu.delFlag != 1
+          AND u.userIdentity IN (1, 2, 3, 4)
+          AND u.userOrganizeID = 0
         limit 1
     </select>
     <select id="getLoginUserByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">