| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | 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.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | |
| | | @Api(tags = "设备台账管理") |
| | | @RequestMapping("/device/ledger") |
| | |
| | | |
| | | @ApiModelProperty("设备台账列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceLedger deviceLedger) { |
| | | public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("添加设备台账") |
| | | public AjaxResult add(DeviceLedger deviceLedger) { |
| | | public AjaxResult add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | } |
| | |
| | | |
| | | @PutMapping () |
| | | @ApiModelProperty("修改设备台账") |
| | | public AjaxResult update(DeviceLedger deviceLedger) { |
| | | |
| | | public AjaxResult update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("删除设备台账") |
| | | public AjaxResult delete(@PathVariable ArrayList<Long> ids) { |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @GetMapping("export") |
| | | @PostMapping("export") |
| | | @ApiModelProperty("导出设备台账") |
| | | public void export(HttpServletResponse response, ArrayList<Long> ids) { |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceLedgerService.export(response, ids); |
| | | } |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @ApiModelProperty("获取设备台账") |
| | | public AjaxResult getDeviceLedger( ) { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | } |
| | | } |