|
|
@ -7,14 +7,13 @@ import com.xht.springboot.Service.WebHomeService;
|
|
|
|
import com.xht.springboot.Tip.RequestResult;
|
|
|
|
import com.xht.springboot.Tip.RequestResult;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
|
|
|
|
@RequestMapping("/web")
|
|
|
|
public class WebHomeController {
|
|
|
|
public class WebHomeController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
WebHomeService webHomeService;
|
|
|
|
WebHomeService webHomeService;
|
|
|
@ -34,7 +33,7 @@ public class WebHomeController {
|
|
|
|
return webHomeService.getUserReplies(commentid);
|
|
|
|
return webHomeService.getUserReplies(commentid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/posttext")
|
|
|
|
@PostMapping("/posttext")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult postText(@RequestBody UserText userText){
|
|
|
|
public RequestResult postText(@RequestBody UserText userText){
|
|
|
|
if(webHomeService.postUserText(userText)){
|
|
|
|
if(webHomeService.postUserText(userText)){
|
|
|
@ -46,9 +45,9 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/deltext")
|
|
|
|
@PostMapping("/deltext")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult deleteText(UserText userText){
|
|
|
|
public RequestResult deleteText(@RequestBody UserText userText){
|
|
|
|
if(webHomeService.deleteUserText(userText)){
|
|
|
|
if(webHomeService.deleteUserText(userText)){
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
return requestResult;
|
|
|
|
return requestResult;
|
|
|
@ -58,9 +57,9 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/updatetext")
|
|
|
|
@PostMapping("/updatetext")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult updateText(UserText userText){
|
|
|
|
public RequestResult updateText(@RequestBody UserText userText){
|
|
|
|
if(webHomeService.updateUserText(userText)){
|
|
|
|
if(webHomeService.updateUserText(userText)){
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
return requestResult;
|
|
|
|
return requestResult;
|
|
|
@ -70,13 +69,13 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/findtext")
|
|
|
|
@GetMapping("/findtext")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public List<UserText> findText(String token){
|
|
|
|
public List<UserText> findText(String token){
|
|
|
|
return webHomeService.findUserText(token);
|
|
|
|
return webHomeService.findUserText(token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/postcomment")
|
|
|
|
@PostMapping("/postcomment")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult postComment(@RequestBody UserComment userComment){
|
|
|
|
public RequestResult postComment(@RequestBody UserComment userComment){
|
|
|
|
if(webHomeService.postUserComment(userComment)){
|
|
|
|
if(webHomeService.postUserComment(userComment)){
|
|
|
@ -88,9 +87,9 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/delcomment")
|
|
|
|
@PostMapping("/delcomment")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult deleteComment(UserComment userComment){
|
|
|
|
public RequestResult deleteComment(@RequestBody UserComment userComment){
|
|
|
|
if(webHomeService.deleteUserComment(userComment)){
|
|
|
|
if(webHomeService.deleteUserComment(userComment)){
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
return requestResult;
|
|
|
|
return requestResult;
|
|
|
@ -100,9 +99,9 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/updatecomment")
|
|
|
|
@PostMapping("/updatecomment")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult updateComment(UserComment userComment){
|
|
|
|
public RequestResult updateComment(@RequestBody UserComment userComment){
|
|
|
|
if(webHomeService.updateUserComment(userComment)){
|
|
|
|
if(webHomeService.updateUserComment(userComment)){
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
return requestResult;
|
|
|
|
return requestResult;
|
|
|
@ -112,7 +111,7 @@ public class WebHomeController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/postreply")
|
|
|
|
@PostMapping("/postreply")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public RequestResult postReply(@RequestBody UserReply userReply){
|
|
|
|
public RequestResult postReply(@RequestBody UserReply userReply){
|
|
|
|
if(webHomeService.postUserReply(userReply)){
|
|
|
|
if(webHomeService.postUserReply(userReply)){
|
|
|
@ -123,4 +122,34 @@ public class WebHomeController {
|
|
|
|
return requestResult;
|
|
|
|
return requestResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/delreply")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public RequestResult deleteReply(@RequestBody UserReply userReply){
|
|
|
|
|
|
|
|
if(webHomeService.deleteUserReply(userReply)){
|
|
|
|
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
|
|
|
|
return requestResult;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
requestResult.status = RequestResult.FAIL;
|
|
|
|
|
|
|
|
return requestResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/updatereply")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public RequestResult updateReply(@RequestBody UserReply userReply){
|
|
|
|
|
|
|
|
if(webHomeService.updateUserReply(userReply)){
|
|
|
|
|
|
|
|
requestResult.status = RequestResult.OK;
|
|
|
|
|
|
|
|
return requestResult;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
requestResult.status = RequestResult.FAIL;
|
|
|
|
|
|
|
|
return requestResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/findreply")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public List<UserReply> selectReply(@RequestBody UserReply userReply){
|
|
|
|
|
|
|
|
return webHomeService.selectUserReply(userReply);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|