| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/energyPeriod") |
| | | @Api(tags = "用电时段") |
| | | @Tag(name = "用电时段") |
| | | @AllArgsConstructor |
| | | public class EnergyPeriodController extends BaseController { |
| | | private final EnergyPeriodService energyPeriodService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("用电时段-分页查询") |
| | | @Operation(summary = "用电时段-分页查询") |
| | | @Log(title = "用电时段-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EnergyPeriod energyPeriod) { |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("用电时段-新增") |
| | | @Operation(summary = "用电时段-新增") |
| | | @Log(title = "用电时段-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean save = energyPeriodService.save(energyPeriod); |
| | |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @ApiOperation("用电时段-批量新增") |
| | | @Operation(summary = "用电时段-批量新增") |
| | | @Log(title = "用电时段-批量新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | boolean save = energyPeriodService.saveBatch(energyPeriods); |
| | |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("用电时段-修改") |
| | | @Operation(summary = "用电时段-修改") |
| | | @Log(title = "用电时段-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean update = energyPeriodService.updateById(energyPeriod); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("用电时段-删除") |
| | | @Operation(summary = "用电时段-删除") |
| | | @Log(title = "用电时段-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | |
| | | */ |
| | | @Log(title = "导出用电时段", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出用电时段") |
| | | @Operation(summary = "导出用电时段") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1, -1); |
| | | EnergyPeriod energyPeriod = new EnergyPeriod(); |