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