Commit 363afc19 authored by 李灿灿's avatar 李灿灿

查询一条时按创建时间倒序

parent 29668d7c
......@@ -391,6 +391,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
BeanCopyUtils.copyProperties(detail,newDetail);
......@@ -429,6 +430,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
replace.setToInsuranceDetailId(newDetail.getId());
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, detail.getId())
.orderByDesc(TInsuranceReplace::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(one).isPresent()){
......@@ -540,6 +542,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceCompany::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceCompany).isPresent()){
return R.failed(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
......@@ -551,6 +555,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceType::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceType).isPresent()){
return R.failed(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
......@@ -560,6 +566,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeStandard::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()){
return R.failed(InsurancesConstants.BUY_STANDARD_NOT_EXIST);
......@@ -579,6 +587,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeRate::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
......@@ -614,6 +623,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(insuranceDetail).isPresent() && !insuranceDetail.getId().equals(param.getId())){
......@@ -645,6 +655,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
......@@ -684,6 +695,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, byId.getId())
.orderByDesc(TInsuranceReplace::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()){
TInsuranceDetail insuranceDetail = this.getById(one.getFromInsuranceDetailId());
......@@ -810,6 +822,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listVO.setRemark(InsurancesConstants.ADD);
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, listVO.getId())
.orderByDesc(TInsuranceReplace::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()){
TInsuranceDetail byId = this.getById(one.getFromInsuranceDetailId());
......@@ -1134,6 +1147,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (StringUtils.isNotBlank(success.getInvoiceNo())){
......@@ -1428,6 +1442,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceCompany::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceCompany).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
......@@ -1441,6 +1457,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceType::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceType).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
......@@ -1452,6 +1470,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeStandard::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EXIST);
......@@ -1473,6 +1493,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeRate::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
......@@ -1522,6 +1543,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(insuranceDetail).isPresent()){
......@@ -1556,6 +1578,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
......@@ -1789,6 +1812,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(limitOne).isPresent()){
......@@ -1804,6 +1828,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceCompany::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceCompany).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
......@@ -1817,6 +1843,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceType::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(insuranceType).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
......@@ -1828,6 +1856,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeStandard::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EXIST);
......@@ -1849,6 +1879,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceTypeRate::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
......@@ -1909,6 +1940,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(insuranceDetail).isPresent()){
......@@ -2116,6 +2148,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
......@@ -2201,6 +2234,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(replace).isPresent()){
......@@ -2234,6 +2268,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
......@@ -2334,6 +2369,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
......@@ -2361,6 +2397,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail batchPolicyNo = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(batchPolicyNo).isPresent()){
......@@ -2384,6 +2421,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail addPolicyNo = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(addPolicyNo).isPresent()){
......
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