| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.sxkj.gd.common.GenericConverter; |
| | | import org.sxkj.gd.common.IdParam; |
| | | import org.sxkj.gd.workorder.dto.GdManageDeviceDTO; |
| | | import org.sxkj.gd.workorder.entity.GdManageDeviceEntity; |
| | | import org.sxkj.gd.workorder.vo.GdManageDeviceVO; |
| | | import org.sxkj.gd.workorder.excel.GdManageDeviceExcel; |
| | |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入gdManageDevice") |
| | | public R<GdManageDeviceVO> detail(GdManageDeviceEntity gdManageDevice) { |
| | | GdManageDeviceEntity detail = gdManageDeviceService.getOne(Condition.getQueryWrapper(gdManageDevice)); |
| | | public R<GdManageDeviceVO> detail(@Valid IdParam manageDevice) { |
| | | GdManageDeviceEntity detail = gdManageDeviceService.getOne(Condition.getQueryWrapper(GenericConverter.convert(manageDevice, GdManageDeviceEntity.class))); |
| | | if (detail == null) { |
| | | return R.fail("该设备不存在"); |
| | | } |
| | | return R.data(GdManageDeviceWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 设备信息 分页 |
| | | * 设备信息 自定义分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入gdManageDevice") |
| | | public R<IPage<GdManageDeviceVO>> list(@ApiIgnore @RequestParam Map<String, Object> gdManageDevice, Query query) { |
| | | IPage<GdManageDeviceEntity> pages = gdManageDeviceService.page(Condition.getPage(query), Condition.getQueryWrapper(gdManageDevice, GdManageDeviceEntity.class)); |
| | | return R.data(GdManageDeviceWrapper.build().pageVO(pages)); |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "不分页", notes = "传入gdManageDevice") |
| | | public R<List<GdManageDeviceVO>> page(GdManageDeviceVO gdManageDevice) { |
| | | List<GdManageDeviceVO> pages = gdManageDeviceService.selectGdManageDevice(gdManageDevice); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设备信息 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入gdManageDevice") |
| | | public R save(@Valid @RequestBody GdManageDeviceEntity gdManageDevice) { |
| | | return R.status(gdManageDeviceService.save(gdManageDevice)); |
| | | } |
| | | |
| | | /** |
| | | * 设备信息 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入gdManageDevice") |
| | | public R update(@Valid @RequestBody GdManageDeviceEntity gdManageDevice) { |
| | | return R.status(gdManageDeviceService.updateById(gdManageDevice)); |
| | | } |
| | | |
| | | /** |
| | | * 设备信息 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入gdManageDevice") |
| | | public R submit(@Valid @RequestBody GdManageDeviceEntity gdManageDevice) { |
| | | return R.status(gdManageDeviceService.saveOrUpdate(gdManageDevice)); |
| | | public R submit(@Valid @RequestBody GdManageDeviceDTO gdManageDevice) { |
| | | return R.status(gdManageDeviceService.saveOrUpdate(GdManageDeviceWrapper.build().entityDTO(gdManageDevice))); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/export-gdManageDevice") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiIgnore |
| | | @ApiOperation(value = "导出数据", notes = "传入gdManageDevice") |
| | | public void exportGdManageDevice(@ApiIgnore @RequestParam Map<String, Object> gdManageDevice, BladeUser bladeUser, HttpServletResponse response) { |
| | | QueryWrapper<GdManageDeviceEntity> queryWrapper = Condition.getQueryWrapper(gdManageDevice, GdManageDeviceEntity.class); |