CollectionTaskController.java
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.viontech.fanxing.collect.controller;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.viontech.fanxing.collect.model.CollectionTask;
import com.viontech.fanxing.collect.service.CollectionTaskService;
import com.viontech.fanxing.collect.vo.CollectionTaskVo;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@RestController
@RequestMapping("/collectionTask")
public class CollectionTaskController {
@Resource
private CollectionTaskService collectionTaskService;
@GetMapping
public JsonMessageUtil.JsonMessage page(CollectionTaskVo vo) {
Page<CollectionTask> page = collectionTaskService.lambdaQuery()
.page(Page.<CollectionTask>of(vo.getPage(), vo.getPageSize()).addOrder(OrderItem.desc("create_time")));
return JsonMessageUtil.getSuccessJsonMsg(page);
}
@PostMapping
public JsonMessageUtil.JsonMessage add(CollectionTaskVo vo) throws IOException {
if (vo.getFile() != null) {
vo.setConfigFile(vo.getFile().getBytes());
}
collectionTaskService.save(vo);
return JsonMessageUtil.getSuccessJsonMsg(vo);
}
}