yaowanxin
2 天以前 5051c4082a91cbab723445dcfcea2d85770a8c97
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
package com.ruoyi.procurementrecord.controller;
 
 
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.procurementrecord.pojo.GasTankWarning;
import com.ruoyi.procurementrecord.service.GasTankWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
@RestController
@RequestMapping("/gasTankWarning")
public class GasTankWarningController {
    @Autowired
    private GasTankWarningService gasTankWarningService;
 
    @GetMapping("/listPage")
    public AjaxResult listPage(Page page, GasTankWarning gasTankWarning) {
        return AjaxResult.success(gasTankWarningService.listPage(page, gasTankWarning));
    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody GasTankWarning gasTankWarning) {
        return AjaxResult.success(gasTankWarningService.save(gasTankWarning));
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody GasTankWarning gasTankWarning) {
        return AjaxResult.success(gasTankWarningService.updateById(gasTankWarning));
    }
    @DeleteMapping("delete")
    public AjaxResult delete(@RequestBody List<Long> ids){
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(gasTankWarningService.removeByIds(ids));
    }
    //导出
    @PostMapping("/export")
    public void export(HttpServletResponse response,@RequestParam(name = "ids", required = false) List<Long> ids){
        gasTankWarningService.export(response,ids);
    }
 
}