|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package com.logpm.basicdata.feign; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
|
|
|
|
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; |
|
|
|
@ -14,7 +16,7 @@ import java.util.List;
|
|
|
|
|
@ApiIgnore() |
|
|
|
|
@RestController |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient{ |
|
|
|
|
public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient { |
|
|
|
|
|
|
|
|
|
private final IBasicdataFactoryCategoryService factoryCategoryService; |
|
|
|
|
|
|
|
|
@ -26,11 +28,11 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
|
|
|
|
|
@Override |
|
|
|
|
public BasicdataFactoryCategoryEntity findEntityByThreeCategory(BasicdataFactoryCategoryEntity entity) { |
|
|
|
|
return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity.getFirsts()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getSeconds,entity.getSeconds()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getThirds,entity.getThirds()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getMaterielName,entity.getMaterielName()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getBrandId,entity.getBrandId()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getFirsts, entity.getFirsts()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getSeconds, entity.getSeconds()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getThirds, entity.getThirds()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getMaterielName, entity.getMaterielName()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getBrandId, entity.getBrandId()) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -40,26 +42,26 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
|
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getFirsts) |
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getSeconds) |
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getThirds) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getMaterielName,entity2.getMaterielName()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getMaterielName, entity2.getMaterielName()) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BasicdataFactoryCategoryEntity findEntityByCategoryName(BasicdataFactoryCategoryEntity entity3) { |
|
|
|
|
return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() |
|
|
|
|
return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() |
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getMaterielName) |
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getSeconds) |
|
|
|
|
.isNull(BasicdataFactoryCategoryEntity::getThirds) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getFirsts, entity3.getFirsts()) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) { |
|
|
|
|
if(StrUtil.isEmpty(factoryCategoryEntity.getBrand())){ |
|
|
|
|
if (StrUtil.isEmpty(factoryCategoryEntity.getBrand())) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if(StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())){ |
|
|
|
|
if (StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() |
|
|
|
@ -67,7 +69,44 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
|
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()) |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()) |
|
|
|
|
); |
|
|
|
|
if(CollUtil.isNotEmpty(list)){ |
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
return list.get(0); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BasicdataFactoryCategoryEntity findEntityByPaeam(BasicdataFactoryCategoryEntity factoryCategoryEntity) { |
|
|
|
|
// 没有品牌直接返回 null
|
|
|
|
|
if (StrUtil.isBlank(factoryCategoryEntity.getBrand())) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 如果都为空,则返回 null
|
|
|
|
|
if (StrUtil.isBlank(factoryCategoryEntity.getFirsts()) |
|
|
|
|
&& StrUtil.isBlank(factoryCategoryEntity.getSeconds()) |
|
|
|
|
&& StrUtil.isBlank(factoryCategoryEntity.getThirds()) |
|
|
|
|
&& StrUtil.isBlank(factoryCategoryEntity.getMaterielName())) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
LambdaQueryWrapper<BasicdataFactoryCategoryEntity> wrapper = Wrappers.<BasicdataFactoryCategoryEntity>lambdaQuery() |
|
|
|
|
.eq(BasicdataFactoryCategoryEntity::getBrand, factoryCategoryEntity.getBrand()); |
|
|
|
|
if (StrUtil.isNotEmpty(factoryCategoryEntity.getFirsts())) { |
|
|
|
|
wrapper.eq(BasicdataFactoryCategoryEntity::getFirsts, factoryCategoryEntity.getFirsts()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotEmpty(factoryCategoryEntity.getSeconds())) { |
|
|
|
|
wrapper.eq(BasicdataFactoryCategoryEntity::getSeconds, factoryCategoryEntity.getSeconds()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotEmpty(factoryCategoryEntity.getThirds())) { |
|
|
|
|
wrapper.eq(BasicdataFactoryCategoryEntity::getThirds, factoryCategoryEntity.getThirds()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotEmpty(factoryCategoryEntity.getMaterielName())) { |
|
|
|
|
wrapper.eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isNotEmpty(factoryCategoryEntity.getType())) { |
|
|
|
|
wrapper.eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()); |
|
|
|
|
} |
|
|
|
|
List<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(wrapper); |
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
return list.get(0); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|