| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.energy; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.energy.vo.*; |
| | | import cn.iocoder.yudao.module.mes.service.energy.EnergyRecordService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - ç¬ç«è½è管ç") |
| | | @RestController |
| | | @RequestMapping("/energy/record") |
| | | @Validated |
| | | public class EnergyRecordController { |
| | | @Resource private cn.iocoder.yudao.module.mes.service.energy.EnergyExportService energyExportService; |
| | | @Resource(name = "energyRecordService") |
| | | private EnergyRecordService energyRecordService; |
| | | |
| | | @GetMapping("/export-excel") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:export')") |
| | | public void export(@Valid EnergyRecordPageReqVO req, jakarta.servlet.http.HttpServletResponse response) throws java.io.IOException { |
| | | energyExportService.records(req, response); |
| | | } |
| | | @GetMapping("/analysis-export") |
| | | @PreAuthorize("@ss.hasPermission('energy:analysis:export')") |
| | | public void exportAnalysis(@Valid EnergyAnalysisReqVO req, jakarta.servlet.http.HttpServletResponse response) throws java.io.IOException { |
| | | energyExportService.analysis(req, response); |
| | | } |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "æå¨æ°å¢è½èè®°å½") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:create')") |
| | | public CommonResult<Long> create(@Valid @RequestBody EnergyRecordSaveReqVO req) { |
| | | return success(energyRecordService.create(req)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "ä¿®æ¹è½èè®°å½") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:update')") |
| | | public CommonResult<Boolean> update(@Valid @RequestBody EnergyRecordSaveReqVO req) { |
| | | energyRecordService.update(req); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è½èè®°å½") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:delete')") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") Long id) { |
| | | energyRecordService.delete(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "æ¥çè½èè®°å½") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:query')") |
| | | public CommonResult<EnergyRecordRespVO> get(@RequestParam("id") Long id) { |
| | | return success(BeanUtils.toBean(energyRecordService.get(id), EnergyRecordRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "å页æ¥è¯¢è½èè®°å½") |
| | | @PreAuthorize("@ss.hasPermission('energy:record:query')") |
| | | public CommonResult<PageResult<EnergyRecordRespVO>> page(@Valid EnergyRecordPageReqVO req) { |
| | | return success(BeanUtils.toBean(energyRecordService.page(req), EnergyRecordRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/analysis") |
| | | @Operation(summary = "è½èæ°æ®åæï¼æè½æºå嫿±æ»ç¨éï¼") |
| | | @PreAuthorize("@ss.hasPermission('energy:analysis:query')") |
| | | public CommonResult<EnergyAnalysisRespVO> analysis(@Valid EnergyAnalysisReqVO req) { |
| | | return success(energyRecordService.analysis(req)); |
| | | } |
| | | } |