dcb
2025-06-19 303058307780d49e2ae4c815669f34b866206d86
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
package com.se.nsl.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.se.nsl.domain.po.Region;
import com.se.nsl.domain.vo.R;
import com.se.nsl.domain.vo.RegionVo;
import com.se.nsl.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
@Api(tags = "02-推演区域")
@Slf4j
@RestController
@RequestMapping("/region")
@SuppressWarnings("ALL")
public class RegionController extends BaseController {
    @Resource
    RegionService regionService;
 
    /**
     * 分页查询推演区域
     *
     * @param pageNum  页码
     * @param pageSize 每页数量
     * @return 分页后的推演区域
     */
    @ApiOperation(value = "selectPage")
    @GetMapping("/selectPage")
    public R<Object> selectPage(RegionVo vo, Integer pageNum, Integer pageSize) {
        try {
            if (null == pageNum || pageNum < 1) pageNum = 1;
            if (null == pageSize || pageSize < 1) pageSize = 10;
            if (pageSize > 1000) pageSize = 1000;
 
            IPage<Region> paged = regionService.selectPage(vo, pageNum, pageSize);
            if (null == paged) {
                return success(null, 0);
            }
 
            return success(paged.getRecords(), paged.getTotal());
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    /**
     * 根据ID批量删除推演区域
     *
     * @param ids 要删除的推演区域ID列表
     * @return 删除成功的记录数
     */
    @ApiOperation(value = "deleteByIds")
    @DeleteMapping("/deleteByIds")
    public R<Object> deleteByIds(@RequestParam List<Integer> ids) {
        try {
            return success(regionService.deleteByIds(ids));
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    /**
     * 新增推演区域
     *
     * @param region 推演区域对象
     * @return 新增成功的记录数
     */
    @ApiOperation(value = "insert")
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public R<Object> insert(@RequestBody Region region) {
        try {
            return success(regionService.insert(region));
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    /**
     * 修改推演区域
     *
     * @param region 推演区域对象
     * @return 修改成功的记录数
     */
    @ApiOperation(value = "updateById")
    @PutMapping(value = "/updateById", produces = "application/json; charset=UTF-8")
    public R<Object> updateById(@RequestBody Region region) {
        try {
            return success(regionService.updateById(region));
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}