liyong
昨天 af107f8697ed128acfe7fca372ca365ac597d6cf
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
package com.ruoyi.device.controller;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.device.service.IDeviceLedgerService;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
 
@Api(tags = "设备台账管理")
@RequestMapping("/device/ledger")
@RestController
public class DeviceLedgerController {
 
    @Autowired
    private IDeviceLedgerService deviceLedgerService;
 
    @ApiModelProperty("设备台账列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceLedger deviceLedger) {
        return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger));
    }
 
    @PostMapping()
    @ApiModelProperty("添加设备台账")
    public AjaxResult add(DeviceLedger deviceLedger) {
 
        return deviceLedgerService.saveDeviceLedger(deviceLedger);
    }
 
    @ApiModelProperty("根据id查询设备台账")
    @GetMapping("/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(deviceLedgerService.getById(id));
    }
 
    @PutMapping ()
    @ApiModelProperty("修改设备台账")
    public AjaxResult update(DeviceLedger deviceLedger) {
 
        return deviceLedgerService.updateDeviceLedger(deviceLedger);
    }
 
    @DeleteMapping("/{id}")
    @ApiModelProperty("删除设备台账")
    public AjaxResult delete(@PathVariable ArrayList<Long> ids) {
        boolean b = deviceLedgerService.removeBatchByIds(ids);
        if (!b) {
            return AjaxResult.error("删除失败");
        }
        return AjaxResult.success();
    }
 
    @GetMapping("export")
    @ApiModelProperty("导出设备台账")
    public void export(HttpServletResponse response, ArrayList<Long> ids) {
         deviceLedgerService.export(response, ids);
    }
}