package com.ruoyi.project.aspen.controller; import java.util.List; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.project.aspen.domain.TElecdashboardHour; import com.ruoyi.project.aspen.service.ITElecdashboardHourService; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.web.page.TableDataInfo; /** * 电厂大屏每小时数据Controller * * @author ruoyi * @date 2022-09-14 */ @RestController @RequestMapping("/aspen/hour") public class TElecdashboardHourController extends BaseController { @Autowired private ITElecdashboardHourService tElecdashboardHourService; /** * 查询日期最靠前的24条电厂大屏每小时数据 */ @PreAuthorize("@ss.hasPermi('aspen:hour:list')") @GetMapping("/listLatest24") public TableDataInfo listLatest24() { startPage(); List list = tElecdashboardHourService.selectTElecdashboardHourListLatest24(); return getDataTable(list); } /** * 查询电厂大屏每小时数据列表 */ @PreAuthorize("@ss.hasPermi('aspen:hour:list')") @GetMapping("/list") public TableDataInfo list(TElecdashboardHour tElecdashboardHour) { startPage(); List list = tElecdashboardHourService.selectTElecdashboardHourList(tElecdashboardHour); return getDataTable(list); } /** * 导出电厂大屏每小时数据列表 */ @PreAuthorize("@ss.hasPermi('aspen:hour:export')") @Log(title = "电厂大屏每小时数据", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(TElecdashboardHour tElecdashboardHour) { List list = tElecdashboardHourService.selectTElecdashboardHourList(tElecdashboardHour); ExcelUtil util = new ExcelUtil(TElecdashboardHour.class); return util.exportExcel(list, "hour"); } /** * 获取电厂大屏每小时数据详细信息 */ @PreAuthorize("@ss.hasPermi('aspen:hour:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(tElecdashboardHourService.selectTElecdashboardHourById(id)); } /** * 新增电厂大屏每小时数据 */ @PreAuthorize("@ss.hasPermi('aspen:hour:add')") @Log(title = "电厂大屏每小时数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TElecdashboardHour tElecdashboardHour) { return toAjax(tElecdashboardHourService.insertTElecdashboardHour(tElecdashboardHour)); } /** * 修改电厂大屏每小时数据 */ @PreAuthorize("@ss.hasPermi('aspen:hour:edit')") @Log(title = "电厂大屏每小时数据", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TElecdashboardHour tElecdashboardHour) { return toAjax(tElecdashboardHourService.updateTElecdashboardHour(tElecdashboardHour)); } /** * 删除电厂大屏每小时数据 */ @PreAuthorize("@ss.hasPermi('aspen:hour:remove')") @Log(title = "电厂大屏每小时数据", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tElecdashboardHourService.deleteTElecdashboardHourByIds(ids)); } }