|
@@ -1,6 +1,5 @@
|
|
|
package com.example.test.controller;
|
|
package com.example.test.controller;
|
|
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.example.test.entity.User;
|
|
import com.example.test.entity.User;
|
|
|
import com.example.test.service.UserService;
|
|
import com.example.test.service.UserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -10,15 +9,18 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
|
-public class HelloController {
|
|
|
|
|
|
|
+public class UserController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private UserService userService;
|
|
private UserService userService;
|
|
|
|
|
+
|
|
|
@GetMapping("/")
|
|
@GetMapping("/")
|
|
|
public List<User> hello() {
|
|
public List<User> hello() {
|
|
|
- String name = "test";
|
|
|
|
|
- if(StrUtil.isNotEmpty(name)){
|
|
|
|
|
- System.out.println("name is not empty");
|
|
|
|
|
- }
|
|
|
|
|
return userService.list();
|
|
return userService.list();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/user")
|
|
|
|
|
+ public List<User> getUser() {
|
|
|
|
|
+ System.out.println("查询成功!");
|
|
|
|
|
+ return userService.getUserByNickname("建");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|