package com.ruoyi.production.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.production.dto.ProductInspectionRecordDto;
import com.ruoyi.production.pojo.ProductInspectionRecord;
import com.ruoyi.production.service.ProductInspectionRecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
*
* 巡检记录表 前端控制器
*
*
* @author 芯导软件(江苏)有限公司
* @since 2026-03-16 04:16:32
*/
@RestController
@RequestMapping("/productInspectionRecord")
public class ProductInspectionRecordController {
@Autowired
private ProductInspectionRecordService productInspectionRecordService;
@ApiOperation("巡检记录 分页查询")
@GetMapping("listPage")
@Log(title = "巡检记录 分页查询", businessType = BusinessType.OTHER)
public AjaxResult page(ProductInspectionRecordDto productInspectionRecord, Page page) {
LambdaQueryWrapper ew = Wrappers.lambdaQuery();
ew.eq(StringUtils.isNotEmpty(productInspectionRecord.getProcess()), ProductInspectionRecord::getProcess, productInspectionRecord.getProcess())
.eq(StringUtils.isNotEmpty(productInspectionRecord.getProcessId()), ProductInspectionRecord::getProcessId, productInspectionRecord.getProcessId())
.between(Objects.nonNull(productInspectionRecord.getStartTime()) && Objects.nonNull(productInspectionRecord.getEndTime()),
ProductInspectionRecord::getInspectionTime, productInspectionRecord.getStartTime(),
productInspectionRecord.getEndTime());
return AjaxResult.success(productInspectionRecordService.page(page, ew));
}
@ApiOperation("巡检记录 新增")
@PostMapping("/addProductInspectionRecord")
@Log(title = "巡检记录 新增", businessType = BusinessType.INSERT)
public AjaxResult addProductInspectionRecord(@RequestBody ProductInspectionRecordDto productInspectionRecord) {
productInspectionRecordService.saveOrUpdate(productInspectionRecord);
return AjaxResult.success();
}
@ApiOperation("巡检记录 修改")
@PutMapping("updProductInspectionRecord")
@Log(title = "巡检记录 修改", businessType = BusinessType.UPDATE)
public AjaxResult updProductInspectionRecord(@RequestBody ProductInspectionRecordDto productInspectionRecord) {
productInspectionRecordService.updateById(productInspectionRecord);
return AjaxResult.success();
}
@ApiOperation("巡检记录 删除")
@DeleteMapping("/{ids}")
@Log(title = "巡检记录 删除", businessType = BusinessType.DELETE)
public AjaxResult delete(@PathVariable("ids") List ids) {
productInspectionRecordService.removeBatchByIds(ids);
return AjaxResult.success();
}
@ApiOperation("巡检记录 通知")
@PostMapping("/notify")
@Log(title = "巡检记录 通知", businessType = BusinessType.OTHER)
public AjaxResult notify(@RequestBody List ids) {
productInspectionRecordService.notify(ids);
return AjaxResult.success("发送通知成功");
}
}