| | |
| | | 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 = 3) |
| | | @ApiOperation(value = "不分页", notes = "传入gdManageDevice") |
| | | public R<List<GdManageDeviceVO>> page(GdManageDeviceVO gdManageDevice) { |
| | | List<GdManageDeviceVO> pages = gdManageDeviceService.selectGdManageDevice(gdManageDevice); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | |
| | | @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))); |
| | | } |
| | | |
| | | /** |