大小写不敏感

This commit is contained in:
Flow 2025-08-07 11:06:09 +08:00
parent 7e15513a93
commit 647fcce907

View File

@ -351,8 +351,18 @@ public class InspectPatientServiceImpl implements InspectPatientService {
@Override
public boolean validateIdCardExists(String idCard) {
if (idCard == null || idCard.trim().isEmpty()) {
return false;
}
LambdaQueryWrapper<InspectPatientDO> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(InspectPatientDO::getCardId, idCard);
// 使用大小写不敏感的查询解决身份证号最后一位X/x的问题
lambdaQuery.and(wrapper -> wrapper
.eq(InspectPatientDO::getCardId, idCard)
.or()
.eq(InspectPatientDO::getCardId, idCard.toUpperCase())
.or()
.eq(InspectPatientDO::getCardId, idCard.toLowerCase()));
return patientMapper.selectCount(lambdaQuery) > 0;
}
@ -901,8 +911,18 @@ public class InspectPatientServiceImpl implements InspectPatientService {
@Override
public InspectPatientDO getPatientByCardId(String cardId) {
if (cardId == null || cardId.trim().isEmpty()) {
return null;
}
LambdaQueryWrapper<InspectPatientDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InspectPatientDO::getCardId, cardId);
// 使用大小写不敏感的查询解决身份证号最后一位X/x的问题
queryWrapper.and(wrapper -> wrapper
.eq(InspectPatientDO::getCardId, cardId)
.or()
.eq(InspectPatientDO::getCardId, cardId.toUpperCase())
.or()
.eq(InspectPatientDO::getCardId, cardId.toLowerCase()));
return patientMapper.selectOne(queryWrapper);
}