Commit 8c928509 authored by 王业雄's avatar 王业雄

添加模糊查询

parent 98d74518
...@@ -42,13 +42,13 @@ public class ChannelRouteServiceImpl implements IChannelRouteService { ...@@ -42,13 +42,13 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
BooleanExpression booleanExpression = Expressions.asBoolean(true).isTrue(); BooleanExpression booleanExpression = Expressions.asBoolean(true).isTrue();
if (Objects.nonNull(channelRouteQueryVo.getChannelId())){ if (Objects.nonNull(channelRouteQueryVo.getChannelId())){
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.channelId.like(String.valueOf(channelRouteQueryVo.getChannelId()))); booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.channelId.like(channelRouteQueryVo.getChannelId() +"%"));
} }
if (Objects.nonNull(channelRouteQueryVo.getFundId())){ if (Objects.nonNull(channelRouteQueryVo.getFundId())){
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.fundId.like(String.valueOf(channelRouteQueryVo.getFundId()))); booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.fundId.like(channelRouteQueryVo.getFundId() +"%"));
} }
if (!StringUtils.isEmpty(channelRouteQueryVo.getFundName())){ if (!StringUtils.isEmpty(channelRouteQueryVo.getFundName())){
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.fundName.like(String.valueOf(channelRouteQueryVo.getFundName()))); booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.fundName.like(channelRouteQueryVo.getFundName() +"%"));
} }
if (Objects.nonNull(channelRouteQueryVo.getPublishStatus())){ if (Objects.nonNull(channelRouteQueryVo.getPublishStatus())){
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.publishStatus.eq(channelRouteQueryVo.getPublishStatus())); booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.publishStatus.eq(channelRouteQueryVo.getPublishStatus()));
......
...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.quantgroup.asset.distribution.config.code.AreaCode; import com.quantgroup.asset.distribution.config.code.AreaCode;
import com.quantgroup.asset.distribution.config.code.InitAreaCode; import com.quantgroup.asset.distribution.config.code.InitAreaCode;
import com.quantgroup.asset.distribution.constant.CommonConstants;
import com.quantgroup.asset.distribution.enums.route.SystemType; import com.quantgroup.asset.distribution.enums.route.SystemType;
import com.quantgroup.asset.distribution.model.entity.route.fundproduct.*; import com.quantgroup.asset.distribution.model.entity.route.fundproduct.*;
import com.quantgroup.asset.distribution.model.response.GlobalResponse; import com.quantgroup.asset.distribution.model.response.GlobalResponse;
...@@ -30,17 +29,12 @@ import org.springframework.data.domain.Sort; ...@@ -30,17 +29,12 @@ import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import shaded.com.google.common.collect.Lists;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
@Slf4j @Slf4j
...@@ -83,14 +77,15 @@ public class FundProductServiceImpl implements IFundProductService { ...@@ -83,14 +77,15 @@ public class FundProductServiceImpl implements IFundProductService {
//索引 和 每页大小 排序 条件 //索引 和 每页大小 排序 条件
BooleanExpression booleanExpression = Expressions.asBoolean(true).isTrue(); BooleanExpression booleanExpression = Expressions.asBoolean(true).isTrue();
log.info("fundId={}",fundProductQueryVo.getFundId());
if (Objects.nonNull(fundProductQueryVo.getFundId())){ if (Objects.nonNull(fundProductQueryVo.getFundId())){
booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundId.like(String.valueOf(fundProductQueryVo.getFundId()))); booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundId.like(fundProductQueryVo.getFundId() +"%"));
} }
if (Objects.nonNull(fundProductQueryVo.getFundProId())){ if (Objects.nonNull(fundProductQueryVo.getFundProId())){
booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundProId.like(String.valueOf(fundProductQueryVo.getFundProId()))); booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundProId.like(fundProductQueryVo.getFundProId() +"%"));
} }
if (!StringUtils.isEmpty(fundProductQueryVo.getFundName())){ if (!StringUtils.isEmpty(fundProductQueryVo.getFundName())){
booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundName.like(fundProductQueryVo.getFundName())); booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundName.like(fundProductQueryVo.getFundName()+"%"));
} }
if (!StringUtils.isEmpty(fundProductQueryVo.getFundType())){ if (!StringUtils.isEmpty(fundProductQueryVo.getFundType())){
booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundType.eq(fundProductQueryVo.getFundType())); booleanExpression = booleanExpression.and(QFundProductEntity.fundProductEntity.fundType.eq(fundProductQueryVo.getFundType()));
...@@ -111,7 +106,7 @@ public class FundProductServiceImpl implements IFundProductService { ...@@ -111,7 +106,7 @@ public class FundProductServiceImpl implements IFundProductService {
//查询总条数 //查询总条数
long count = fundProductRepository.count(booleanExpression); long count = fundProductRepository.count(booleanExpression);
//查询数据 //查询数据
Page<FundProductEntity> plantPage = fundProductRepository.findAll(booleanExpression, new PageRequest(fundProductQueryVo.getPageIndex()-1, fundProductQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt"))); Page<FundProductEntity> plantPage = fundProductRepository.findAll(booleanExpression, new PageRequest(fundProductQueryVo.getPageIndex()-1, fundProductQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "updatedAt")));
List<FundProductEntity> fundProductEntities = new ArrayList<>(); List<FundProductEntity> fundProductEntities = new ArrayList<>();
fundProductEntities = plantPage.getContent(); fundProductEntities = plantPage.getContent();
......
...@@ -43,7 +43,7 @@ public class WhiteListServiceImpl implements IWhiteListService { ...@@ -43,7 +43,7 @@ public class WhiteListServiceImpl implements IWhiteListService {
booleanExpression = booleanExpression.and(QWhiteListEntity.whiteListEntity.phone.eq(String.valueOf(whiteListQueryVo.getPhone()))); booleanExpression = booleanExpression.and(QWhiteListEntity.whiteListEntity.phone.eq(String.valueOf(whiteListQueryVo.getPhone())));
} }
if (!StringUtils.isEmpty(whiteListQueryVo.getFundName())){ if (!StringUtils.isEmpty(whiteListQueryVo.getFundName())){
booleanExpression = booleanExpression.and(QWhiteListEntity.whiteListEntity.fundName.like(String.valueOf(whiteListQueryVo.getFundName()))); booleanExpression = booleanExpression.and(QWhiteListEntity.whiteListEntity.fundName.like(whiteListQueryVo.getFundName() +"%"));
} }
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序 //1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
......
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