package com.zy.controller;
|
|
|
import com.zy.entity.User;
|
import com.zy.service.UserService;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
@RestController
|
public class UserController {
|
|
@DubboReference(timeout = 1000, check = false)//远程注入
|
private UserService userService;
|
|
|
@GetMapping("/user")
|
public String user() {
|
User user = userService.queryUser();
|
return user.toString();
|
}
|
|
@GetMapping("/get")
|
public String get() {
|
return userService.get("user");
|
}
|
|
@GetMapping("/add")
|
public String add() {
|
userService.add("user", "123");
|
return "ok";
|
}
|
|
@GetMapping("/user3")
|
public List<User> user3() {
|
return userService.getDataByMySql();
|
|
}
|
}
|