yuan
3 天以前 a98454d581018eeee3ca8e7f9b381bee6608eb2d
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.ruoyi.http.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.http.pojo.TqdianbiaoCollector;
import com.ruoyi.http.service.TqdianbiaoCollectorManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
@RestController
@Tag(name = "采集器档案")
@RequestMapping("/tqdianbiao/collector")
@RequiredArgsConstructor
public class TqdianbiaoCollectorController extends BaseController {
 
    private final TqdianbiaoCollectorManageService collectorManageService;
 
    @GetMapping("/listPage")
    @Operation(summary = "采集器档案-分页查询")
    public AjaxResult listPage(Page page, TqdianbiaoCollector query) {
        return AjaxResult.success(collectorManageService.listPage(page, query));
    }
 
    @GetMapping("/listAll")
    @Operation(summary = "采集器档案-全部列表")
    public AjaxResult listAll() {
        return AjaxResult.success(collectorManageService.list());
    }
 
    @PostMapping("/add")
    @Log(title = "采集器档案-新增", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody TqdianbiaoCollector collector) {
        return collectorManageService.addCollector(collector) ? AjaxResult.success() : AjaxResult.error();
    }
 
    @PostMapping("/update")
    @Log(title = "采集器档案-修改", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody TqdianbiaoCollector collector) {
        return collectorManageService.updateCollector(collector) ? AjaxResult.success() : AjaxResult.error();
    }
 
    @DeleteMapping("/delete")
    @Log(title = "采集器档案-删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        return collectorManageService.deleteByIds(ids) ? AjaxResult.success() : AjaxResult.error();
    }
 
    @PostMapping("/sync")
    @Log(title = "采集器档案-远程同步", businessType = BusinessType.OTHER)
    public AjaxResult sync() {
        int count = collectorManageService.syncFromRemote();
        return AjaxResult.success("同步成功,共同步 " + count + " 条");
    }
}