|
|
|
|
@ -2,13 +2,14 @@ package org.dromara.oa.base.service.impl;
|
|
|
|
|
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.oa.base.domain.BaseUnitInfo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.oa.base.domain.bo.BaseMaterialInfoBo;
|
|
|
|
|
import org.dromara.oa.base.domain.vo.BaseMaterialInfoVo;
|
|
|
|
|
@ -39,23 +40,23 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
* @return SAP物料信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public BaseMaterialInfoVo queryById(Long materialId){
|
|
|
|
|
public BaseMaterialInfoVo queryById(Long materialId) {
|
|
|
|
|
return baseMapper.selectVoById(materialId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询SAP物料信息列表
|
|
|
|
|
*
|
|
|
|
|
* @param bo 查询条件
|
|
|
|
|
* @param pageQuery 分页参数
|
|
|
|
|
* @return SAP物料信息分页列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<BaseMaterialInfoVo> queryPageList(BaseMaterialInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<BaseMaterialInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询SAP物料信息列表
|
|
|
|
|
*
|
|
|
|
|
* @param bo 查询条件
|
|
|
|
|
* @param pageQuery 分页参数
|
|
|
|
|
* @return SAP物料信息分页列表
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<BaseMaterialInfoVo> queryPageList(BaseMaterialInfoBo bo, PageQuery pageQuery) {
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<BaseMaterialInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询符合条件的SAP物料信息列表
|
|
|
|
|
@ -72,18 +73,19 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
private MPJLambdaWrapper<BaseMaterialInfo> buildQueryWrapper(BaseMaterialInfoBo bo) {
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
MPJLambdaWrapper<BaseMaterialInfo> lqw = JoinWrappers.lambda(BaseMaterialInfo.class)
|
|
|
|
|
.selectAll(BaseMaterialInfo.class)
|
|
|
|
|
.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())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialModel()), BaseMaterialInfo::getMaterialModel, bo.getMaterialModel())
|
|
|
|
|
.eq(bo.getUnitId() != null, BaseMaterialInfo::getUnitId, bo.getUnitId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialParameter()), BaseMaterialInfo::getMaterialParameter, bo.getMaterialParameter())
|
|
|
|
|
.eq(bo.getPurchasePrice() != null, BaseMaterialInfo::getPurchasePrice, bo.getPurchasePrice())
|
|
|
|
|
.eq(bo.getForeignPrice() != null, BaseMaterialInfo::getForeignPrice, bo.getForeignPrice())
|
|
|
|
|
.eq(bo.getStockingPeriod() != null, BaseMaterialInfo::getStockingPeriod, bo.getStockingPeriod())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseMaterialInfo::getActiveFlag, bo.getActiveFlag())
|
|
|
|
|
;
|
|
|
|
|
.selectAll(BaseMaterialInfo.class)
|
|
|
|
|
.select(BaseUnitInfo::getUnitName)
|
|
|
|
|
.leftJoin(BaseUnitInfo.class, BaseUnitInfo::getUnitId, BaseMaterialInfo::getUnitId)
|
|
|
|
|
.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())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialModel()), BaseMaterialInfo::getMaterialModel, bo.getMaterialModel())
|
|
|
|
|
.eq(bo.getUnitId() != null, BaseMaterialInfo::getUnitId, bo.getUnitId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getMaterialParameter()), BaseMaterialInfo::getMaterialParameter, bo.getMaterialParameter())
|
|
|
|
|
.eq(bo.getPurchasePrice() != null, BaseMaterialInfo::getPurchasePrice, bo.getPurchasePrice())
|
|
|
|
|
.eq(bo.getForeignPrice() != null, BaseMaterialInfo::getForeignPrice, bo.getForeignPrice())
|
|
|
|
|
.eq(bo.getStockingPeriod() != null, BaseMaterialInfo::getStockingPeriod, bo.getStockingPeriod())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseMaterialInfo::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -120,7 +122,7 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
/**
|
|
|
|
|
* 保存前的数据校验
|
|
|
|
|
*/
|
|
|
|
|
private void validEntityBeforeSave(BaseMaterialInfo entity){
|
|
|
|
|
private void validEntityBeforeSave(BaseMaterialInfo entity) {
|
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -133,7 +135,7 @@ public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
|
if(isValid){
|
|
|
|
|
if (isValid) {
|
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
}
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
|