Commit 6f30b4e9 authored by zhangch's avatar zhangch

优化查询失能人员信息接口

parent dc9b9fb0
package com.hungraim.ltc.controller; package com.hungraim.ltc.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.*; import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.vo.assessment.ReTaskDistributionVO;
import com.hungraim.ltc.pojo.vo.disable.*; import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.service.DisableService; import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -368,16 +369,19 @@ public class DisableController { ...@@ -368,16 +369,19 @@ public class DisableController {
} }
/** /**
* 失能人员信息变更-列表-查看修改 * 失能人员信息修改申请详情页搜索失能人员接口
* 通过身份证搜索 *
* @param pageNum 翻页参数
* @param pageSize 翻页参数
* @param realName 失能人员姓名
* @return 返回一组人员信息
*/ */
@GetMapping("/searchByCertifNum") @GetMapping("/searchByRealName")
public Result<DisableInfoChangeDetailVo> searchByCertifNum(String certifNum) { public Result<IPage<SearchDisableSimpleVo>> searchByRealName(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, String realName) {
DisableInfoChangeDetailVo disableInfoChangeDetailVo = disableService.searchChangeByCertifNum(certifNum); if (StringUtils.isBlank(realName)) {
if (disableInfoChangeDetailVo != null) { return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
return Result.success(disableInfoChangeDetailVo);
} }
return Result.failed("数据不一致"); IPage<SearchDisableSimpleVo> searchDisableSimpleVoIPage = disableService.searchByRealName(pageNum, pageSize, realName);
return Result.success(searchDisableSimpleVoIPage);
} }
} }
package com.hungraim.ltc.service; package com.hungraim.ltc.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.*; import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.vo.disable.*; import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -120,6 +120,8 @@ public interface DisableService { ...@@ -120,6 +120,8 @@ public interface DisableService {
/** /**
* 失能人员信息变更-查看修改 * 失能人员信息变更-查看修改
*
* @return
*/ */
DisableInfoChangeDetailVo searchChangeByCertifNum(String certifNum); IPage<SearchDisableSimpleVo> searchByRealName(Integer pageNum, Integer pageSize, String realName);
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService; import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*; import com.hungraim.ltc.dao.*;
...@@ -375,13 +376,12 @@ public class DisableServiceImpl implements DisableService { ...@@ -375,13 +376,12 @@ public class DisableServiceImpl implements DisableService {
} }
@Override @Override
public DisableInfoChangeDetailVo searchChangeByCertifNum(String certifNum) { public IPage<SearchDisableSimpleVo> searchByRealName(Integer pageNum, Integer pageSize, String realName) {
ChDisableInfo chDisableInfo = disableInfoMapper.selectOne(new LambdaQueryWrapper<ChDisableInfo>().eq(ChDisableInfo::getCertiCode, certifNum)); Page<ChDisableInfo> chDisableInfoPage = disableInfoMapper.selectPage(new Page<>(pageNum, pageSize), new LambdaQueryWrapper<ChDisableInfo>().like(ChDisableInfo::getRealName, realName));
DisableInfoChangeDetailVo disableInfoChangeDetailVo = null; return chDisableInfoPage.convert(disableInfo -> {
if (chDisableInfo != null) { SearchDisableSimpleVo searchDisableSimpleVo = new SearchDisableSimpleVo();
disableInfoChangeDetailVo = new DisableInfoChangeDetailVo(); BeanUtils.copyProperties(disableInfo, searchDisableSimpleVo);
BeanUtil.copyProperties(chDisableInfo, disableInfoChangeDetailVo); return searchDisableSimpleVo;
} });
return disableInfoChangeDetailVo;
} }
} }
\ No newline at end of file
package com.hungraim.ltc.pojo.vo.disable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class SearchDisableSimpleVo {
/**
* 失能人员信息id
*/
private Integer disabInfoId;
/**
* 失能人员姓名
*/
private String realName;
/**
* 身份证号
*/
private String certiCode;
/**
* 生日
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
/**
* 性别
*/
private String gender;
/**
* 手机号码
*/
private String tel;
/**
* 诊断疾病
*/
private Integer diseTypeS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment