forked from fafeidou/fast-cloud-nacos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qinfuxiang
committed
Nov 4, 2021
1 parent
603b53e
commit 35ba2f6
Showing
6 changed files
with
64 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...starter-provider/src/main/java/fast/cloud/nacos/provider/controller/V2UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package fast.cloud.nacos.provider.controller; | ||
|
||
import fast.cloud.nacos.grpc.api.entity.UserEntity; | ||
import fast.cloud.nacos.grpc.api.service.UserServiceByProtoStuff; | ||
import lombok.AllArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.List; | ||
|
||
@RestController | ||
@AllArgsConstructor | ||
@RequestMapping("/v2/user") | ||
public class V2UserController { | ||
|
||
@Resource | ||
private UserServiceByProtoStuff userServiceByProtoStuff; | ||
|
||
@PostMapping("/add") | ||
public UserEntity insertUser(@RequestBody UserEntity userEntity){ | ||
userServiceByProtoStuff.insert(userEntity); | ||
return userEntity; | ||
} | ||
|
||
@GetMapping("/list") | ||
public List<UserEntity> findAllUser(){ | ||
return userServiceByProtoStuff.findAll(); | ||
} | ||
|
||
@PostMapping("/remove") | ||
public String removeUser(@RequestParam("id") Long id){ | ||
userServiceByProtoStuff.deleteById(id); | ||
return "success"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters