hdy
4 天以前 51eb318f6df9ebc7d1ff47522e33b2ee7cea1ba8
提交 | 用户 | 时间
849473 1 package com.billion.main.bs.service.impl;
A 2
3 import java.util.Date;
4 import java.util.List;
5
ef94dd 6 import cn.hutool.core.collection.CollUtil;
A 7 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
849473 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
ef94dd 9 import com.billion.common.exception.ServiceException;
849473 10 import com.billion.common.utils.DateUtils;
A 11 import com.billion.common.utils.SecurityUtils;
ef94dd 12 import com.billion.main.bs.domain.BsBomInfo;
849473 13 import org.springframework.beans.factory.annotation.Autowired;
A 14 import org.springframework.stereotype.Service;
15 import com.billion.main.bs.mapper.BsRouteInfoMapper;
16 import com.billion.main.bs.domain.BsRouteInfo;
17 import com.billion.main.bs.service.IBsRouteInfoService;
18
19 import static org.apache.commons.lang3.SystemUtils.getUserName;
20
21 /**
22  * 工艺路线Service业务层处理
23  * 
24  * @author Billion-Yi
25  * @date 2024-11-23
26  */
27 @Service
28 public class BsRouteInfoServiceImpl extends ServiceImpl<BsRouteInfoMapper, BsRouteInfo> implements IBsRouteInfoService
29 {
30     @Autowired
31     private BsRouteInfoMapper bsRouteInfoMapper;
32
33     /**
34      * 查询工艺路线
35      * 
36      * @param id 工艺路线主键
37      * @return 工艺路线
38      */
39     @Override
40     public BsRouteInfo selectBsRouteInfoById(Long id)
41     {
42         return bsRouteInfoMapper.selectBsRouteInfoById(id);
43     }
44
45     /**
46      * 查询工艺路线列表
47      * 
48      * @param bsRouteInfo 工艺路线
49      * @return 工艺路线
50      */
51     @Override
52     public List<BsRouteInfo> selectBsRouteInfoList(BsRouteInfo bsRouteInfo)
53     {
54         return bsRouteInfoMapper.selectBsRouteInfoList(bsRouteInfo);
55     }
56
57     /**
58      * 新增工艺路线
59      * 
60      * @param bsRouteInfo 工艺路线
61      * @return 结果
62      */
63     @Override
64     public int insertBsRouteInfo(BsRouteInfo bsRouteInfo)
65     {
66         bsRouteInfo.setCreateTime(DateUtils.getNowDate());
67         bsRouteInfo.setCreateBy(getUserName());
68         bsRouteInfo.setDataSource("MES");
ef94dd 69         List<BsRouteInfo> checkList = this.list(new LambdaQueryWrapper<BsRouteInfo>().eq(BsRouteInfo::getRouteCode, bsRouteInfo.getRouteCode()));
A 70         if (CollUtil.isNotEmpty(checkList)){
71             throw new ServiceException("已存在流程编码为"+bsRouteInfo.getRouteCode()+"的数据");
72         }
849473 73         return bsRouteInfoMapper.insertBsRouteInfo(bsRouteInfo);
A 74     }
75
76     /**
77      * 修改工艺路线
78      * 
79      * @param bsRouteInfo 工艺路线
80      * @return 结果
81      */
82     @Override
83     public int updateBsRouteInfo(BsRouteInfo bsRouteInfo)
84     {
85         bsRouteInfo.setUpdateTime(DateUtils.getNowDate());
86         bsRouteInfo.setUpdateBy(getUserName());
87         return bsRouteInfoMapper.updateBsRouteInfo(bsRouteInfo);
88     }
89
90     /**
91      * 批量删除工艺路线
92      * 
93      * @param ids 需要删除的工艺路线主键
94      * @return 结果
95      */
96     @Override
97     public int deleteBsRouteInfoByIds(Long[] ids)
98     {
99         return bsRouteInfoMapper.deleteBsRouteInfoByIds(ids);
100     }
101
102     /**
103      * 删除工艺路线信息
104      * 
105      * @param id 工艺路线主键
106      * @return 结果
107      */
108     @Override
109     public int deleteBsRouteInfoById(Long id)
110     {
111         return bsRouteInfoMapper.deleteBsRouteInfoById(id);
112     }
113 }