APP查询条件修改

product
17602169347 2 years ago
parent ee1b2a543a
commit 467504845f

@ -59,51 +59,63 @@ public class CustomerJGServiceImpl extends ServiceImpl<CustomerJGMapper, Custome
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int customerNum =0;
int customerNum =0;
QueryWrapper<CustomerJGEntity> 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<CustomerJGEntity>)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<CustomerJGEntity>)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<CustomerJGEntity>)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<CustomerJGEntity>)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 ServiceImpl<CustomerJGMapper, Custome
}
}
if((total>0 && AllIdList.size()>0) || total==0){
Page<CustomerJGEntity> page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize());
IPage<CustomerJGEntity> userIPage=this.page(page, customerQueryWrapper);
return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal());
Page<CustomerJGEntity> page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize());
IPage<CustomerJGEntity> userIPage=this.page(page, customerQueryWrapper);
return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<CustomerJGEntity> list = new ArrayList();
return customerPagination.setData(list, list.size());
@ -129,60 +141,60 @@ public class CustomerJGServiceImpl extends ServiceImpl<CustomerJGMapper, Custome
public List<CustomerJGEntity> getTypeList(CustomerPagination customerPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int customerNum =0;
int total=0;
int customerNum =0;
QueryWrapper<CustomerJGEntity> 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<CustomerJGEntity>)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<CustomerJGEntity>)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<CustomerJGEntity>)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<CustomerJGEntity>)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();
}

@ -59,46 +59,56 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int poundlistNum =0;
int poundlistNum =0;
QueryWrapper<PoundlistEntity> 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<PoundlistEntity>)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<PoundlistEntity>)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<PoundlistEntity>)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<PoundlistEntity>)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 ServiceImpl<PoundlistMapper, Poundlist
}
}
if((total>0 && AllIdList.size()>0) || total==0){
Page<PoundlistEntity> page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
IPage<PoundlistEntity> userIPage=this.page(page, poundlistQueryWrapper);
return poundlistPagination.setData(userIPage.getRecords(),userIPage.getTotal());
Page<PoundlistEntity> page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
IPage<PoundlistEntity> userIPage=this.page(page, poundlistQueryWrapper);
return poundlistPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<PoundlistEntity> list = new ArrayList();
return poundlistPagination.setData(list, list.size());
@ -124,55 +134,55 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
public List<PoundlistEntity> getTypeList(PoundlistPagination poundlistPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int poundlistNum =0;
int total=0;
int poundlistNum =0;
QueryWrapper<PoundlistEntity> 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<PoundlistEntity>)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<PoundlistEntity>)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<PoundlistEntity>)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<PoundlistEntity>)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();
}

@ -61,51 +61,62 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, SupplierEnt
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int supplierNum =0;
int supplierNum =0;
QueryWrapper<SupplierEntity> 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<SupplierEntity>)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<SupplierEntity>)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<SupplierEntity>)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<SupplierEntity>)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 ServiceImpl<SupplierMapper, SupplierEnt
}
}
if((total>0 && AllIdList.size()>0) || total==0){
Page<SupplierEntity> page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize());
IPage<SupplierEntity> userIPage=this.page(page, supplierQueryWrapper);
return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal());
Page<SupplierEntity> page=new Page<>(supplierPagination.getCurrentPage(), supplierPagination.getPageSize());
IPage<SupplierEntity> userIPage=this.page(page, supplierQueryWrapper);
return supplierPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<SupplierEntity> list = new ArrayList();
return supplierPagination.setData(list, list.size());
@ -131,60 +142,60 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, SupplierEnt
public List<SupplierEntity> getTypeList(SupplierPagination supplierPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int supplierNum =0;
int total=0;
int supplierNum =0;
QueryWrapper<SupplierEntity> 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<SupplierEntity>)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<SupplierEntity>)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<SupplierEntity>)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<SupplierEntity>)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();
}

@ -60,51 +60,61 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, VehicleEntity
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int vehicleNum =0;
int vehicleNum =0;
QueryWrapper<VehicleEntity> 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<VehicleEntity>)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<VehicleEntity>)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<VehicleEntity>)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<VehicleEntity>)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 ServiceImpl<VehicleMapper, VehicleEntity
}
}
if((total>0 && AllIdList.size()>0) || total==0){
Page<VehicleEntity> page=new Page<>(vehiclePagination.getCurrentPage(), vehiclePagination.getPageSize());
IPage<VehicleEntity> userIPage=this.page(page, vehicleQueryWrapper);
return vehiclePagination.setData(userIPage.getRecords(),userIPage.getTotal());
Page<VehicleEntity> page=new Page<>(vehiclePagination.getCurrentPage(), vehiclePagination.getPageSize());
IPage<VehicleEntity> userIPage=this.page(page, vehicleQueryWrapper);
return vehiclePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<VehicleEntity> list = new ArrayList();
return vehiclePagination.setData(list, list.size());
@ -130,60 +140,60 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, VehicleEntity
public List<VehicleEntity> getTypeList(VehiclePagination vehiclePagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int vehicleNum =0;
int total=0;
int vehicleNum =0;
QueryWrapper<VehicleEntity> 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<VehicleEntity>)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<VehicleEntity>)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<VehicleEntity>)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<VehicleEntity>)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();
}

Loading…
Cancel
Save