zhangzeli
5 天以前 7a8a994feafb8ef8333a9590bd637630c42609d6
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 
 
package com.by4cloud.platform.processing.controller;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platform.common.core.util.R;
import com.by4cloud.platform.common.log.annotation.SysLog;
import com.by4cloud.platform.processing.entity.CarAvgTare;
import com.by4cloud.platform.processing.service.CarAvgTareService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.by4cloud.platform.common.excel.annotation.ResponseExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 车重平均皮重
 *
 * @author zzl
 * @date 2025-10-19 10:35:09
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/caravgtare" )
@Api(value = "caravgtare", tags = "车重平均皮重管理")
public class CarAvgTareController {
 
    private final  CarAvgTareService carAvgTareService;
 
    /**
     * 分页查询
     * @param page 分页对
     * @param carAvgTare 车重平均皮重
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_view')" )
    public R getCarAvgTarePage(Page page, CarAvgTare carAvgTare) {
        QueryWrapper<CarAvgTare> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(StrUtil.isNotEmpty(carAvgTare.getVehicleNo()),CarAvgTare::getVehicleNo,carAvgTare.getVehicleNo());
        return R.ok(carAvgTareService.page(page,wrapper));
    }
 
 
    /**
     * 通过id查询车重平均皮重
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_view')" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(carAvgTareService.getById(id));
    }
 
    /**
     * 新增车重平均皮重
     * @param carAvgTare 车重平均皮重
     * @return R
     */
    @ApiOperation(value = "新增车重平均皮重", notes = "新增车重平均皮重")
    @SysLog("新增车重平均皮重" )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_add')" )
    public R save(@RequestBody CarAvgTare carAvgTare) {
        return R.ok(carAvgTareService.save(carAvgTare));
    }
 
    /**
     * 修改车重平均皮重
     * @param carAvgTare 车重平均皮重
     * @return R
     */
    @ApiOperation(value = "修改车重平均皮重", notes = "修改车重平均皮重")
    @SysLog("修改车重平均皮重" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_edit')" )
    public R updateById(@RequestBody CarAvgTare carAvgTare) {
        return R.ok(carAvgTareService.updateById(carAvgTare));
    }
 
    /**
     * 通过id删除车重平均皮重
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除车重平均皮重", notes = "通过id删除车重平均皮重")
    @SysLog("通过id删除车重平均皮重" )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(carAvgTareService.removeById(id));
    }
 
 
    /**
     * 导出excel 表格
     * @param carAvgTare 查询条件
     * @return excel 文件流
     */
    @ResponseExcel
    @GetMapping("/export")
    @PreAuthorize("@pms.hasPermission('processing_caravgtare_export')" )
    public List<CarAvgTare> export(CarAvgTare carAvgTare) {
        return carAvgTareService.list(Wrappers.query(carAvgTare));
    }
}