dengzedong
4 天以前 730d1944e3a13c517c77df2b0712df05645a38dd
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.bpm.service.definition;
H 2
3 import com.iailab.framework.common.pojo.PageResult;
4 import com.iailab.framework.common.util.object.BeanUtils;
5 import com.iailab.module.bpm.controller.admin.definition.vo.expression.BpmProcessExpressionPageReqVO;
6 import com.iailab.module.bpm.controller.admin.definition.vo.expression.BpmProcessExpressionSaveReqVO;
7 import com.iailab.module.bpm.dal.dataobject.definition.BpmProcessExpressionDO;
8 import com.iailab.module.bpm.dal.mysql.definition.BpmProcessExpressionMapper;
9 import org.springframework.stereotype.Service;
10 import org.springframework.validation.annotation.Validated;
11
12 import javax.annotation.Resource;
13
14 import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception;
15 import static com.iailab.module.bpm.enums.ErrorCodeConstants.PROCESS_EXPRESSION_NOT_EXISTS;
16
17 /**
18  * BPM 流程表达式 Service 实现类
19  *
20  * @author iailab
21  */
22 @Service
23 @Validated
24 public class BpmProcessExpressionServiceImpl implements BpmProcessExpressionService {
25
26     @Resource
27     private BpmProcessExpressionMapper processExpressionMapper;
28
29     @Override
30     public Long createProcessExpression(BpmProcessExpressionSaveReqVO createReqVO) {
31         // 插入
32         BpmProcessExpressionDO processExpression = BeanUtils.toBean(createReqVO, BpmProcessExpressionDO.class);
33         processExpressionMapper.insert(processExpression);
34         // 返回
35         return processExpression.getId();
36     }
37
38     @Override
39     public void updateProcessExpression(BpmProcessExpressionSaveReqVO updateReqVO) {
40         // 校验存在
41         validateProcessExpressionExists(updateReqVO.getId());
42         // 更新
43         BpmProcessExpressionDO updateObj = BeanUtils.toBean(updateReqVO, BpmProcessExpressionDO.class);
44         processExpressionMapper.updateById(updateObj);
45     }
46
47     @Override
48     public void deleteProcessExpression(Long id) {
49         // 校验存在
50         validateProcessExpressionExists(id);
51         // 删除
52         processExpressionMapper.deleteById(id);
53     }
54
55     private void validateProcessExpressionExists(Long id) {
56         if (processExpressionMapper.selectById(id) == null) {
57             throw exception(PROCESS_EXPRESSION_NOT_EXISTS);
58         }
59     }
60
61     @Override
62     public BpmProcessExpressionDO getProcessExpression(Long id) {
63         return processExpressionMapper.selectById(id);
64     }
65
66     @Override
67     public PageResult<BpmProcessExpressionDO> getProcessExpressionPage(BpmProcessExpressionPageReqVO pageReqVO) {
68         return processExpressionMapper.selectPage(pageReqVO);
69     }
70
71 }