提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mcs.sche.service.impl; |
潘 |
2 |
|
b425df
|
3 |
import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
7fd198
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
潘 |
5 |
import com.iailab.framework.common.pojo.PageResult; |
bbc1ee
|
6 |
import com.iailab.framework.common.util.object.BeanUtils; |
7fd198
|
7 |
import com.iailab.module.model.mcs.sche.dao.StScheduleModelDao; |
潘 |
8 |
import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
bbc1ee
|
9 |
import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService; |
7fd198
|
10 |
import com.iailab.module.model.mcs.sche.service.StScheduleModelService; |
bbc1ee
|
11 |
import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService; |
潘 |
12 |
import com.iailab.module.model.mcs.sche.vo.StScheduleModelPageReqVO; |
|
13 |
import com.iailab.module.model.mcs.sche.vo.StScheduleModelSaveReqVO; |
7fd198
|
14 |
import org.apache.commons.lang3.StringUtils; |
潘 |
15 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 |
import org.springframework.stereotype.Service; |
|
17 |
import org.springframework.transaction.annotation.Transactional; |
|
18 |
|
b425df
|
19 |
import javax.annotation.Resource; |
056470
|
20 |
import java.util.List; |
7fd198
|
21 |
import java.util.UUID; |
潘 |
22 |
|
|
23 |
/** |
|
24 |
* @author PanZhibao |
|
25 |
* @date 2021年07月20日 14:23 |
|
26 |
*/ |
bbc1ee
|
27 |
@Service |
b425df
|
28 |
public class StScheduleModelServiceImpl implements StScheduleModelService { |
潘 |
29 |
|
|
30 |
@Resource |
|
31 |
private StScheduleModelDao stScheduleModelDao; |
7fd198
|
32 |
|
潘 |
33 |
@Autowired |
bbc1ee
|
34 |
private StScheduleModelParamService stScheduleModelParamService; |
7fd198
|
35 |
|
潘 |
36 |
@Autowired |
bbc1ee
|
37 |
private StScheduleModelSettingService stScheduleModelSettingService; |
7fd198
|
38 |
|
潘 |
39 |
@Override |
bbc1ee
|
40 |
public PageResult<StScheduleModelEntity> page(StScheduleModelPageReqVO reqVO) { |
b425df
|
41 |
return stScheduleModelDao.selectPage(reqVO); |
7fd198
|
42 |
} |
潘 |
43 |
|
|
44 |
@Override |
056470
|
45 |
public List<StScheduleModelEntity> list() { |
潘 |
46 |
|
b425df
|
47 |
return stScheduleModelDao.selectList(null); |
056470
|
48 |
} |
潘 |
49 |
|
|
50 |
@Override |
b425df
|
51 |
@DSTransactional(rollbackFor = Exception.class) |
bbc1ee
|
52 |
public void create(StScheduleModelSaveReqVO reqVO) { |
潘 |
53 |
StScheduleModelEntity entity = BeanUtils.toBean(reqVO, StScheduleModelEntity.class); |
|
54 |
entity.setId(UUID.randomUUID().toString()); |
b425df
|
55 |
stScheduleModelDao.insert(entity); |
bbc1ee
|
56 |
stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList()); |
潘 |
57 |
stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList()); |
7fd198
|
58 |
} |
潘 |
59 |
|
|
60 |
@Override |
b425df
|
61 |
@DSTransactional(rollbackFor = Exception.class) |
bbc1ee
|
62 |
public void update(StScheduleModelSaveReqVO reqVO) { |
潘 |
63 |
StScheduleModelEntity entity = BeanUtils.toBean(reqVO, StScheduleModelEntity.class); |
b425df
|
64 |
stScheduleModelDao.updateById(entity); |
bbc1ee
|
65 |
stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList()); |
潘 |
66 |
stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList()); |
|
67 |
} |
7fd198
|
68 |
|
bbc1ee
|
69 |
@Override |
潘 |
70 |
public StScheduleModelEntity get(String id) { |
b425df
|
71 |
return stScheduleModelDao.selectById(id); |
7fd198
|
72 |
} |
潘 |
73 |
|
|
74 |
@Override |
b425df
|
75 |
@DSTransactional(rollbackFor = Exception.class) |
bbc1ee
|
76 |
public void delete(String id) { |
b425df
|
77 |
stScheduleModelDao.deleteById(id); |
bbc1ee
|
78 |
stScheduleModelParamService.deleteByModelId(id); |
潘 |
79 |
stScheduleModelSettingService.deleteByModelId(id); |
7fd198
|
80 |
} |
潘 |
81 |
|
|
82 |
@Override |
bbc1ee
|
83 |
public Long check(StScheduleModelSaveReqVO reqVO) { |
潘 |
84 |
String id = reqVO.getId(); |
|
85 |
String modelname = reqVO.getModelName(); |
7fd198
|
86 |
QueryWrapper<StScheduleModelEntity> scheduleModelWrapper = new QueryWrapper<>(); |
潘 |
87 |
scheduleModelWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
bbc1ee
|
88 |
scheduleModelWrapper.and(wrapper -> wrapper.eq("model_name", modelname)); |
b425df
|
89 |
return stScheduleModelDao.selectCount(scheduleModelWrapper); |
7fd198
|
90 |
} |
潘 |
91 |
|
|
92 |
@Override |
|
93 |
public Long count() { |
|
94 |
QueryWrapper<StScheduleModelEntity> wrapper = new QueryWrapper<>(); |
b425df
|
95 |
return stScheduleModelDao.selectCount(wrapper); |
7fd198
|
96 |
} |
潘 |
97 |
} |