|
|
|
|
@ -27,10 +27,17 @@ import java.util.List;
|
|
|
|
|
@Mapper
|
|
|
|
|
public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
|
|
|
|
|
|
|
|
|
|
// 适配barCode和code两种情况
|
|
|
|
|
default String resolveCode(ErpProductPageReqVO reqVO){
|
|
|
|
|
String barCode = StringUtils.hasText(reqVO.getBarCode()) ? reqVO.getBarCode() : reqVO.getCode();
|
|
|
|
|
return barCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default PageResult<ErpProductDO> selectPage(ErpProductPageReqVO reqVO) {
|
|
|
|
|
|
|
|
|
|
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductDO>()
|
|
|
|
|
.likeIfPresent(ErpProductDO::getName, reqVO.getName())
|
|
|
|
|
.likeIfPresent(ErpProductDO::getBarCode, reqVO.getCode())
|
|
|
|
|
.likeIfPresent(ErpProductDO::getBarCode, resolveCode(reqVO))
|
|
|
|
|
.eqIfPresent(ErpProductDO::getCategoryId, reqVO.getCategoryId())
|
|
|
|
|
.betweenIfPresent(ErpProductDO::getCreateTime, reqVO.getCreateTime())
|
|
|
|
|
.orderByDesc(ErpProductDO::getId));
|
|
|
|
|
@ -47,9 +54,10 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default PageResult<ErpProductDO> selectProductCodeExist(ErpProductPageReqVO reqVO) {
|
|
|
|
|
|
|
|
|
|
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductDO>()
|
|
|
|
|
.eqIfPresent(ErpProductDO::getName, reqVO.getName())
|
|
|
|
|
.eqIfPresent(ErpProductDO::getBarCode, reqVO.getCode())
|
|
|
|
|
.eqIfPresent(ErpProductDO::getBarCode, resolveCode(reqVO))
|
|
|
|
|
.orderByAsc(ErpProductDO::getId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -62,9 +70,7 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
|
|
|
|
|
Long count = selectCount(new LambdaQueryWrapper<ErpProductDO>()
|
|
|
|
|
.eq(ErpProductDO::getName, reqVO.getName())
|
|
|
|
|
.eq(ErpProductDO::getStandard, reqVO.getStandard()));
|
|
|
|
|
|
|
|
|
|
return count > 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default Long selectCountByCategoryId(Long categoryId) {
|
|
|
|
|
|