ke
2024-07-19 08a962d2925baa255207fdf979e6fee794f1773b
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
package cn.gistack.sm.sjztmd.controller;
 
import cn.gistack.sm.sjztmd.entity.TbDykeUnitDanger;
import cn.gistack.sm.sjztmd.service.ITbDykeUnitDangerService;
import cn.gistack.sm.sjztmd.vo.TbDykeUnitDangerVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
 
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
 
 
/**
 * @Author AIX
 * @Date 2024/6/28 14:12
 * @Version 1.0
 */
@Slf4j
@Api(tags = "堤防危害等级评定")
@RestController
@RequestMapping("/sjztmd/tbDykeUnitDanger")
@AllArgsConstructor
public class TbDykeUnitDangerController {
 
    private ITbDykeUnitDangerService tbDykeUnitDangerService;
 
    @ApiOperation(value = "堤防危害等级评定-危害列表", notes = "堤防危害等级评定-危害列表")
    @GetMapping(value = "/listDykeUnitDanger")
    public R listDykeUnitDanger(@ApiIgnore TbDykeUnitDangerVO vo) {
        return R.data(tbDykeUnitDangerService.listDykeUnitDanger(vo));
    }
 
    @ApiOperation(value = "堤防危害等级评定-添加或者修改", notes = "堤防危害等级评定-添加或者修改")
    @PostMapping(value = "/submit")
    public R submit(@RequestBody TbDykeUnitDanger tbDykeUnitDanger) {
        // 获取当前日期
        LocalDate today = LocalDate.now();
        // 获取年份
        int year = today.getYear();
        tbDykeUnitDanger.setCreateTime(new Date());
        tbDykeUnitDanger.setTbYear(year);
        return R.data(tbDykeUnitDangerService.saveOrUpdate(tbDykeUnitDanger));
    }
 
    @ApiOperation(value = "堤防危害等级评定-批量添加或者修改", notes = "堤防危害等级评定-添加或者修改")
    @PostMapping(value = "/submitBatch")
    public R submit(@RequestBody List<TbDykeUnitDanger> tbDykeUnitDangers) {
        return R.data(tbDykeUnitDangerService.saveOrUpdateBatch(tbDykeUnitDangers));
    }
 
}