| | |
| | | |
| | | @Override |
| | | public PageData<ApplyChange> findPage(PageWrap<ApplyChange> pageWrap) { |
| | | |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | IPage<ApplyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | |
| | | queryWrapper |
| | | .selectAll(ApplyChange.class) |
| | | .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode) |
| | | .selectAs( Solutions::getType,InsuranceApply::getSolutionType) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0 )",ApplyChange::getAddNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1 )",ApplyChange::getDelNum) |
| | | .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2 )",ApplyChange::getChangeNum) |
| | | .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID )",ApplyChange::getChangeMoney) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Solutions.class,Solutions::getType,InsuranceApply::getSolutionType) |
| | | .eq(!Objects.isNull(model.getType()),ApplyChange::getType,model.getType()) |
| | | .eq(!Objects.isNull(model.getStatus())&&!model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()),ApplyChange::getStatus,model.getStatus()) |
| | | .in(!Objects.isNull(model.getStatus())&&model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()),ApplyChange::getStatus, |
| | |
| | | .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) |
| | | .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) |
| | | .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); |
| | | if(loginUserInfo.getType().equals(Constants.TWO)){ |
| | | //如果是商户查看 |
| | | if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==0){ |
| | | queryWrapper.exists("select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()); |
| | | }else if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==1){ |
| | | queryWrapper.eq(Solutions::getShopId,loginUserInfo.getCompanyId()); |
| | | }else{ |
| | | queryWrapper.apply("((t1.type=0 and exists(select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t1.company_id and cs.shop_id="+loginUserInfo.getCompanyId()+")) or (" + |
| | | "t2.type=1 and t2.shop_id="+loginUserInfo.getCompanyId()+"))") ; |
| | | } |
| | | } |
| | | |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |