package com.mindskip.xzs.controller.admin;
|
|
import com.github.pagehelper.PageInfo;
|
import com.mindskip.xzs.base.BaseApiController;
|
import com.mindskip.xzs.base.RestResponse;
|
import com.mindskip.xzs.domain.QuestionAnswer;
|
import com.mindskip.xzs.domain.vo.QuestionAnswerVO;
|
import com.mindskip.xzs.service.QuestionAnswerService;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* @author gonghl
|
* @since 2024/5/11 下午 3:57
|
*/
|
|
@RequiredArgsConstructor
|
@RestController("AdminQuestionAnswerController")
|
@RequestMapping("/api/admin/questionAnswer")
|
public class QuestionAnswerController extends BaseApiController {
|
|
private final QuestionAnswerService questionAnswerService;
|
|
/**
|
* 保存、修改问答
|
*/
|
@PostMapping("save")
|
public RestResponse<String> saveQuestionAnswer(@RequestBody QuestionAnswer questionAnswer) {
|
questionAnswerService.saveOrUpdate(questionAnswer);
|
return RestResponse.ok("操作成功");
|
}
|
|
/**
|
* 分页查询
|
*/
|
@PostMapping("page")
|
public RestResponse<PageInfo<QuestionAnswerVO>> page(@RequestBody QuestionAnswerVO questionAnswer) {
|
return RestResponse.ok(questionAnswerService.questionAnswerPage(questionAnswer));
|
}
|
|
/**
|
* 删除问答
|
*/
|
@PostMapping("delete/{id}")
|
public RestResponse<String> delete(@PathVariable Integer id) {
|
questionAnswerService.removeById(id);
|
return RestResponse.ok("操作成功");
|
}
|
|
/**
|
* 查询问答
|
*/
|
@PostMapping("query/{id}")
|
public RestResponse<QuestionAnswer> query(@PathVariable Integer id) {
|
return RestResponse.ok(questionAnswerService.getById(id));
|
}
|
|
/**
|
* 修改问答
|
*/
|
@PostMapping("update")
|
public RestResponse<String> update(@RequestBody QuestionAnswer questionAnswer) {
|
questionAnswerService.updateById(questionAnswer);
|
return RestResponse.ok("操作成功");
|
}
|
|
/**
|
* 修改问答状态
|
*/
|
@PostMapping("updateStatus/{id}")
|
public RestResponse<String> updateStatus(@PathVariable Integer id) {
|
questionAnswerService.updateStatus(id);
|
return RestResponse.ok("操作成功");
|
}
|
|
@GetMapping("getLastSequence")
|
public RestResponse<Integer> getLastSequence() {
|
return RestResponse.ok(questionAnswerService.getLastSequence());
|
}
|
|
}
|