From 467504845fed2c079e45855487077be4ddbfbc20 Mon Sep 17 00:00:00 2001 From: 17602169347 Date: Tue, 17 Jan 2023 10:49:47 +0800 Subject: [PATCH] =?UTF-8?q?APP=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CustomerJGServiceImpl.java | 160 ++++++++++-------- .../service/impl/PoundlistServiceImpl.java | 152 +++++++++-------- .../service/impl/SupplierServiceImpl.java | 159 +++++++++-------- .../service/impl/VehicleServiceImpl.java | 158 +++++++++-------- 4 files changed, 336 insertions(+), 293 deletions(-) diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java index 0ce1aa9c..7ed9c05f 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/customer/service/impl/CustomerJGServiceImpl.java @@ -59,51 +59,63 @@ public class CustomerJGServiceImpl extends ServiceImpl AllIdList =new ArrayList(); int total=0; - int customerNum =0; + int customerNum =0; QueryWrapper customerQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); - if (ObjectUtil.isEmpty(customerObj)){ - return new ArrayList<>(); - } else { - customerQueryWrapper = (QueryWrapper)customerObj; - customerNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); - if (ObjectUtil.isEmpty(customerObj)){ - return new ArrayList<>(); - } else { - customerQueryWrapper = (QueryWrapper)customerObj; - customerNum++; - } - - - } - } - if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + + + } + } + if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ customerNum++; customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd()); - } + } - if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ + if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ customerNum++; customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm()); - } + } + + if(StringUtil.isNotEmpty(customerPagination.getKeyword())){ + customerNum++; + customerQueryWrapper.lambda().and(wq -> { + // 拼接sql + wq.like(CustomerJGEntity::getSupplierNm,customerPagination.getKeyword()) + .or() + .like(CustomerJGEntity::getOrgName,customerPagination.getKeyword()) + .or() + .like(CustomerJGEntity::getAddress,customerPagination.getKeyword()); + }); + } if(AllIdList.size()>0){ customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList); } //排序 if(StringUtil.isEmpty(customerPagination.getSidx())){ - customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); + customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); }else{ try { String sidx = customerPagination.getSidx(); @@ -117,9 +129,9 @@ public class CustomerJGServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize()); - IPage userIPage=this.page(page, customerQueryWrapper); - return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + Page page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize()); + IPage userIPage=this.page(page, customerQueryWrapper); + return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal()); }else{ List list = new ArrayList(); return customerPagination.setData(list, list.size()); @@ -129,60 +141,60 @@ public class CustomerJGServiceImpl extends ServiceImpl getTypeList(CustomerPagination customerPagination,String dataType){ String userId=userProvider.get().getUserId(); List AllIdList =new ArrayList(); - int total=0; - int customerNum =0; + int total=0; + int customerNum =0; QueryWrapper customerQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); - if (ObjectUtil.isEmpty(customerObj)){ - return new ArrayList<>(); - } else { - customerQueryWrapper = (QueryWrapper)customerObj; - customerNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); - if (ObjectUtil.isEmpty(customerObj)){ - return new ArrayList<>(); - } else { - customerQueryWrapper = (QueryWrapper)customerObj; - customerNum++; - } - - - } - } - if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer")); + if (ObjectUtil.isEmpty(customerObj)){ + return new ArrayList<>(); + } else { + customerQueryWrapper = (QueryWrapper)customerObj; + customerNum++; + } + + + } + } + if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){ customerNum++; customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd()); - } + } - if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ + if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){ customerNum++; customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm()); - } + } - if(AllIdList.size()>0){ - customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList); - } + if(AllIdList.size()>0){ + customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList); + } //排序 if(StringUtil.isEmpty(customerPagination.getSidx())){ - customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); + customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd); }else{ try { - String sidx = customerPagination.getSidx(); + String sidx = customerPagination.getSidx(); CustomerJGEntity customerEntity = new CustomerJGEntity(); - Field declaredField = customerEntity.getClass().getDeclaredField(sidx); - declaredField.setAccessible(true); - String value = declaredField.getAnnotation(TableField.class).value(); - customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value); + Field declaredField = customerEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value); } catch (NoSuchFieldException e) { e.printStackTrace(); } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java index bb3ea11a..471fc0c1 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java @@ -59,46 +59,56 @@ public class PoundlistServiceImpl extends ServiceImpl AllIdList =new ArrayList(); int total=0; - int poundlistNum =0; + int poundlistNum =0; QueryWrapper poundlistQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); - if (ObjectUtil.isEmpty(poundlistObj)){ - return new ArrayList<>(); - } else { - poundlistQueryWrapper = (QueryWrapper)poundlistObj; - poundlistNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); + if (ObjectUtil.isEmpty(poundlistObj)){ + return new ArrayList<>(); + } else { + poundlistQueryWrapper = (QueryWrapper)poundlistObj; + poundlistNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); - if (ObjectUtil.isEmpty(poundlistObj)){ - return new ArrayList<>(); - } else { - poundlistQueryWrapper = (QueryWrapper)poundlistObj; - poundlistNum++; - } - - - } - } - if(StringUtil.isNotEmpty(poundlistPagination.getMaterialName())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); + if (ObjectUtil.isEmpty(poundlistObj)){ + return new ArrayList<>(); + } else { + poundlistQueryWrapper = (QueryWrapper)poundlistObj; + poundlistNum++; + } + + + } + } + if(StringUtil.isNotEmpty(poundlistPagination.getMaterialName())){ poundlistNum++; poundlistQueryWrapper.lambda().like(PoundlistEntity::getMaterialName,poundlistPagination.getMaterialName()); - } - + } + if(StringUtil.isNotEmpty(poundlistPagination.getKeyword())){ + poundlistNum++; + poundlistQueryWrapper.lambda().and(wq -> { + // 拼接sql + wq.like(PoundlistEntity::getSupplierName,poundlistPagination.getKeyword()) + .or() + .like(PoundlistEntity::getCustomerName,poundlistPagination.getKeyword()) + .or() + .like(PoundlistEntity::getLicenseNo,poundlistPagination.getKeyword()); + }); + } if(AllIdList.size()>0){ poundlistQueryWrapper.lambda().in(PoundlistEntity::getId, AllIdList); } //排序 if(StringUtil.isEmpty(poundlistPagination.getSidx())){ - poundlistQueryWrapper.lambda().orderByDesc(PoundlistEntity::getId); + poundlistQueryWrapper.lambda().orderByDesc(PoundlistEntity::getId); }else{ try { String sidx = poundlistPagination.getSidx(); @@ -112,9 +122,9 @@ public class PoundlistServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize()); - IPage userIPage=this.page(page, poundlistQueryWrapper); - return poundlistPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + Page page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize()); + IPage userIPage=this.page(page, poundlistQueryWrapper); + return poundlistPagination.setData(userIPage.getRecords(),userIPage.getTotal()); }else{ List list = new ArrayList(); return poundlistPagination.setData(list, list.size()); @@ -124,55 +134,55 @@ public class PoundlistServiceImpl extends ServiceImpl getTypeList(PoundlistPagination poundlistPagination,String dataType){ String userId=userProvider.get().getUserId(); List AllIdList =new ArrayList(); - int total=0; - int poundlistNum =0; + int total=0; + int poundlistNum =0; QueryWrapper poundlistQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); - if (ObjectUtil.isEmpty(poundlistObj)){ - return new ArrayList<>(); - } else { - poundlistQueryWrapper = (QueryWrapper)poundlistObj; - poundlistNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); + if (ObjectUtil.isEmpty(poundlistObj)){ + return new ArrayList<>(); + } else { + poundlistQueryWrapper = (QueryWrapper)poundlistObj; + poundlistNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); - if (ObjectUtil.isEmpty(poundlistObj)){ - return new ArrayList<>(); - } else { - poundlistQueryWrapper = (QueryWrapper)poundlistObj; - poundlistNum++; - } - - - } - } - if(StringUtil.isNotEmpty(poundlistPagination.getMaterialName())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"poundlist")); + if (ObjectUtil.isEmpty(poundlistObj)){ + return new ArrayList<>(); + } else { + poundlistQueryWrapper = (QueryWrapper)poundlistObj; + poundlistNum++; + } + + + } + } + if(StringUtil.isNotEmpty(poundlistPagination.getMaterialName())){ poundlistNum++; poundlistQueryWrapper.lambda().like(PoundlistEntity::getMaterialName,poundlistPagination.getMaterialName()); - } + } - if(AllIdList.size()>0){ - poundlistQueryWrapper.lambda().in(PoundlistEntity::getId, AllIdList); - } + if(AllIdList.size()>0){ + poundlistQueryWrapper.lambda().in(PoundlistEntity::getId, AllIdList); + } //排序 if(StringUtil.isEmpty(poundlistPagination.getSidx())){ - poundlistQueryWrapper.lambda().orderByDesc(PoundlistEntity::getId); + poundlistQueryWrapper.lambda().orderByDesc(PoundlistEntity::getId); }else{ try { - String sidx = poundlistPagination.getSidx(); + String sidx = poundlistPagination.getSidx(); PoundlistEntity poundlistEntity = new PoundlistEntity(); - Field declaredField = poundlistEntity.getClass().getDeclaredField(sidx); - declaredField.setAccessible(true); - String value = declaredField.getAnnotation(TableField.class).value(); - poundlistQueryWrapper="asc".equals(poundlistPagination.getSort().toLowerCase())?poundlistQueryWrapper.orderByAsc(value):poundlistQueryWrapper.orderByDesc(value); + Field declaredField = poundlistEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + poundlistQueryWrapper="asc".equals(poundlistPagination.getSort().toLowerCase())?poundlistQueryWrapper.orderByAsc(value):poundlistQueryWrapper.orderByDesc(value); } catch (NoSuchFieldException e) { e.printStackTrace(); } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java index e73a7773..13136495 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/supplier/service/impl/SupplierServiceImpl.java @@ -61,51 +61,62 @@ public class SupplierServiceImpl extends ServiceImpl AllIdList =new ArrayList(); int total=0; - int supplierNum =0; + int supplierNum =0; QueryWrapper supplierQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); - if (ObjectUtil.isEmpty(supplierObj)){ - return new ArrayList<>(); - } else { - supplierQueryWrapper = (QueryWrapper)supplierObj; - supplierNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); - if (ObjectUtil.isEmpty(supplierObj)){ - return new ArrayList<>(); - } else { - supplierQueryWrapper = (QueryWrapper)supplierObj; - supplierNum++; - } - - - } - } - if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + + + } + } + if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ supplierNum++; supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierCode,supplierPagination.getSupplierCode()); - } + } - if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ + if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ supplierNum++; supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierName,supplierPagination.getSupplierName()); - } + } + if(StringUtil.isNotEmpty(supplierPagination.getKeyword())){ + supplierNum++; + supplierQueryWrapper.lambda().and(wq -> { + // 拼接sql + wq.like(SupplierEntity::getSupplierName,supplierPagination.getKeyword()) + .or() + .like(SupplierEntity::getCompanyName,supplierPagination.getKeyword()) + .or() + .like(SupplierEntity::getAddress,supplierPagination.getKeyword()); + }); + } if(AllIdList.size()>0){ supplierQueryWrapper.lambda().in(SupplierEntity::getId, AllIdList); } //排序 if(StringUtil.isEmpty(supplierPagination.getSidx())){ - supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); + supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); }else{ try { String sidx = supplierPagination.getSidx(); @@ -119,9 +130,9 @@ public class SupplierServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize()); - IPage userIPage=this.page(page, supplierQueryWrapper); - return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal()); + Page page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize()); + IPage userIPage=this.page(page, supplierQueryWrapper); + return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal()); }else{ List list = new ArrayList(); return supplierPagination.setData(list, list.size()); @@ -131,60 +142,60 @@ public class SupplierServiceImpl extends ServiceImpl getTypeList(SupplierPagination supplierPagination,String dataType){ String userId=userProvider.get().getUserId(); List AllIdList =new ArrayList(); - int total=0; - int supplierNum =0; + int total=0; + int supplierNum =0; QueryWrapper supplierQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); - if (ObjectUtil.isEmpty(supplierObj)){ - return new ArrayList<>(); - } else { - supplierQueryWrapper = (QueryWrapper)supplierObj; - supplierNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); - if (ObjectUtil.isEmpty(supplierObj)){ - return new ArrayList<>(); - } else { - supplierQueryWrapper = (QueryWrapper)supplierObj; - supplierNum++; - } - - - } - } - if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object supplierObj=authorizeService.getCondition(new AuthorizeConditionModel(supplierQueryWrapper,supplierPagination.getMenuId(),"supplier")); + if (ObjectUtil.isEmpty(supplierObj)){ + return new ArrayList<>(); + } else { + supplierQueryWrapper = (QueryWrapper)supplierObj; + supplierNum++; + } + + + } + } + if(StringUtil.isNotEmpty(supplierPagination.getSupplierCode())){ supplierNum++; supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierCode,supplierPagination.getSupplierCode()); - } + } - if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ + if(StringUtil.isNotEmpty(supplierPagination.getSupplierName())){ supplierNum++; supplierQueryWrapper.lambda().like(SupplierEntity::getSupplierName,supplierPagination.getSupplierName()); - } + } - if(AllIdList.size()>0){ - supplierQueryWrapper.lambda().in(SupplierEntity::getId, AllIdList); - } + if(AllIdList.size()>0){ + supplierQueryWrapper.lambda().in(SupplierEntity::getId, AllIdList); + } //排序 if(StringUtil.isEmpty(supplierPagination.getSidx())){ - supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); + supplierQueryWrapper.lambda().orderByDesc(SupplierEntity::getSupplierCode); }else{ try { - String sidx = supplierPagination.getSidx(); + String sidx = supplierPagination.getSidx(); SupplierEntity supplierEntity = new SupplierEntity(); - Field declaredField = supplierEntity.getClass().getDeclaredField(sidx); - declaredField.setAccessible(true); - String value = declaredField.getAnnotation(TableField.class).value(); - supplierQueryWrapper="asc".equals(supplierPagination.getSort().toLowerCase())?supplierQueryWrapper.orderByAsc(value):supplierQueryWrapper.orderByDesc(value); + Field declaredField = supplierEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + supplierQueryWrapper="asc".equals(supplierPagination.getSort().toLowerCase())?supplierQueryWrapper.orderByAsc(value):supplierQueryWrapper.orderByDesc(value); } catch (NoSuchFieldException e) { e.printStackTrace(); } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/vehicle/service/impl/VehicleServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/vehicle/service/impl/VehicleServiceImpl.java index 3378ae4e..a9d017ec 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/vehicle/service/impl/VehicleServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/vehicle/service/impl/VehicleServiceImpl.java @@ -60,51 +60,61 @@ public class VehicleServiceImpl extends ServiceImpl AllIdList =new ArrayList(); int total=0; - int vehicleNum =0; + int vehicleNum =0; QueryWrapper vehicleQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); - if (ObjectUtil.isEmpty(vehicleObj)){ - return new ArrayList<>(); - } else { - vehicleQueryWrapper = (QueryWrapper)vehicleObj; - vehicleNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); + if (ObjectUtil.isEmpty(vehicleObj)){ + return new ArrayList<>(); + } else { + vehicleQueryWrapper = (QueryWrapper)vehicleObj; + vehicleNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); - if (ObjectUtil.isEmpty(vehicleObj)){ - return new ArrayList<>(); - } else { - vehicleQueryWrapper = (QueryWrapper)vehicleObj; - vehicleNum++; - } - - - } - } - if(StringUtil.isNotEmpty(vehiclePagination.getTicketno())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); + if (ObjectUtil.isEmpty(vehicleObj)){ + return new ArrayList<>(); + } else { + vehicleQueryWrapper = (QueryWrapper)vehicleObj; + vehicleNum++; + } + + + } + } + if(StringUtil.isNotEmpty(vehiclePagination.getTicketno())){ vehicleNum++; vehicleQueryWrapper.lambda().like(VehicleEntity::getTicketno,vehiclePagination.getTicketno()); - } + } - if(StringUtil.isNotEmpty(vehiclePagination.getDrivername())){ + if(StringUtil.isNotEmpty(vehiclePagination.getDrivername())){ vehicleNum++; vehicleQueryWrapper.lambda().like(VehicleEntity::getDrivername,vehiclePagination.getDrivername()); - } + } + + if(StringUtil.isNotEmpty(vehiclePagination.getKeyword())){ + vehicleNum++; + vehicleQueryWrapper.lambda().and(wq -> { + // 拼接sql + wq.like(VehicleEntity::getDrivername,vehiclePagination.getKeyword()) + .or() + .like(VehicleEntity::getTicketno,vehiclePagination.getKeyword()); + }); + } if(AllIdList.size()>0){ vehicleQueryWrapper.lambda().in(VehicleEntity::getId, AllIdList); } //排序 if(StringUtil.isEmpty(vehiclePagination.getSidx())){ - vehicleQueryWrapper.lambda().orderByDesc(VehicleEntity::getId); + vehicleQueryWrapper.lambda().orderByDesc(VehicleEntity::getId); }else{ try { String sidx = vehiclePagination.getSidx(); @@ -118,9 +128,9 @@ public class VehicleServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(vehiclePagination.getCurrentPage(), vehiclePagination.getPageSize()); - IPage userIPage=this.page(page, vehicleQueryWrapper); - return vehiclePagination.setData(userIPage.getRecords(),userIPage.getTotal()); + Page page=new Page<>(vehiclePagination.getCurrentPage(), vehiclePagination.getPageSize()); + IPage userIPage=this.page(page, vehicleQueryWrapper); + return vehiclePagination.setData(userIPage.getRecords(),userIPage.getTotal()); }else{ List list = new ArrayList(); return vehiclePagination.setData(list, list.size()); @@ -130,60 +140,60 @@ public class VehicleServiceImpl extends ServiceImpl getTypeList(VehiclePagination vehiclePagination,String dataType){ String userId=userProvider.get().getUserId(); List AllIdList =new ArrayList(); - int total=0; - int vehicleNum =0; + int total=0; + int vehicleNum =0; QueryWrapper vehicleQueryWrapper=new QueryWrapper<>(); - boolean pcPermission = false; - boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); - if (ObjectUtil.isEmpty(vehicleObj)){ - return new ArrayList<>(); - } else { - vehicleQueryWrapper = (QueryWrapper)vehicleObj; - vehicleNum++; + boolean pcPermission = false; + boolean appPermission = false; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if(isPc && pcPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); + if (ObjectUtil.isEmpty(vehicleObj)){ + return new ArrayList<>(); + } else { + vehicleQueryWrapper = (QueryWrapper)vehicleObj; + vehicleNum++; + } } } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); - if (ObjectUtil.isEmpty(vehicleObj)){ - return new ArrayList<>(); - } else { - vehicleQueryWrapper = (QueryWrapper)vehicleObj; - vehicleNum++; - } - - - } - } - if(StringUtil.isNotEmpty(vehiclePagination.getTicketno())){ + if(!isPc && appPermission){ + if (!userProvider.get().getIsAdministrator()){ + Object vehicleObj=authorizeService.getCondition(new AuthorizeConditionModel(vehicleQueryWrapper,vehiclePagination.getMenuId(),"vehicle")); + if (ObjectUtil.isEmpty(vehicleObj)){ + return new ArrayList<>(); + } else { + vehicleQueryWrapper = (QueryWrapper)vehicleObj; + vehicleNum++; + } + + + } + } + if(StringUtil.isNotEmpty(vehiclePagination.getTicketno())){ vehicleNum++; vehicleQueryWrapper.lambda().like(VehicleEntity::getTicketno,vehiclePagination.getTicketno()); - } + } - if(StringUtil.isNotEmpty(vehiclePagination.getDrivername())){ + if(StringUtil.isNotEmpty(vehiclePagination.getDrivername())){ vehicleNum++; vehicleQueryWrapper.lambda().like(VehicleEntity::getDrivername,vehiclePagination.getDrivername()); - } + } - if(AllIdList.size()>0){ - vehicleQueryWrapper.lambda().in(VehicleEntity::getId, AllIdList); - } + if(AllIdList.size()>0){ + vehicleQueryWrapper.lambda().in(VehicleEntity::getId, AllIdList); + } //排序 if(StringUtil.isEmpty(vehiclePagination.getSidx())){ - vehicleQueryWrapper.lambda().orderByDesc(VehicleEntity::getId); + vehicleQueryWrapper.lambda().orderByDesc(VehicleEntity::getId); }else{ try { - String sidx = vehiclePagination.getSidx(); + String sidx = vehiclePagination.getSidx(); VehicleEntity vehicleEntity = new VehicleEntity(); - Field declaredField = vehicleEntity.getClass().getDeclaredField(sidx); - declaredField.setAccessible(true); - String value = declaredField.getAnnotation(TableField.class).value(); - vehicleQueryWrapper="asc".equals(vehiclePagination.getSort().toLowerCase())?vehicleQueryWrapper.orderByAsc(value):vehicleQueryWrapper.orderByDesc(value); + Field declaredField = vehicleEntity.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + vehicleQueryWrapper="asc".equals(vehiclePagination.getSort().toLowerCase())?vehicleQueryWrapper.orderByAsc(value):vehicleQueryWrapper.orderByDesc(value); } catch (NoSuchFieldException e) { e.printStackTrace(); }