refactor(douyin): 直连商户应用首条查询改用 BaseManager.firstOpt

.last("limit 1").oneOpt() 手写死 SQL 片段且误用 oneOpt 语义,
改用项目约定的 firstOpt(方言无关分页取首条), 与 Wechat/Alipay 对仗实现一致
This commit is contained in:
DaxPay Dev
2026-07-10 10:50:58 +08:00
parent a431aa8162
commit 70308b02b8

View File

@@ -34,24 +34,20 @@ public class DouyinDirectAppManager extends BaseManager<DouyinDirectAppMapper, D
.exists();
}
/// 根据通道商户号首个应用(支付能力推导兜底)
/// 通道商户号查询首个应用(能力解析兜底时使用)
public Optional<DouyinDirectApp> findFirstByChannelMchNo(String channelMchNo) {
return lambdaQuery()
return firstOpt(q -> q
.eq(DouyinDirectApp::getChannelMchNo, channelMchNo)
.orderByAsc(DouyinDirectApp::getCreateTime)
.orderByAsc(DouyinDirectApp::getId)
.last("limit 1")
.oneOpt();
.orderByAsc(DouyinDirectApp::getId));
}
/// 根据通道商户号与应用类型首个应用(appType自动推导时调用)
/// 通道商户号与应用类型查询首个应用appType自动推导时使用)
public Optional<DouyinDirectApp> findFirstByChannelMchNoAndAppType(String channelMchNo, String appType) {
return lambdaQuery()
return firstOpt(q -> q
.eq(DouyinDirectApp::getChannelMchNo, channelMchNo)
.eq(DouyinDirectApp::getAppType, appType)
.orderByAsc(DouyinDirectApp::getCreateTime)
.orderByAsc(DouyinDirectApp::getId)
.last("limit 1")
.oneOpt();
.orderByAsc(DouyinDirectApp::getId));
}
}