forked from xuwujing/springBoot-study
-
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
Showing
8 changed files
with
257 additions
and
98 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 was deleted.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
springboot-aspect/src/main/java/com/pancm/result/ResultBody.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,55 @@ | ||
package com.pancm.result; | ||
|
||
/** | ||
* | ||
* @Title: ResultBody | ||
* @Description: 返回格式 | ||
* @Version:1.0.0 | ||
* @author pancm | ||
* @date 2018年3月7日 | ||
*/ | ||
public class ResultBody { | ||
/** | ||
* 响应代码 | ||
*/ | ||
private String code; | ||
|
||
/** | ||
* 响应消息 | ||
*/ | ||
private String message; | ||
|
||
/** | ||
* 响应结果 | ||
*/ | ||
private String result; | ||
|
||
public ResultBody() { | ||
} | ||
|
||
|
||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getResult() { | ||
return result; | ||
} | ||
|
||
public void setResult(String result) { | ||
this.result = result; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
springboot-aspect/src/main/java/com/pancm/web/UserRestController.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,44 @@ | ||
package com.pancm.web; | ||
|
||
import com.pancm.pojo.User; | ||
import com.pancm.result.ResultBody; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
/** | ||
* | ||
* @Title: UserRestController | ||
* @Description: | ||
* 用户控制层 | ||
* @Version:1.0.0 | ||
* @author pancm | ||
* @date 2018年3月19日 | ||
*/ | ||
@RestController | ||
@RequestMapping(value = "/api") | ||
public class UserRestController { | ||
|
||
|
||
@GetMapping("/user") | ||
public ResultBody findByUser(User user) { | ||
ResultBody resultBody = new ResultBody(); | ||
List<User> userList =new ArrayList<>(); | ||
User user2=new User(); | ||
user2.setId(1L); | ||
user2.setName("xuwujing"); | ||
user2.setAge(18); | ||
userList.add(user2); | ||
resultBody.setCode("0"); | ||
resultBody.setResult(userList.toString()); | ||
return resultBody; | ||
} | ||
|
||
|
||
|
||
|
||
} |
Oops, something went wrong.