From a70919b4f7baab856125f36e5bd41f5ee81be680 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期二, 13 五月 2025 09:41:35 +0800
Subject: [PATCH] 修改年份切换字段不为必填

---
 src/main/java/com/cl/controller/DataController.java |   55 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/cl/controller/DataController.java b/src/main/java/com/cl/controller/DataController.java
index 84deb62..4d54e09 100644
--- a/src/main/java/com/cl/controller/DataController.java
+++ b/src/main/java/com/cl/controller/DataController.java
@@ -2,9 +2,11 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
 import com.cl.common.result.Result;
 import com.cl.pojo.dto.AddDataDTO;
 
+import com.cl.pojo.dto.DataPageDTO;
 import com.cl.pojo.entity.DataEntity;
 
 import com.cl.pojo.vo.DataDetailVO;
@@ -15,11 +17,16 @@
 import com.cl.service.DataService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.time.LocalDateTime;
+import java.time.Year;
+import java.util.Date;
+import java.util.List;
 
 
 @RestController
@@ -43,25 +50,31 @@
     /**
      * 分页
      */
-    @GetMapping("/pageList")
+    @PostMapping("/pageList")
     @ApiOperation("用户分页查询")
-    public Result<IPage<DataVO>>  selectPageUser(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
-                                                 @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
-                                                 @RequestParam(value = "county",required = false)Integer county,
-                                                 @RequestParam(value = "name",required = false)String name){
-        IPage<DataEntity> page = new Page<>(pageNum, pageSize);
-        IPage<DataVO> iPage=dataService.pageList(page,county,name);
+    public Result<IPage<DataVO>>  selectPageUser(@RequestBody @Valid DataPageDTO dataPageDTO){
+        IPage<DataEntity> page = new Page<>(dataPageDTO.getPageNum(), dataPageDTO.getPageSize());
+        IPage<DataVO> iPage=dataService.pageList(page,dataPageDTO.getCountyList(),dataPageDTO.getName());
         return Result.success(iPage);
     }
 
     /**
-     * 查看详情(数据回显) 返回两次数据 查询该id和该id上一次数据   同比增加减少
+     * 列表查看详情(数据回显) 返回两次数据 查询该id和该id上一次数据   同比增加减少
      */
     @PostMapping("/detail")
     @ApiOperation("查看详情")
     public Result<DataDetailVO> detail(@RequestParam(value = "id")Integer id) {
 
         return Result.success( dataService.detail(id));
+    }
+
+    /**
+     * 新增回显
+     */
+    @PostMapping("/add/detail")
+    @ApiOperation("查看详情(新增回显上一次数据)")
+    public Result<DataDetailVO> addDetail(@RequestParam(value = "county" )Integer county) {
+        return Result.success( dataService.addDetail(county));
     }
 
     /**
@@ -89,8 +102,30 @@
      */
     @PostMapping("/screen")
     @ApiOperation("大屏数据")
-    public Result<ScreenVO> screen(@RequestParam(value = "county",required = false)Integer county) {
-        return Result.success( dataService.screen(county==null?0:county));
+    public Result<ScreenVO> screen(@RequestParam(value = "county",required = false)Integer county,
+                                   @RequestParam(value = "year",required = false)Integer year) {
+        if (year == null){
+            year = Year.now().getValue();
+        }
+        return Result.success( dataService.screen(county==null?0:county,year));
+    }
+    /**
+     * 补贴总人数
+     */
+    @GetMapping("/getAssistiveDeviceTotal")
+    @ApiOperation("补贴总人数")
+    public Result<Integer> getAssistiveDeviceTotal(@RequestParam(value = "county",required = false)Integer county,@RequestParam("year") Integer year) {
+
+        return Result.success( dataService.getAssistiveDeviceTotal(county==null?0:county,year));
+    }
+
+    /**
+     * 可选择年份列表
+     */
+    @GetMapping("/getYearList")
+    @ApiOperation("可选择年份列表")
+    public Result<List<Integer>> getYearList(@RequestParam(value = "county",required = false)Integer county) {
+        return Result.success( dataService.getYearList( county));
     }
 
 

--
Gitblit v1.7.1