Compare commits
No commits in common. "a487ac06f6251ff67a85a8aabcfe28c910b65141" and "2a35ec21520622238a0e5a411c32b7ecad7827b1" have entirely different histories.
a487ac06f6
...
2a35ec2152
|
@ -8,9 +8,12 @@ auth:
|
|||
- /swagger-ui.html
|
||||
- /swagger-ui/**
|
||||
- /doc.html
|
||||
- /
|
||||
- /maku/t_user/login
|
||||
- /maku/t_user/updateUser
|
||||
- /maku/t_user/register
|
||||
- /maku/t_user/logout
|
||||
- /maku/t_user/info
|
||||
- /user/login
|
||||
- /maku/t_book/list/search
|
||||
- /maku/t_book/{id}
|
||||
- /user/login
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.maku.maku.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -15,14 +13,13 @@ import net.maku.maku.entity.TUserEntity;
|
|||
import net.maku.maku.service.TUserService;
|
||||
import net.maku.maku.query.TUserQuery;
|
||||
import net.maku.maku.vo.TUserVO;
|
||||
import oracle.jdbc.proxy.annotation.Post;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -40,7 +37,6 @@ public class TUserController {
|
|||
private final TUserService tUserService;
|
||||
private final RedisCache redisCache;
|
||||
|
||||
|
||||
@PostMapping("/register")
|
||||
@Operation(summary = "注册")
|
||||
public ResponseEntity<Result<String>> register(@RequestBody TUserEntity entity) {
|
||||
|
@ -60,7 +56,7 @@ public class TUserController {
|
|||
TUserEntity entity1 = tUserService.login(entity);
|
||||
if(ObjectUtils.isNotNull(entity1)){
|
||||
String token = UUID.randomUUID()+"";
|
||||
redisCache.set(token, entity1);
|
||||
redisCache.set(token,entity1);
|
||||
return Result.ok(token);
|
||||
}else {
|
||||
return Result.error("登录失败");
|
||||
|
@ -68,7 +64,7 @@ public class TUserController {
|
|||
}
|
||||
|
||||
|
||||
@PutMapping("/updateUser")
|
||||
@GetMapping("/updateUser")
|
||||
@Operation(summary = "修改")
|
||||
public Result<TUserVO> updateUser(@RequestBody TUserVO vo){
|
||||
TUserVO tUserVO = tUserService.updateUser(vo);
|
||||
|
@ -76,15 +72,6 @@ public class TUserController {
|
|||
return Result.ok(tUserVO);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "用户中心")
|
||||
public Result findByUsername(HttpServletRequest request){
|
||||
String token = request.getHeader("token");
|
||||
TUserEntity entity = (TUserEntity) redisCache.get(token);
|
||||
return Result.ok(entity);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/logout")
|
||||
@Operation(summary = "退出登录")
|
||||
public Result<String> logout(HttpServletRequest request) {
|
||||
|
@ -94,7 +81,7 @@ public class TUserController {
|
|||
redisCache.delete(token);
|
||||
return Result.ok("退出登录");
|
||||
}
|
||||
return Result.error("登出失败");
|
||||
return Result.error("登录失败");
|
||||
}
|
||||
|
||||
@GetMapping("page")
|
||||
|
|
|
@ -78,7 +78,6 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
|||
@Override
|
||||
public TUserVO updateUser(TUserVO vo) {
|
||||
TUserEntity entity = new TUserEntity();
|
||||
entity.setId(vo.getId());
|
||||
entity.setUsername(vo.getUsername());
|
||||
entity.setPassword(vo.getPassword());
|
||||
updateById(entity);
|
||||
|
|
Loading…
Reference in New Issue
Block a user