|
|
|
|
@ -12,11 +12,11 @@ import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseMaterialInfo;
|
|
|
|
|
import org.dromara.oa.crm.domain.CrmCustomerInfo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.oa.base.domain.bo.BaseRelationMaterielBo;
|
|
|
|
|
import org.dromara.oa.base.domain.vo.BaseRelationMaterielVo;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseRelationMateriel;
|
|
|
|
|
import org.dromara.oa.base.mapper.BaseRelationMaterielMapper;
|
|
|
|
|
import org.dromara.oa.base.service.IBaseRelationMaterielService;
|
|
|
|
|
import org.dromara.oa.base.domain.bo.BaseRelationMaterialBo;
|
|
|
|
|
import org.dromara.oa.base.domain.vo.BaseRelationMaterialVo;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseRelationMaterial;
|
|
|
|
|
import org.dromara.oa.base.mapper.BaseRelationMaterialMapper;
|
|
|
|
|
import org.dromara.oa.base.service.IBaseRelationMaterialService;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@ -26,23 +26,26 @@ import java.util.Collection;
|
|
|
|
|
* 关联销售物料信息Service业务层处理
|
|
|
|
|
*
|
|
|
|
|
* @author Yinq
|
|
|
|
|
* @date 2025-09-28
|
|
|
|
|
* @date 2025-09-30
|
|
|
|
|
*/
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@Service
|
|
|
|
|
public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielService {
|
|
|
|
|
public class BaseRelationMaterialServiceImpl implements IBaseRelationMaterialService {
|
|
|
|
|
|
|
|
|
|
private final BaseRelationMaterielMapper baseMapper;
|
|
|
|
|
private final BaseRelationMaterialMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询关联销售物料信息
|
|
|
|
|
*
|
|
|
|
|
* @param relationMaterielId 主键
|
|
|
|
|
* @param relationMaterialId 主键
|
|
|
|
|
* @return 关联销售物料信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public BaseRelationMaterielVo queryById(Long relationMaterielId) {
|
|
|
|
|
return baseMapper.selectVoById(relationMaterielId);
|
|
|
|
|
public BaseRelationMaterialVo queryById(Long relationMaterialId) {
|
|
|
|
|
BaseRelationMaterialBo bo = new BaseRelationMaterialBo();
|
|
|
|
|
bo.setRelationMaterialId(relationMaterialId);
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMaterial> lqw = buildQueryWrapper(bo);
|
|
|
|
|
return baseMapper.selectVoList(lqw).get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -53,9 +56,9 @@ public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielSer
|
|
|
|
|
* @return 关联销售物料信息分页列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<BaseRelationMaterielVo> queryPageList(BaseRelationMaterielBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMateriel> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<BaseRelationMaterielVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
public TableDataInfo<BaseRelationMaterialVo> queryPageList(BaseRelationMaterialBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMaterial> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<BaseRelationMaterialVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -66,24 +69,27 @@ public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielSer
|
|
|
|
|
* @return 关联销售物料信息列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseRelationMaterielVo> queryList(BaseRelationMaterielBo bo) {
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMateriel> lqw = buildQueryWrapper(bo);
|
|
|
|
|
public List<BaseRelationMaterialVo> queryList(BaseRelationMaterialBo bo) {
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMaterial> lqw = buildQueryWrapper(bo);
|
|
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MPJLambdaWrapper<BaseRelationMateriel> buildQueryWrapper(BaseRelationMaterielBo bo) {
|
|
|
|
|
private MPJLambdaWrapper<BaseRelationMaterial> buildQueryWrapper(BaseRelationMaterialBo bo) {
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMateriel> lqw = JoinWrappers.lambda(BaseRelationMateriel.class)
|
|
|
|
|
.selectAll(BaseRelationMateriel.class)
|
|
|
|
|
MPJLambdaWrapper<BaseRelationMaterial> lqw = JoinWrappers.lambda(BaseRelationMaterial.class)
|
|
|
|
|
.selectAll(BaseRelationMaterial.class)
|
|
|
|
|
.select(BaseMaterialInfo::getMaterialCode)
|
|
|
|
|
.select(BaseMaterialInfo::getMaterialName)
|
|
|
|
|
.select(CrmCustomerInfo::getCustomerName)
|
|
|
|
|
|
|
|
|
|
.eq(bo.getCustomerId() != null, BaseRelationMateriel::getCustomerId, bo.getCustomerId())
|
|
|
|
|
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, BaseRelationMaterial::getMaterialId)
|
|
|
|
|
.leftJoin(CrmCustomerInfo.class, CrmCustomerInfo::getCustomerId, BaseRelationMaterial::getCustomerId)
|
|
|
|
|
.eq(bo.getMaterialId() != null, BaseRelationMaterial::getMaterialId, bo.getMaterialId())
|
|
|
|
|
.eq(bo.getCustomerId() != null, BaseRelationMaterial::getCustomerId, bo.getCustomerId())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getSaleMaterielName()), BaseRelationMateriel::getSaleMaterielName, bo.getSaleMaterielName())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseRelationMateriel::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getCustomerName()), CrmCustomerInfo::getCustomerName, bo.getCustomerName())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getSaleMaterialName()), BaseRelationMaterial::getSaleMaterialName, bo.getSaleMaterialName())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseRelationMaterial::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -94,11 +100,12 @@ public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielSer
|
|
|
|
|
* @return 是否新增成功
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean insertByBo(BaseRelationMaterielBo bo) {
|
|
|
|
|
BaseRelationMateriel add = MapstructUtils.convert(bo, BaseRelationMateriel.class);
|
|
|
|
|
public Boolean insertByBo(BaseRelationMaterialBo bo) {
|
|
|
|
|
BaseRelationMaterial add = MapstructUtils.convert(bo, BaseRelationMaterial.class);
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
bo.setRelationMaterialId(add.getRelationMaterialId());
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
@ -110,8 +117,8 @@ public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielSer
|
|
|
|
|
* @return 是否修改成功
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean updateByBo(BaseRelationMaterielBo bo) {
|
|
|
|
|
BaseRelationMateriel update = MapstructUtils.convert(bo, BaseRelationMateriel.class);
|
|
|
|
|
public Boolean updateByBo(BaseRelationMaterialBo bo) {
|
|
|
|
|
BaseRelationMaterial update = MapstructUtils.convert(bo, BaseRelationMaterial.class);
|
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
|
}
|
|
|
|
|
@ -119,7 +126,7 @@ public class BaseRelationMaterielServiceImpl implements IBaseRelationMaterielSer
|
|
|
|
|
/**
|
|
|
|
|
* 保存前的数据校验
|
|
|
|
|
*/
|
|
|
|
|
private void validEntityBeforeSave(BaseRelationMateriel entity) {
|
|
|
|
|
private void validEntityBeforeSave(BaseRelationMaterial entity) {
|
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
}
|
|
|
|
|
|