| | |
| | | package com.dy.sso.busi; |
| | | |
| | | import com.dy.pipIrrGlobal.daoBa.BaPrivilegeMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaUserMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class SsoSv { |
| | | |
| | | private BaUserMapper baUserMapper; |
| | | private BaPrivilegeMapper baPrivilegeMapper; |
| | | |
| | | @Autowired |
| | | private void setBaUserMapper(BaUserMapper baUserMapper){ |
| | | this.baUserMapper = baUserMapper ; |
| | | } |
| | | |
| | | @Autowired |
| | | private void setBaPrivilegeMapper(BaPrivilegeMapper baPrivilegeMapper){ |
| | | this.baPrivilegeMapper = baPrivilegeMapper ; |
| | | } |
| | | |
| | | //当未注解@Transactional时,会输出日志:SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@46727a0c] was not registered for synchronization because synchronization is not active |
| | | //@Transactional |
| | | @Transactional |
| | | @Cacheable(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid", sync=true) |
| | | public BaUser login(String uuid, String phone, String password){ |
| | | return this.baUserMapper.login(phone, password) ; |
| | | BaUser baUser = this.baUserMapper.login(phone, password) ; |
| | | if(baUser != null && baUser.id != null){ |
| | | baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ; |
| | | } |
| | | return baUser; |
| | | } |
| | | |
| | | @CacheEvict(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid") |