From 03e22f45b1b06b68a3ba8b9390e9a5f1ddda752a Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期二, 06 五月 2025 18:29:25 +0800
Subject: [PATCH] 分页条件修改,区县可多选 token过期code改为401

---
 src/main/java/com/cl/pojo/vo/DataVO.java                        |    2 
 src/main/java/com/cl/service/impl/DataServiceImpl.java          |   15 ++
 src/main/java/com/cl/service/impl/InstitutionServiceImpl.java   |    2 
 src/main/java/com/cl/controller/InstitutionController.java      |   13 +-
 src/main/resources/mapper/DataMapper.xml                        |   98 +++++++++++++++++++
 src/main/java/com/cl/common/result/Result.java                  |    9 +
 src/main/java/com/cl/pojo/dto/InstitutionPageDTO.java           |   13 ++
 src/main/java/com/cl/pojo/entity/DataEntity.java                |    4 
 src/main/java/com/cl/mapper/InstitutionMapper.java              |    2 
 src/main/java/com/cl/interceptor/JwtTokenInterceptor.java       |    8 
 src/main/java/com/cl/pojo/dto/DataPageDTO.java                  |   13 ++
 src/main/java/com/cl/service/InstitutionService.java            |    2 
 src/main/java/com/cl/util/MD5Generator.java                     |   33 ++++++
 src/main/resources/mapper/InstitutionMapper.xml                 |    9 +
 src/main/java/com/cl/common/handler/GlobalExceptionHandler.java |   12 ++
 src/main/java/com/cl/mapper/DataMapper.java                     |    6 +
 src/main/java/com/cl/pojo/vo/InstitutionVO.java                 |    2 
 src/main/java/com/cl/service/DataService.java                   |    6 +
 src/main/java/com/cl/service/impl/UserServiceImpl.java          |    8 
 src/main/java/com/cl/controller/DataController.java             |   25 +++-
 src/main/java/com/cl/util/BCryptPasswordEncoder.java            |    8 +
 21 files changed, 253 insertions(+), 37 deletions(-)

diff --git a/src/main/java/com/cl/common/handler/GlobalExceptionHandler.java b/src/main/java/com/cl/common/handler/GlobalExceptionHandler.java
index 987f946..4ff62a2 100644
--- a/src/main/java/com/cl/common/handler/GlobalExceptionHandler.java
+++ b/src/main/java/com/cl/common/handler/GlobalExceptionHandler.java
@@ -4,6 +4,7 @@
 
 import com.cl.common.constant.MessageConstant;
 import com.cl.common.exception.BaseException;
+import com.cl.common.exception.user.InterceptorException;
 import com.cl.common.result.Result;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.ObjectError;
@@ -33,6 +34,17 @@
         return Result.error(ex.getMessage());
     }
 
+    /**
+     * 捕获业务异常
+     * @param ex
+     * @return
+     */
+    @ExceptionHandler
+    public Result loginHandler(InterceptorException ex){
+        log.error("异常信息:{}", ex.getMessage());
+        return Result.error(401,ex.getMessage());
+    }
+
 
     /**
      * 数据校验异常
diff --git a/src/main/java/com/cl/common/result/Result.java b/src/main/java/com/cl/common/result/Result.java
index 282b161..18acd50 100644
--- a/src/main/java/com/cl/common/result/Result.java
+++ b/src/main/java/com/cl/common/result/Result.java
@@ -37,10 +37,17 @@
     }
 
     public static <T> Result<T> error(String msg) {
-        Result result = new Result();
+        Result<T> result = new Result<T>();
         result.message = msg;
         result.code = 500;
         return result;
     }
 
+    public static <T> Result<T> error(Integer code,String msg) {
+        Result<T> result = new Result<T>();
+        result.message = msg;
+        result.code = code;
+        return result;
+    }
+
 }
\ No newline at end of file
diff --git a/src/main/java/com/cl/controller/DataController.java b/src/main/java/com/cl/controller/DataController.java
index 84deb62..409aac4 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,6 +17,7 @@
 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.*;
@@ -43,19 +46,16 @@
     /**
      * 分页
      */
