格式化代码
Sync All Branches to GitHub / sync (push) Successful in 3s

This commit is contained in:
hanfuye
2026-01-12 19:39:33 +08:00
parent 2f001c3e9e
commit 1c1490271d
2 changed files with 13 additions and 7 deletions
@@ -15,7 +15,6 @@ import java.time.LocalDateTime;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
* *
* @author ayi * @author ayi
@@ -30,7 +29,12 @@ public class TestController {
@GetMapping("/test") @GetMapping("/test")
@ApiOperationLog(description = "测试接口") @ApiOperationLog(description = "测试接口")
public Response<User> testController() { public Response<User> testController() {
return Response.success(User.builder().id(1L).name("ayi").age(18).createTime(LocalDateTime.now()).build()); return Response.success(User.builder()
.id(1L)
.name("ayi")
.age(18)
.createTime(LocalDateTime.now())
.build());
} }
@PostMapping("/test2") @PostMapping("/test2")
@@ -42,7 +46,7 @@ public class TestController {
@RequestMapping("/user/doLogin") @RequestMapping("/user/doLogin")
public String doLogin(String username, String password) { public String doLogin(String username, String password) {
// 此处仅作模拟示例,真实项目需要从数据库中查询数据进行比对 // 此处仅作模拟示例,真实项目需要从数据库中查询数据进行比对
if("ayi".equals(username) && "12345678".equals(password)) { if ("ayi".equals(username) && "12345678".equals(password)) {
StpUtil.login(10001); StpUtil.login(10001);
return "登录成功"; return "登录成功";
} }
@@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
public class RedisTests { public class RedisTests {
@Resource @Resource
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
/** /**
@@ -27,8 +27,9 @@ public class RedisTests {
*/ */
@Test @Test
void testSetKeyValue() { void testSetKeyValue() {
// 添加一个 key 为 name, value 值为 刑加一 // 添加一个 key 为 name, value 值为 刑加一
redisTemplate.opsForValue().set("name", "刑加一"); redisTemplate.opsForValue()
.set("name", "刑加一");
} }
/** /**
@@ -44,7 +45,8 @@ public class RedisTests {
*/ */
@Test @Test
void testGetValue() { void testGetValue() {
log.info("value 值:{}", redisTemplate.opsForValue().get("name")); log.info("value 值:{}", redisTemplate.opsForValue()
.get("name"));
} }
/** /**