From 1cf88d43994ec7ec403319032a9d118b39fe3571 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 25 四月 2025 14:35:35 +0800
Subject: [PATCH] 登录代码优化

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java |   53 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java
index f6cad3e..05687dd 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java
@@ -1,7 +1,7 @@
 package com.dy.sso.busi;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.dy.pipIrrGlobal.daoBa.BaPrivilegeMapper;
+import com.dy.pipIrrGlobal.daoBa.BaCaptchaMapper;
 import com.dy.pipIrrGlobal.daoBa.BaUserMapper;
 import com.dy.pipIrrGlobal.pojoBa.BaUser;
 import lombok.extern.slf4j.Slf4j;
@@ -11,12 +11,13 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+import java.util.Map;
+
 @Slf4j
 @Service
 public class SsoSv {
-
     private BaUserMapper baUserMapper;
-    private BaPrivilegeMapper baPrivilegeMapper;
 
     @Autowired
     private void setBaUserMapper(BaUserMapper baUserMapper){
@@ -24,9 +25,7 @@
     }
 
     @Autowired
-    private void setBaPrivilegeMapper(BaPrivilegeMapper baPrivilegeMapper){
-        this.baPrivilegeMapper = baPrivilegeMapper ;
-    }
+    private BaCaptchaMapper baCaptchaMapper;
 
     /**
      * 闇�瑕丅aUserMapper.xml
@@ -39,11 +38,7 @@
     @Transactional
     @Cacheable(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid", sync=true)
     public BaUser loginWithMapperXml(String uuid, String phone, String password){
-        BaUser baUser = this.baUserMapper.login(phone, password) ;
-        if(baUser !=  null  && baUser.id != null){
-            baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ;
-        }
-        return baUser;
+        return this.baUserMapper.login(phone, password) ;
     }
 
     /**
@@ -64,11 +59,7 @@
                 .eq("deleted", 0)
                 .eq("phone", phone)
                 .eq("password", password);
-        BaUser baUser = this.baUserMapper.selectOne(qw) ;
-        if(baUser !=  null  && baUser.id != null){
-            baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ;
-        }
-        return baUser;
+        return this.baUserMapper.selectOne(qw) ;
     }
 
     @CacheEvict(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid")
@@ -77,8 +68,36 @@
 
     @Cacheable(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid")
     public BaUser getByUuid(String uuid){
-        //姝ゆ柟娉曠洰鐨勬槸鐩存帴浠庣紦瀛樹腑璇诲彇锛屽鏋滅紦瀛樻棤姝ゅ�硷紝璇存槑鏁版嵁琚竻妤氫簡锛岃繑鍥瀗ull鍊硷紝闇�瑕侀噸鏂扮櫥褰�
+        //姝ゆ柟娉曠洰鐨勬槸鐩存帴浠庣紦瀛樹腑璇诲彇锛屽鏋滅紦瀛樻棤姝ゅ�硷紝璇存槑鏁版嵁琚竻闄や簡锛岃繑鍥瀗ull鍊硷紝闇�瑕侀噸鏂扮櫥褰�
         return null ;
     }
 
+    /**
+     * 鍒ゆ柇鎵嬫満鍙锋槸鍚﹀瓨鍦�
+     * @return
+     */
+    public boolean existPhone(String phone){
+        Long count = baUserMapper.countPhone(phone) ;
+        if(count == null || count == 0){
+            return false ;
+        }
+        return true ;
+    }
+
+    /**
+     * 寰楀埌鎵�鏈夌敤鎴锋墜鏈哄彿
+     * @return
+     */
+    public List<String> getPhones(){
+        return baUserMapper.getPhones() ;
+    }
+
+    /**
+     * 渚濇嵁楠岃瘉鐮乼oken鑾峰彇楠岃瘉瀛楃
+     * @param token
+     * @return
+     */
+    public Map getCodeByToken(String token) {
+        return baCaptchaMapper.getCodeByToken(token);
+    }
 }

--
Gitblit v1.8.0