Merge pull request '产品物料信息增加编码搜索条件' (#1) from ck into main

Reviewed-on: #1
main
必硕 1 week ago
commit b84682b9f4

@ -27,7 +27,10 @@ public class ErpProductPageReqVO extends PageParam {
@Schema(description = "产品编号", example = "11161")
private String code;
@Schema(description = "产品编码", example = "P-001")
private String barCode;
@Schema(description = "产品规格", example = "红色")
private String standard;
}
}

@ -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) {

Loading…
Cancel
Save