Commit ad46b411 authored by renjie's avatar renjie

filter

parent 6dbd46bb
...@@ -7,6 +7,7 @@ public class ShopFilterDto { ...@@ -7,6 +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;
public String getShopAccount() { public String getShopAccount() {
return shopAccount; return shopAccount;
...@@ -31,4 +32,12 @@ public class ShopFilterDto { ...@@ -31,4 +32,12 @@ public class ShopFilterDto {
public void setShopName(String shopName) { public void setShopName(String shopName) {
this.shopName = shopName; this.shopName = shopName;
} }
public boolean isBindIp() {
return bindIp;
}
public void setBindIp(boolean bindIp) {
this.bindIp = bindIp;
}
} }
...@@ -7,9 +7,11 @@ import java.util.List; ...@@ -7,9 +7,11 @@ import java.util.List;
public interface UserShopRepository extends MongoRepository<UserShop, String>, UserShopRepositoryCustom { public interface UserShopRepository extends MongoRepository<UserShop, String>, UserShopRepositoryCustom {
List<UserShop> findByUsername(String username); List<UserShop> findByUsername(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> findByUsernameAndGroupIdAndIpIdIsNotNull(String username, String groupId);
List<UserShop> findByUsernameAndShopIdIn(String username, List<String> shopIds); List<UserShop> findByUsernameAndShopIdIn(String username, List<String> shopIds);
List<UserShop> findByUsernameAndIpIdIsNotNull(String username); List<UserShop> findByUsernameAndIpIdIsNotNull(String username);
int countByUsernameAndIpIdIsNull(String username); int countByUsernameAndIpIdIsNull(String username);
......
...@@ -359,11 +359,19 @@ public class ShopServiceImpl implements ShopService { ...@@ -359,11 +359,19 @@ public class ShopServiceImpl implements ShopService {
} }
List<String> shopIds = new ArrayList<>(); List<String> shopIds = new ArrayList<>();
if (groupId.equals("-1")) { if (groupId.equals("-1")) {
shopIds = userShopRepository.findByUsername(username).stream(). if (shopFilterDto.isBindIp())
map(x -> x.getShopId()).collect(Collectors.toList()); shopIds = userShopRepository.findByUsernameAndIpIdIsNotNull(username).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
else
shopIds = userShopRepository.findByUsernameAndIpIdIsNull(username).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
} else { } else {
shopIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream(). if (shopFilterDto.isBindIp())
map(x -> x.getShopId()).collect(Collectors.toList()); shopIds = userShopRepository.findByUsernameAndGroupIdAndIpIdIsNotNull(username, groupId).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
else
shopIds = userShopRepository.findByUsernameAndGroupIdAndIpIdIsNull(username, groupId).stream().
map(x -> x.getShopId()).collect(Collectors.toList());
} }
Page<Shop> shops; Page<Shop> shops;
if (shopFilterDto != null && StringUtils.isNotBlank(shopFilterDto.getIpRegion())) if (shopFilterDto != null && StringUtils.isNotBlank(shopFilterDto.getIpRegion()))
......
...@@ -87,7 +87,7 @@ public class FileUtil { ...@@ -87,7 +87,7 @@ public class FileUtil {
//得到指定的单元格 //得到指定的单元格
Cell cell = row.getCell(0);; Cell cell = row.getCell(0);;
int size = 1; int size = 1;
for (int i = 1; i < rowLength; i++) { for (int i = 2; i < rowLength; i++) {
row = sheet.getRow(i); row = sheet.getRow(i);
List<Object> rowvalue = new ArrayList<>(); List<Object> rowvalue = new ArrayList<>();
size = 0; size = 0;
......
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