-    @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("查看详情")
@@ -65,6 +65,15 @@
     }
 
     /**
+     * 新增回显
+     */
+    @PostMapping("/add/detail")
+    @ApiOperation("查看详情(新增回显上一次数据)")
+    public Result<DataDetailVO> addDetail(@RequestParam(value = "county" )Integer county) {
+        return Result.success( dataService.addDetail(county));
+    }
+
+    /**
      * 修改
      */
     @PutMapping("/edit")
diff --git a/src/main/java/com/cl/controller/InstitutionController.java b/src/main/java/com/cl/controller/InstitutionController.java
index 04444b5..a183e3b 100644
--- a/src/main/java/com/cl/controller/InstitutionController.java
+++ b/src/main/java/com/cl/controller/InstitutionController.java
@@ -4,7 +4,9 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cl.common.result.Result;
 import com.cl.pojo.dto.AddInstitutionDTO;
+import com.cl.pojo.dto.DataPageDTO;
 import com.cl.pojo.dto.EditInstitutionDTO;
+import com.cl.pojo.dto.InstitutionPageDTO;
 import com.cl.pojo.entity.Institution;
 import com.cl.pojo.vo.InstitutionVO;
 import com.cl.service.InstitutionService;
@@ -40,14 +42,11 @@
     /**
      * 分页
      */
-    @GetMapping("/pageList")
+    @PostMapping("/pageList")
     @ApiOperation("机构分页")
