|
|
|
|
@ -10,12 +10,11 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProduc
|
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductRelationRespVO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@ -34,15 +33,27 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default PageResult<ErpProductDO> selectPage(ErpProductPageReqVO reqVO) {
|
|
|
|
|
List<Long> categoryIds = selectCategoryIdsByType(reqVO.getCategoryType());
|
|
|
|
|
|
|
|
|
|
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductDO>()
|
|
|
|
|
.likeIfPresent(ErpProductDO::getName, reqVO.getName())
|
|
|
|
|
.likeIfPresent(ErpProductDO::getBarCode, resolveCode(reqVO))
|
|
|
|
|
.eqIfPresent(ErpProductDO::getCategoryId, reqVO.getCategoryId())
|
|
|
|
|
.inIfPresent(ErpProductDO::getCategoryId, categoryIds)
|
|
|
|
|
.betweenIfPresent(ErpProductDO::getCreateTime, reqVO.getCreateTime())
|
|
|
|
|
.orderByDesc(ErpProductDO::getId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default List<Long> selectCategoryIdsByType(Integer categoryType) {
|
|
|
|
|
if (categoryType == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return selectCategoryIdListByType(categoryType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Select("SELECT id FROM erp_product_category WHERE type = #{categoryType}")
|
|
|
|
|
List<Long> selectCategoryIdListByType(@Param("categoryType") Integer categoryType);
|
|
|
|
|
|
|
|
|
|
default List<ErpProductDO> selectList(ErpProductListReqVO reqVO) {
|
|
|
|
|
return selectList(new LambdaQueryWrapperX<ErpProductDO>()
|
|
|
|
|
.inIfPresent(ErpProductDO::getId, reqVO.getIds())
|
|
|
|
|
|