Commit 20eb3f2a authored by renjie's avatar renjie

过滤bug

parent 77dba7c2
...@@ -7,7 +7,7 @@ public class ShopFilterDto { ...@@ -7,7 +7,7 @@ public class ShopFilterDto {
private String shopName; private String shopName;
private String IpRegion; private String IpRegion;
private String shopAccount; private String shopAccount;
private boolean bindIp; private int bindIp;
public String getShopAccount() { public String getShopAccount() {
return shopAccount; return shopAccount;
...@@ -33,11 +33,11 @@ public class ShopFilterDto { ...@@ -33,11 +33,11 @@ public class ShopFilterDto {
this.shopName = shopName; this.shopName = shopName;
} }
public boolean isBindIp() { public int getBindIp() {
return bindIp; return bindIp;
} }
public void setBindIp(boolean bindIp) { public void setBindIp(int bindIp) {
this.bindIp = bindIp; this.bindIp = bindIp;
} }
} }
...@@ -10,6 +10,7 @@ public interface UserShopRepository extends MongoRepository<UserShop, String>, U ...@@ -10,6 +10,7 @@ public interface UserShopRepository extends MongoRepository<UserShop, String>, U
List<UserShop> findByUsernameAndIpIdIsNull(String username); List<UserShop> findByUsernameAndIpIdIsNull(String username);
UserShop findByUsernameAndShopId(String username, String shopId); UserShop findByUsernameAndShopId(String username, String shopId);
UserShop findByShopId(String shopId); UserShop findByShopId(String shopId);
List<UserShop> findByUsernameAndGroupId(String username, String groupId);
List<UserShop> findByUsernameAndGroupIdAndIpIdIsNull(String username, String groupId); List<UserShop> findByUsernameAndGroupIdAndIpIdIsNull(String username, String groupId);
List<UserShop> findByUsernameAndGroupIdAndIpIdIsNotNull(String username, String groupId); List<UserShop> findByUsernameAndGroupIdAndIpIdIsNotNull(String username, String groupId);
List<UserShop> findByUsernameAndShopIdIn(String username, List<String> shopIds); List<UserShop> findByUsernameAndShopIdIn(String username, List<String> shopIds);
......
...@@ -359,14 +359,20 @@ public class ShopServiceImpl implements ShopService { ...@@ -359,14 +359,20 @@ public class ShopServiceImpl implements ShopService {
} }
List<String> shopIds = new ArrayList<>(); List<String> shopIds = new ArrayList<>();
if (groupId.equals("-1")) { if (groupId.equals("-1")) {
if (shopFilterDto.isBindIp()) if (shopFilterDto.getBindIp() == 0)
shopIds = userShopRepository.findByUsername(username).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
else if (shopFilterDto.getBindIp() == 1)
shopIds = userShopRepository.findByUsernameAndIpIdIsNotNull(username).stream(). shopIds = userShopRepository.findByUsernameAndIpIdIsNotNull(username).stream().
map(x -> x.getShopId()).collect(Collectors.toList()); map(x -> x.getShopId()).collect(Collectors.toList());
else else
shopIds = userShopRepository.findByUsernameAndIpIdIsNull(username).stream(). shopIds = userShopRepository.findByUsernameAndIpIdIsNull(username).stream().
map(x -> x.getShopId()).collect(Collectors.toList()); map(x -> x.getShopId()).collect(Collectors.toList());
} else { } else {
if (shopFilterDto.isBindIp()) if (shopFilterDto.getBindIp() == 0)
shopIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
else if (shopFilterDto.getBindIp() == 1)
shopIds = userShopRepository.findByUsernameAndGroupIdAndIpIdIsNotNull(username, groupId).stream(). shopIds = userShopRepository.findByUsernameAndGroupIdAndIpIdIsNotNull(username, groupId).stream().
map(x -> x.getShopId()).collect(Collectors.toList()); map(x -> x.getShopId()).collect(Collectors.toList());
else else
......
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