package com.billion.main.bs.service.impl;
|
|
import java.util.Date;
|
import java.util.List;
|
|
import cn.hutool.core.collection.CollUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.billion.common.exception.ServiceException;
|
import com.billion.common.utils.DateUtils;
|
import com.billion.common.utils.SecurityUtils;
|
import com.billion.main.bs.domain.BsBomInfo;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import com.billion.main.bs.mapper.BsRouteInfoMapper;
|
import com.billion.main.bs.domain.BsRouteInfo;
|
import com.billion.main.bs.service.IBsRouteInfoService;
|
|
import static org.apache.commons.lang3.SystemUtils.getUserName;
|
|
/**
|
* 工艺路线Service业务层处理
|
*
|
* @author Billion-Yi
|
* @date 2024-11-23
|
*/
|
@Service
|
public class BsRouteInfoServiceImpl extends ServiceImpl<BsRouteInfoMapper, BsRouteInfo> implements IBsRouteInfoService
|
{
|
@Autowired
|
private BsRouteInfoMapper bsRouteInfoMapper;
|
|
/**
|
* 查询工艺路线
|
*
|
* @param id 工艺路线主键
|
* @return 工艺路线
|
*/
|
@Override
|
public BsRouteInfo selectBsRouteInfoById(Long id)
|
{
|
return bsRouteInfoMapper.selectBsRouteInfoById(id);
|
}
|
|
/**
|
* 查询工艺路线列表
|
*
|
* @param bsRouteInfo 工艺路线
|
* @return 工艺路线
|
*/
|
@Override
|
public List<BsRouteInfo> selectBsRouteInfoList(BsRouteInfo bsRouteInfo)
|
{
|
return bsRouteInfoMapper.selectBsRouteInfoList(bsRouteInfo);
|
}
|
|
/**
|
* 新增工艺路线
|
*
|
* @param bsRouteInfo 工艺路线
|
* @return 结果
|
*/
|
@Override
|
public int insertBsRouteInfo(BsRouteInfo bsRouteInfo)
|
{
|
bsRouteInfo.setCreateTime(DateUtils.getNowDate());
|
bsRouteInfo.setCreateBy(getUserName());
|
bsRouteInfo.setDataSource("MES");
|
List<BsRouteInfo> checkList = this.list(new LambdaQueryWrapper<BsRouteInfo>().eq(BsRouteInfo::getRouteCode, bsRouteInfo.getRouteCode()));
|
if (CollUtil.isNotEmpty(checkList)){
|
throw new ServiceException("已存在流程编码为"+bsRouteInfo.getRouteCode()+"的数据");
|
}
|
return bsRouteInfoMapper.insertBsRouteInfo(bsRouteInfo);
|
}
|
|
/**
|
* 修改工艺路线
|
*
|
* @param bsRouteInfo 工艺路线
|
* @return 结果
|
*/
|
@Override
|
public int updateBsRouteInfo(BsRouteInfo bsRouteInfo)
|
{
|
bsRouteInfo.setUpdateTime(DateUtils.getNowDate());
|
bsRouteInfo.setUpdateBy(getUserName());
|
return bsRouteInfoMapper.updateBsRouteInfo(bsRouteInfo);
|
}
|
|
/**
|
* 批量删除工艺路线
|
*
|
* @param ids 需要删除的工艺路线主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteBsRouteInfoByIds(Long[] ids)
|
{
|
return bsRouteInfoMapper.deleteBsRouteInfoByIds(ids);
|
}
|
|
/**
|
* 删除工艺路线信息
|
*
|
* @param id 工艺路线主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteBsRouteInfoById(Long id)
|
{
|
return bsRouteInfoMapper.deleteBsRouteInfoById(id);
|
}
|
}
|