huminmin
5 小时以前 5929fa552fd2d8cf9d4cad0d519c89728e4a6ada
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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;
 
/**
 * <p>
 * 巡检记录表 前端控制器
 * </p>
 *
 * @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<ProductInspectionRecord> page) {
        LambdaQueryWrapper<ProductInspectionRecord> ew = Wrappers.<ProductInspectionRecord>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<Long> ids) {
        productInspectionRecordService.removeBatchByIds(ids);
        return AjaxResult.success();
    }
 
    @ApiOperation("巡检记录 通知")
    @PostMapping("/notify")
    @Log(title = "巡检记录 通知", businessType = BusinessType.OTHER)
    public AjaxResult notify(@RequestBody List<Long> ids) {
        productInspectionRecordService.notify(ids);
        return AjaxResult.success("发送通知成功");
    }
}