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