-    public Result<IPage<InstitutionVO> > pageList(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
-                                   @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
-                                   @RequestParam(value = "county",required = false)Integer county,//0-查所有
-                                   @RequestParam(value = "name",required = false)String name) {
-        IPage<Institution> page = new Page<>(pageNum, pageSize);
-        return Result.success(institutionService.pageList(page,county,name));
+    public Result<IPage<InstitutionVO> > pageList(@RequestBody @Valid InstitutionPageDTO dataPageDTO) {
+        IPage<Institution> page = new Page<>(dataPageDTO.getPageNum(), dataPageDTO.getPageSize());
+        return Result.success(institutionService.pageList(page,dataPageDTO.getCountyList(),dataPageDTO.getName()));
     }
     /**
      * 编辑回显
diff --git a/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java b/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java
index c7c53d1..e24cae3 100644
--- a/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java
+++ b/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java
@@ -87,13 +87,13 @@
             return true;
         }catch (ExpiredJwtException ex) {
             log.warn("JWT已过期,Token: {}", token);
-            throw new LoginErrorException(MessageConstant.TOKEN_EXPIRED);
+            throw new InterceptorException(MessageConstant.TOKEN_EXPIRED);
         } catch (InterceptorException ex) {
-            log.warn("JWT已过期,Token: {}", token);
-            throw new InterceptorException("该用户已被冻结");
+            log.warn("用户被删除或已被冻结,Token: {}", token);
+            throw new InterceptorException("用户被删除或已被冻结");
         }catch (Exception ex) {
             //4、不通过,响应401状态码
-            throw new LoginErrorException(MessageConstant.USER_NOT_LOGIN);
+            throw new InterceptorException(MessageConstant.USER_NOT_LOGIN);
         }
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/cl/mapper/DataMapper.java b/src/main/java/com/cl/mapper/DataMapper.java
index 11b9a8d..80b04f2 100644
--- a/src/main/java/com/cl/mapper/DataMapper.java
+++ b/src/main/java/com/cl/mapper/DataMapper.java
@@ -7,11 +7,15 @@
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 @Mapper
 public interface DataMapper extends BaseMapper<DataEntity> {
     DataEntity screen(Integer county);
 
-    IPage<DataVO> pageList(IPage<DataEntity> page, @Param("county") Integer county,@Param("name") String name);
+    IPage<DataVO> pageList(IPage<DataEntity> page, @Param("countyList") List<Integer> countyList, @Param("name") String name);
 
     DataEntity beforeOne(@Param("id") Integer id);
+
+    DataEntity getAddDetail(Integer county);
 }
diff --git a/src/main/java/com/cl/mapper/InstitutionMapper.java b/src/main/java/com/cl/mapper/InstitutionMapper.java
index 11ad97a..fe63ff2 100644
--- a/src/main/java/com/cl/mapper/InstitutionMapper.java
+++ b/src/main/java/com/cl/mapper/InstitutionMapper.java
@@ -11,7 +11,7 @@
 
 @Mapper
 public interface InstitutionMapper extends BaseMapper<Institution> {
-    IPage<InstitutionVO> pageList(IPage<Institution> page, @Param("county") Integer county, @Param("name") String name);
+    IPage<InstitutionVO> pageList(IPage<Institution> page, @Param("countyList") List<Integer> countyList, @Param("name") String name);
 
     List<InstitutionVO> getAll(@Param("county") Integer county);
 }
diff --git a/src/main/java/com/cl/pojo/dto/DataPageDTO.java b/src/main/java/com/cl/pojo/dto/DataPageDTO.java
new file mode 100644
index 0000000..ba7f7db
--- /dev/null
+++ b/src/main/java/com/cl/pojo/dto/DataPageDTO.java
@@ -0,0 +1,13 @@
+package com.cl.pojo.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DataPageDTO {
+    private Integer pageNum = 1;
+    private Integer pageSize = 10;
+    private List<Integer> countyList;
+    private String name;
+}
diff --git a/src/main/java/com/cl/pojo/dto/InstitutionPageDTO.java b/src/main/java/com/cl/pojo/dto/InstitutionPageDTO.java
new file mode 100644
index 0000000..08e0283
--- /dev/null
+++ b/src/main/java/com/cl/pojo/dto/InstitutionPageDTO.java
@@ -0,0 +1,13 @@
+package com.cl.pojo.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class InstitutionPageDTO {
+    private Integer pageNum = 1;
+    private Integer pageSize = 10;
+    private List<Integer> countyList;
+    private String name;
+}
diff --git a/src/main/java/com/cl/pojo/entity/DataEntity.java b/src/main/java/com/cl/pojo/entity/DataEntity.java
index 490ebc4..d4bd80a 100644
--- a/src/main/java/com/cl/pojo/entity/DataEntity.java
+++ b/src/main/java/com/cl/pojo/entity/DataEntity.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -22,18 +23,21 @@
     private Integer county;
 
     @ApiModelProperty(value = "调研时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime investigateTime;
 
     @ApiModelProperty(value = "创建者、调研者")
     private Integer createBy;
 
     @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     @ApiModelProperty(value = "更新者")
     private Integer updateBy;
 
     @ApiModelProperty(value = "更新时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime updateTime;
 
     @ApiModelProperty(value = "删除标志,0-未删除,1-删除")
diff --git a/src/main/java/com/cl/pojo/vo/DataVO.java b/src/main/java/com/cl/pojo/vo/DataVO.java
index 4d02bdb..8e010a5 100644
--- a/src/main/java/com/cl/pojo/vo/DataVO.java
+++ b/src/main/java/com/cl/pojo/vo/DataVO.java
@@ -10,6 +10,8 @@
 @Data
 @ApiModel("大屏分页VO")
 public class DataVO {
+    @ApiModelProperty(value = "数据id")
+    private Integer id;
     @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
     private Integer county;
 
diff --git a/src/main/java/com/cl/pojo/vo/InstitutionVO.java b/src/main/java/com/cl/pojo/vo/InstitutionVO.java
index 6108db7..3acf156 100644
--- a/src/main/java/com/cl/pojo/vo/InstitutionVO.java
+++ b/src/main/java/com/cl/pojo/vo/InstitutionVO.java
@@ -13,6 +13,8 @@
     private String name;
     @ApiModelProperty(value = "机构类型,1-残疾人定点康复机构,2-残疾人友好医疗机构")
     private Integer type;
+    @ApiModelProperty(value = "详细地址")
+    private String address;
     @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
     private Integer county;
     @ApiModelProperty(value = "联系电话")
diff --git a/src/main/java/com/cl/service/DataService.java b/src/main/java/com/cl/service/DataService.java
index a00caa0..bde639a 100644
--- a/src/main/java/com/cl/service/DataService.java
+++ b/src/main/java/com/cl/service/DataService.java
@@ -10,16 +10,20 @@
 import com.cl.pojo.vo.EditDataDTO;
 import com.cl.pojo.vo.screen.ScreenVO;
 
+import java.util.List;
+
 public interface DataService  extends IService<DataEntity> {
     ScreenVO screen(Integer county);
 
     void add( AddDataDTO addDataDTO);
 
-    IPage<DataVO> pageList(IPage<DataEntity> page,  Integer county, String name);
+    IPage<DataVO> pageList(IPage<DataEntity> page, List<Integer> county, String name);
 
     void delete(Integer id);
 
     void edit( EditDataDTO editDataDTO);
 
     DataDetailVO detail(Integer id);
+
+    DataDetailVO addDetail(Integer county);
 }
diff --git a/src/main/java/com/cl/service/InstitutionService.java b/src/main/java/com/cl/service/InstitutionService.java
index 16f3d34..45d8a49 100644
--- a/src/main/java/com/cl/service/InstitutionService.java
+++ b/src/main/java/com/cl/service/InstitutionService.java
@@ -13,7 +13,7 @@
 public interface InstitutionService  extends IService<Institution> {
     void add(@Valid AddInstitutionDTO addDTO);
 
-    IPage<InstitutionVO> pageList(IPage<Institution> page, Integer county, String name);
+    IPage<InstitutionVO> pageList(IPage<Institution> page, List<Integer> county, String name);
 
     InstitutionVO read(Integer id);
 
diff --git a/src/main/java/com/cl/service/impl/DataServiceImpl.java b/src/main/java/com/cl/service/impl/DataServiceImpl.java
index 7ca97a4..c2e9201 100644
--- a/src/main/java/com/cl/service/impl/DataServiceImpl.java
+++ b/src/main/java/com/cl/service/impl/DataServiceImpl.java
@@ -15,10 +15,12 @@
 import com.cl.pojo.vo.EditDataDTO;
 import com.cl.pojo.vo.screen.*;
 import com.cl.service.DataService;
+import io.swagger.models.auth.In;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import java.text.DecimalFormat;
 import java.time.LocalDateTime;
+import java.util.List;
 
 @Service
 public class DataServiceImpl extends ServiceImpl<DataMapper, DataEntity> implements DataService {
@@ -107,7 +109,7 @@
     }
 
     @Override
-    public IPage<DataVO> pageList(IPage<DataEntity> page, Integer county, String name) {
+    public IPage<DataVO> pageList(IPage<DataEntity> page, List<Integer> county, String name) {
         return dataMapper.pageList(page,county,name);
     }
 
@@ -175,6 +177,17 @@
         return dataDetailVO;
     }
 
+    @Override
+    public DataDetailVO addDetail(Integer county) {
+        DataDetailVO dataDetailVO = new DataDetailVO();
+        //通过区县获取上一次数据
+        DataEntity dataEntity = dataMapper.getAddDetail(county);
+        EditDataDTO editDataDTO=new EditDataDTO();
+        BeanUtils.copyProperties(dataEntity,editDataDTO);
+        dataDetailVO.setBeforeData(editDataDTO);
+        return dataDetailVO;
+    }
+
     private DataRateVO getRateVO(EditDataDTO data, EditDataDTO beforeData) {
         if (beforeData == null || beforeData.equals(new EditDataDTO())) {
             return null;
diff --git a/src/main/java/com/cl/service/impl/InstitutionServiceImpl.java b/src/main/java/com/cl/service/impl/InstitutionServiceImpl.java
index 8181bc4..70348d8 100644
--- a/src/main/java/com/cl/service/impl/InstitutionServiceImpl.java
+++ b/src/main/java/com/cl/service/impl/InstitutionServiceImpl.java
@@ -36,7 +36,7 @@
     }
 
     @Override
-    public IPage<InstitutionVO> pageList(IPage<Institution> page, Integer county, String name) {
+    public IPage<InstitutionVO> pageList(IPage<Institution> page, List<Integer> county, String name) {
         return institutionMapper.pageList(page,county,name);
     }
 
diff --git a/src/main/java/com/cl/service/impl/UserServiceImpl.java b/src/main/java/com/cl/service/impl/UserServiceImpl.java
index f29be67..588a43e 100644
--- a/src/main/java/com/cl/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/cl/service/impl/UserServiceImpl.java
@@ -84,7 +84,7 @@
         updateWrapper.set(User::getPhone, editUserDTO.getPhone());
 
         updateWrapper.set(User::getRemark, editUserDTO.getRemark());
-        updateWrapper.set(User::getUpdateBy, BaseContext.getCurrentUser().getPhone());
+        updateWrapper.set(User::getUpdateBy, BaseContext.getCurrentUser().getId());
         updateWrapper.set(User::getUpdateTime, LocalDateTime.now());
 
         int update = userMapper.update(new User(), updateWrapper);
@@ -105,7 +105,7 @@
         user.setPassword(BCryptPasswordEncoder.encode(passwordDTO.getNewPassword()));
         user.setUpdateBy(user.getId());
         user.setUpdateTime(LocalDateTime.now());
-        boolean save = this.save(user);
+        boolean save = this.updateById(user);
         if (!save) {
             throw new UserException("修改密码失败");
         }
@@ -123,7 +123,7 @@
         user.setIsFirst(1);
         user.setUpdateBy(BaseContext.getCurrentUser().getId());
         user.setUpdateTime(LocalDateTime.now());
-        boolean save = this.save(user);
+        boolean save = this.updateById(user);
         if (!save) {
             throw new UserException("重置密码失败");
         }
@@ -138,7 +138,7 @@
         user.setStatus(Objects.equals(user.getStatus(), StatusConstant.DISABLE) ? StatusConstant.ENABLE : StatusConstant.DISABLE);
         user.setUpdateBy(BaseContext.getCurrentUser().getId());
         user.setUpdateTime(LocalDateTime.now());
-        boolean save = this.save(user);
+        boolean save = this.updateById(user);
         if (!save) {
             throw new UserException("冻结/解冻用户失败");
         }
diff --git a/src/main/java/com/cl/util/BCryptPasswordEncoder.java b/src/main/java/com/cl/util/BCryptPasswordEncoder.java
index e86d62a..1373ec0 100644
--- a/src/main/java/com/cl/util/BCryptPasswordEncoder.java
+++ b/src/main/java/com/cl/util/BCryptPasswordEncoder.java
@@ -17,7 +17,11 @@
 
     public static void main(String[] args) {
         BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
-        System.out.println(encoder.encode("123456"));
-        System.out.println(DigestUtils.md5Hex("111111"));
+        String phone="19987654321";
+        System.out.println(encoder.encode(DigestUtils.md5Hex(phone.substring(phone.length() - 6))));
+
+        System.out.println(DigestUtils.md5Hex("358736"));
+
+        System.out.println(encoder.matches(DigestUtils.md5Hex("358736"), "$2a$10$lChcCpt1hN77IFSavrsXHe39hox4ggGlJZxuf7AHZ3y2qRbiJjPUy"));
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/cl/util/MD5Generator.java b/src/main/java/com/cl/util/MD5Generator.java
new file mode 100644
index 0000000..f6daed2
--- /dev/null
+++ b/src/main/java/com/cl/util/MD5Generator.java
@@ -0,0 +1,33 @@
+package com.cl.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class MD5Generator {
+    public static String generateMD5(String input) {
+        try {
+            // Create MD5 Hash
+            MessageDigest digest = MessageDigest.getInstance("MD5");
+            digest.update(input.getBytes());
+            byte messageDigest[] = digest.digest();
+ 
+            // Create Hex String
+            StringBuilder hexString = new StringBuilder();
+            for (byte aMessageDigest : messageDigest) {
+                String h = Integer.toHexString(0xFF & aMessageDigest);
+                while (h.length() < 2) h = "0" + h;
+                hexString.append(h);
+            }
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+ 
+    public static void main(String[] args) {
+        System.out.println("17912345678".substring(0, 3) + "****" + "17912345678".substring(7));
+        String myString = "358736";
+        System.err.println("MD5 of '" + myString + "' is: " + generateMD5(myString));
+    }
+}
\ No newline at end of file
diff --git a/src/main/resources/mapper/DataMapper.xml b/src/main/resources/mapper/DataMapper.xml
index 29c830f..1d78b2c 100644
--- a/src/main/resources/mapper/DataMapper.xml
+++ b/src/main/resources/mapper/DataMapper.xml
@@ -92,6 +92,7 @@
     </select>
     <select id="pageList" resultType="com.cl.pojo.vo.DataVO">
         SELECT
+            d.id,
             d.county,
             d.investigate_time,
             d.create_time,
@@ -106,8 +107,11 @@
             t_user updater ON d.update_by = updater.id
         WHERE
             d.del_flag=0
-        <if test="county != null and county != 0">
-            and d.county =#{county}
+        <if test="countyList != null and countyList.size() > 0">
+            AND d.county IN
+            <foreach collection="countyList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="name!=null and ''!=name">
             and creator.name like concat('%',#{name},'%')
@@ -124,4 +128,94 @@
         LIMIT 1;
 
     </select>
+    <select id="selectByCounty" resultType="com.cl.pojo.entity.DataEntity">
+
+    </select>
+    <select id="getAddDetail" resultType="com.cl.pojo.entity.DataEntity">
+        WITH latest_records AS (
+            SELECT
+                *,
+                ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn
+            FROM t_data
+            WHERE county=#{county} or #{county}=0 AND del_flag = 0
+        )
+        SELECT
+            create_time,
+            sum(certificate_eyesight) AS certificate_eyesight,
+            sum(certificate_intellect) AS certificate_intellect ,
+            sum(certificate_limb) AS certificate_limb ,
+            sum(certificate_speech) AS certificate_speech,
+            sum(certificate_hearing) AS certificate_hearing,
+            sum(certificate_spirit) AS certificate_spirit,
+            sum(certificate_multiple) AS certificate_multiple,
+            sum(worker_city) AS worker_city,
+            sum(worker_association) AS worker_association,
+            sum(worker_service_corps) AS worker_service_corps,
+            sum(worker_county  ) AS worker_county,
+            sum(worker_township  ) AS worker_township,
+            sum(worker_village  ) AS worker_village,
+            sum(drill_autism  ) AS drill_autism,
+            sum(drill_intellect  ) AS drill_intellect,
+            sum(drill_limb  ) AS drill_limb,
+            sum(drill_speech  ) AS drill_speech,
+            sum(drill_hearing  ) AS drill_hearing,
+            sum(drill_spirit  ) AS drill_spirit,
+            sum(salvation_before_seven  ) AS salvation_before_seven,
+            sum(salvation_after_seven  ) AS salvation_after_seven,
+            sum(salvation_autism  ) AS salvation_autism,
+            sum(salvation_intellect  ) AS salvation_intellect,
+            sum(salvation_limb  ) AS salvation_limb,
+            sum(salvation_speech  ) AS salvation_speech,
+            sum(difficulty_medication  ) AS difficulty_medication,
+            sum(difficulty_hospitalisation  ) AS difficulty_hospitalisation,
+            sum(assistive_device_total  ) AS assistive_device_total,
+            sum(assistive_device_one  ) AS assistive_device_one,
+            sum(assistive_device_two  ) AS assistive_device_two,
+            sum(assistive_device_three  ) AS assistive_device_three,
+            sum(assistive_device_other  ) AS assistive_device_other,
+            sum(assistive_device_type_one  ) AS assistive_device_type_one,
+            sum(assistive_device_type_two  ) AS assistive_device_type_two,
+            sum(assistive_device_type_three  ) AS assistive_device_type_three,
+            sum(assistive_device_type_four  ) AS assistive_device_type_four,
+            sum(assistive_device_grade_one  ) AS assistive_device_grade_one ,
+            sum( assistive_device_grade_two) as  assistive_device_grade_two,
+            sum(assistive_device_grade_three ) as  assistive_device_grade_three,
+            sum(assistive_device_grade_four ) as assistive_device_grade_four ,
+            sum(technical_training ) as technical_training ,
+            sum(home_allowance ) as home_allowance  ,
+            sum(statutory_certificate_eyesight ) as statutory_certificate_eyesight ,
+            sum(statutory_certificate_intellect ) as  statutory_certificate_intellect,
+            sum(statutory_certificate_limb ) as  statutory_certificate_limb,
+            sum(statutory_certificate_speech ) as statutory_certificate_speech ,
+            sum(statutory_certificate_hearing ) as statutory_certificate_hearing  ,
+            sum(employed_employment ) as  employed_employment,
+            sum(employed_concentrated ) as employed_concentrated ,
+            sum(employed_public_welfare ) as employed_public_welfare ,
+            sum(employed_auxiliary ) as employed_auxiliary ,
+            sum(employed_individual ) as employed_individual ,
+            sum(high_school_employment ) as high_school_employment ,
+            sum(high_school_individual ) as high_school_individual ,
+            sum(high_school_flexible ) as  high_school_flexible,
+            sum(education_one ) as  education_one,
+            sum(education_two ) as education_two ,
+            sum( education_three) as education_three ,
+            sum(education_four ) as  education_four,
+            sum(education_five ) as education_five ,
+            sum(education_six ) as education_six ,
+            sum(education_seven ) as education_seven ,
+            sum(education_eight ) as education_eight ,
+            sum(education_nine ) as education_nine ,
+            sum(education_subsidy ) as education_subsidy ,
+            sum(activity_frequency ) as  activity_frequency,
+            sum(education_number ) as education_number,
+            sum(matter) as matter,
+            sum(doctor_apprecitation) as doctor_apprecitation,
+            sum(remould) as remould,
+            sum(interviews_office) as interviews_office,
+            sum(interviews_phone) as interviews_phone ,
+            sum(interviews_superior) as interviews_superior,
+            sum(interviews_hotline) as interviews_hotline
+        FROM latest_records
+        WHERE rn = 1;
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/InstitutionMapper.xml b/src/main/resources/mapper/InstitutionMapper.xml
index 28004e2..1a33c69 100644
--- a/src/main/resources/mapper/InstitutionMapper.xml
+++ b/src/main/resources/mapper/InstitutionMapper.xml
@@ -5,13 +5,16 @@
 
     <select id="pageList" resultType="com.cl.pojo.vo.InstitutionVO">
         select
-            id , name, type, county, phone
+            id , name, type, county, phone,address
         from
             t_institution
         where
             del_flag=0
-        <if test="null!=county and county!=0">
-            and county=#{county}
+        <if test="countyList != null and countyList.size() > 0">
+            AND county IN
+            <foreach collection="countyList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="null!=name and ''!=name">
             and name like concat('%',#{name},'%')

--
Gitblit v1.7.1