Compare commits
No commits in common. "2a35ec21520622238a0e5a411c32b7ecad7827b1" and "c3f1343ea9a17c5bbc85421c3c3423f1fc0d56fc" have entirely different histories.
2a35ec2152
...
c3f1343ea9
|
@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,9 +54,7 @@ public class TUserController {
|
|||
public Result login(@RequestBody TUserEntity entity){
|
||||
TUserEntity entity1 = tUserService.login(entity);
|
||||
if(ObjectUtils.isNotNull(entity1)){
|
||||
String token = UUID.randomUUID()+"";
|
||||
redisCache.set(token,entity1);
|
||||
return Result.ok(token);
|
||||
return Result.ok(entity1);
|
||||
}else {
|
||||
return Result.error("登录失败");
|
||||
}
|
||||
|
@ -76,6 +73,9 @@ public class TUserController {
|
|||
@Operation(summary = "退出登录")
|
||||
public Result<String> logout(HttpServletRequest request) {
|
||||
String token = request.getHeader("token");
|
||||
if (token == null) {
|
||||
return Result.error("token为空");
|
||||
}
|
||||
Object o = redisCache.get(token);
|
||||
if (o != null) {
|
||||
redisCache.delete(token);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.maku.maku.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -38,8 +39,9 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
|||
|
||||
private LambdaQueryWrapper<TUserEntity> getWrapper(TUserQuery query){
|
||||
LambdaQueryWrapper<TUserEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(ObjectUtils.isNotEmpty(query.getUsername()), TUserEntity::getUsername, query.getUsername());
|
||||
wrapper.eq(ObjectUtils.isNotEmpty(query.getStatus()), TUserEntity::getStatus, query.getStatus());
|
||||
wrapper.like(TUserEntity::getUsername, query.getUsername());
|
||||
wrapper.eq(ObjectUtil.isNotNull(query.getStatus()), TUserEntity::getStatus, query.getStatus());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
@ -70,6 +72,9 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
|||
wrapper.eq(TUserEntity::getPassword, entity.getPassword());
|
||||
TUserEntity one = getOne(wrapper);
|
||||
if(ObjectUtils.isNotNull(one)) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
one.setAvatar(uuid.toString());
|
||||
updateById(one);
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user