package com.iailab.module.pms.production.device.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.pms.production.device.entity.RunTimeEntity; import com.iailab.module.pms.production.device.service.RunTimeService; import com.iailab.module.pms.production.device.vo.RunTimePageReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; import static com.iailab.framework.common.pojo.CommonResult.success; /** * 运行时长统计 * * @author DongYukun * @Description * @createTime 2023年01月10日 11:15:00 */ @RestController @RequestMapping("/prod/device/runTime") public class RunTimeController { @Resource private RunTimeService runTimeService; @PostMapping("/create") @Operation(summary = "新增") public CommonResult createRunTime(@Valid @RequestBody RunTimeEntity createEntity) { return success(runTimeService.create(createEntity)); } @PutMapping("/update") @Operation(summary = "更新") public CommonResult updateRunTime(@Valid @RequestBody RunTimeEntity updateEntity) { runTimeService.update(updateEntity); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除") @Parameter(name = "id", description = "ID", required = true, example = "1024") public CommonResult deleteRunTime(@RequestParam("id") String id) { runTimeService.delete(id); return success(true); } @GetMapping("/get") @Operation(summary = "详情") @Parameter(name = "id", description = "ID", required = true, example = "1024") public CommonResult getRunTime(@RequestParam("id") String id) { RunTimeEntity data = runTimeService.getInfo(id); return success(BeanUtils.toBean(data, RunTimeEntity.class)); } @GetMapping("/page") @Operation(summary = "分页") public CommonResult> getRunTimePage(@Valid RunTimePageReqVO pageVO) { PageResult pageResult = runTimeService.getPage(pageVO); return success(BeanUtils.toBean(pageResult, RunTimeEntity.class)); } }