Skip to content

Commit

Permalink
fix: fix device filter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sam80180 committed Dec 25, 2023
1 parent 823a634 commit 02a26e9
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,22 @@ public Page<Devices> findAll(List<String> iOSVersion, List<String> androidVersio
if (androidVersion != null || iOSVersion != null || hmVersion != null) {
chainWrapper.and(i -> {
if (androidVersion != null) {
i.or().eq(Devices::getPlatform, 1).eq(Devices::getIsHm, 0)
i.or().eq(Devices::getPlatform, PlatformType.ANDROID).eq(Devices::getIsHm, 0)
.and(j -> {
for (String v : androidVersion) {
j.or().likeRight(Devices::getVersion, v);
}
});
}
if (iOSVersion != null) {
i.or().eq(Devices::getPlatform, 2).and(j -> {
i.or().eq(Devices::getPlatform, PlatformType.IOS).and(j -> {
for (String v : iOSVersion) {
j.or().likeRight(Devices::getVersion, v);
}
});
}
if (hmVersion != null) {
i.or().eq(Devices::getPlatform, 1).eq(Devices::getIsHm, 1)
i.or().eq(Devices::getPlatform, PlatformType.ANDROID).eq(Devices::getIsHm, 1)
.and(j -> {
for (String v : hmVersion) {
j.or().likeRight(Devices::getVersion, v);
Expand Down Expand Up @@ -236,10 +236,9 @@ public Page<Devices> findAll(List<String> iOSVersion, List<String> androidVersio
}

if (StringUtils.hasText(deviceInfo)) {
chainWrapper.like(Devices::getUdId, deviceInfo)
.or().like(Devices::getModel, deviceInfo)
.or().like(Devices::getChiName, deviceInfo)
.or().like(Devices::getNickName, deviceInfo);
chainWrapper.and(q -> {
q.like(Devices::getUdId, deviceInfo).or().like(Devices::getModel, deviceInfo).or().like(Devices::getNickName, deviceInfo).or().like(Devices::getChiName, deviceInfo);
});
}

chainWrapper.last("order by case\n" +
Expand Down

0 comments on commit 02a26e9

Please sign in to comment.