完整管理员登陆接口的开发
This commit is contained in:
@@ -11,19 +11,6 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AdminServiceImpl implements AdminService {
|
||||
|
||||
@Autowired
|
||||
private AdminMapper adminMapper;
|
||||
|
||||
@Override
|
||||
public AdminBO getAdmin(Integer id) {
|
||||
return AdminConvert.INSTANCE.convert(adminMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminBO getAdminByAccountId(Integer accountId) {
|
||||
return AdminConvert.INSTANCE.convert(adminMapper.selectByAccountId(accountId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AdminBO> getAdminPage(AdminPageDTO pageDTO) {
|
||||
return AdminConvert.INSTANCE.convertPage(adminMapper.selectPage(pageDTO));
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package cn.iocoder.mall.system.biz.service.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserAuthenticateBO;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.dto.oatuh2.OAuth2MobileCodeAuthenticateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserPageDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
@@ -16,10 +15,6 @@ import javax.validation.Valid;
|
||||
@Validated
|
||||
public interface UserService {
|
||||
|
||||
UserAuthenticateBO authenticate(OAuth2MobileCodeAuthenticateDTO authenticateDTO);
|
||||
|
||||
UserBO getUserByAccountId(Integer accountId);
|
||||
|
||||
/**
|
||||
* 根据条件分页获取用户列表
|
||||
* @param userPageDTO
|
||||
|
||||
@@ -27,30 +27,6 @@ public class UserServiceImpl implements UserService {
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private OAuth2Service oAuth2Service;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public UserAuthenticateBO authenticate(OAuth2MobileCodeAuthenticateDTO authenticateDTO) {
|
||||
// 执行认证
|
||||
OAuth2AuthenticateBO accessTokenBO = oAuth2Service.authenticate(authenticateDTO);
|
||||
// 获得用户
|
||||
UserDO userDO = userMapper.selectById(accessTokenBO.getAccountId());
|
||||
if (userDO == null) {
|
||||
userDO = this.creatUser(accessTokenBO.getAccountId());
|
||||
}
|
||||
UserBO userBO = UserConvert.INSTANCE.convert(userDO);
|
||||
// 拼装返回
|
||||
return UserConvert.INSTANCE.convert(userBO, accessTokenBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserBO getUserByAccountId(Integer accountId) {
|
||||
UserDO userDO = userMapper.selectById(accountId);
|
||||
return UserConvert.INSTANCE.convert(userDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页获取用户列表
|
||||
* @param userPageDTO
|
||||
@@ -109,12 +85,4 @@ public class UserServiceImpl implements UserService {
|
||||
return true;
|
||||
}
|
||||
|
||||
private UserDO creatUser(Integer accountId) {
|
||||
UserDO user = new UserDO();
|
||||
user.setAccountId(accountId);
|
||||
user.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||
userMapper.insert(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user