|
|
|
|
@ -9,6 +9,9 @@ import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseUnitInfo;
|
|
|
|
|
import org.dromara.oa.crm.domain.CrmCustomerInfo;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseRelationMaterial;
|
|
|
|
|
import org.dromara.oa.base.domain.vo.BaseRelationMaterialVo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.oa.base.domain.bo.BaseMaterialInfoBo;
|
|
|
|
|
import org.dromara.oa.base.domain.vo.BaseMaterialInfoVo;
|
|
|
|
|
@ -141,4 +144,40 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
}
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询物料信息并关联销售物料表
|
|
|
|
|
*
|
|
|
|
|
* @param bo 查询条件
|
|
|
|
|
* @param pageQuery 分页参数
|
|
|
|
|
* @return 物料信息分页列表(包含关联的销售物料信息)
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<BaseRelationMaterialVo> queryMaterialWithRelationPageList(BaseMaterialInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildMaterialWithRelationQueryWrapper(bo);
|
|
|
|
|
Page<BaseRelationMaterialVo> result = baseMapper.selectJoinPage(pageQuery.build(), BaseRelationMaterialVo.class, lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建物料信息关联销售物料表的查询条件
|
|
|
|
|
*/
|
|
|
|
|
private MPJLambdaWrapper<BaseMaterialInfo> buildMaterialWithRelationQueryWrapper(BaseMaterialInfoBo bo) {
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = JoinWrappers.lambda(BaseMaterialInfo.class)
|
|
|
|
|
.selectAll(BaseMaterialInfo.class)
|
|
|
|
|
.select(BaseRelationMaterial::getRelationMaterialId)
|
|
|
|
|
.select(BaseRelationMaterial::getCustomerId)
|
|
|
|
|
.select(BaseRelationMaterial::getSaleMaterialName)
|
|
|
|
|
.select(BaseRelationMaterial::getSaleMaterialModel)
|
|
|
|
|
.select(CrmCustomerInfo::getCustomerName)
|
|
|
|
|
.leftJoin(BaseRelationMaterial.class, BaseRelationMaterial::getMaterialId, BaseMaterialInfo::getMaterialId)
|
|
|
|
|
.leftJoin(CrmCustomerInfo.class, CrmCustomerInfo::getCustomerId, BaseRelationMaterial::getCustomerId)
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialBrand()), BaseMaterialInfo::getMaterialBrand, bo.getMaterialBrand())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialModel()), BaseMaterialInfo::getMaterialModel, bo.getMaterialModel())
|
|
|
|
|
.eq("t.del_flag", "0")
|
|
|
|
|
.orderByDesc(BaseRelationMaterial::getRelationMaterialId);
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|