| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设备能耗-分页查询") |
| | | @Log(title = "设备能耗-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPage(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/deviceList") |
| | | @Operation(summary = "设备台账-查询") |
| | | @Log(title = "设备台账-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult deviceList(DeviceLedger deviceLedger) { |
| | | public R<?> deviceList(DeviceLedger deviceLedger) { |
| | | List<DeviceLedger> listPage = equipmentEnergyConsumptionService.deviceList(deviceLedger); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "设备能耗-新增") |
| | | @Log(title = "设备能耗-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean save = equipmentEnergyConsumptionService.save(equipmentEnergyConsumption); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "设备能耗-批量新增") |
| | | @Log(title = "设备能耗-批量新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | public R<?> addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | boolean save = equipmentEnergyConsumptionService.saveBatch(list); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "设备能耗-修改") |
| | | @Log(title = "设备能耗-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean update = equipmentEnergyConsumptionService.updateById(equipmentEnergyConsumption); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "设备能耗-删除") |
| | | @Log(title = "设备能耗-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean remove = equipmentEnergyConsumptionService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | return remove ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导入设备能耗", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导入设备能耗") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | return equipmentEnergyConsumptionService.importData(file); |
| | | } |
| | | |
| | |
| | | @GetMapping("/listPageByTrend") |
| | | @Operation(summary = "设备能耗-能源趋势-分页查询") |
| | | @Log(title = "设备能耗-能源趋势-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPageByTrend(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | /** |