restful api改造

This commit is contained in:
xiongxiaoyang
2020-12-12 10:03:15 +08:00
parent a8c74d061c
commit 355cb80458
35 changed files with 95 additions and 135 deletions

View File

@ -9,10 +9,7 @@ import com.java2nb.novel.service.CrawlService;
import com.java2nb.novel.vo.CrawlSingleTaskVO;
import com.java2nb.novel.vo.CrawlSourceVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author Administrator
@ -39,7 +36,7 @@ public class CrawlController {
/**
* 爬虫源分页列表查询
* */
@PostMapping("listCrawlByPage")
@GetMapping("listCrawlByPage")
public ResultBean listCrawlByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlByPage(page,pageSize), CrawlSourceVO.class)
@ -71,7 +68,7 @@ public class CrawlController {
/**
* 单本采集任务分页列表查询
* */
@PostMapping("listCrawlSingleTaskByPage")
@GetMapping("listCrawlSingleTaskByPage")
public ResultBean listCrawlSingleTaskByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
return ResultBean.ok(new PageInfo<>(BeanUtil.copyList(crawlService.listCrawlSingleTaskByPage(page,pageSize), CrawlSingleTaskVO.class)
@ -81,8 +78,8 @@ public class CrawlController {
/**
* 删除采集任务
* */
@PostMapping("delCrawlSingleTask")
public ResultBean delCrawlSingleTask(Long id){
@DeleteMapping("delCrawlSingleTask/{id}")
public ResultBean delCrawlSingleTask(@PathVariable("id") Long id){
crawlService.delCrawlSingleTask(id);

View File

@ -96,7 +96,7 @@
<script language="javascript" type="text/javascript">
$(function () {
$.ajax({
type: "POST",
type: "get",
url: "/crawl/listCrawlByPage",
data: {'curr':1,'limit':100},
dataType: "json",

View File

@ -125,7 +125,7 @@
function search(curr, limit) {
$.ajax({
type: "POST",
type: "get",
url: "/crawl/listCrawlSingleTaskByPage",
data: {'curr': curr, 'limit': limit},
dataType: "json",
@ -205,9 +205,9 @@
function del(id) {
$.ajax({
type: "POST",
url: "/crawl/delCrawlSingleTask",
data: {'id': id},
type: "delete",
url: "/crawl/delCrawlSingleTask/"+id,
data: {},
dataType: "json",
success: function (data) {
if (data.code == 200) {

View File

@ -122,7 +122,7 @@
function search(curr, limit) {
$.ajax({
type: "POST",
type: "get",
url: "/crawl/listCrawlByPage",
data: {'curr':curr,'limit':limit},
dataType: "json",