dengzedong
6 天以前 a6e46fe2b5729e7468b6f3c4e079232801c22520
提交 | 用户 | 时间
bbc1ee 1 package com.iailab.module.model.mcs.sche.service.impl;
2
3 import com.iailab.framework.common.service.impl.BaseServiceImpl;
4 import com.iailab.framework.common.util.object.BeanUtils;
5 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import com.iailab.module.model.mcs.sche.dao.StScheduleModelSettingDao;
7 import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity;
8 import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService;
9 import com.iailab.module.model.mcs.sche.vo.StScheduleModelSettingSaveReqVO;
10 import org.springframework.stereotype.Service;
11 import org.springframework.util.CollectionUtils;
12
13 import java.util.List;
14 import java.util.UUID;
15
16 /**
17  * @author PanZhibao
18  * @Description
19  * @createTime 2024年09月06日
20  */
21 @Service
22 public class StScheduleModelSettingServiceImpl extends BaseServiceImpl<StScheduleModelSettingDao, StScheduleModelSettingEntity>
23         implements StScheduleModelSettingService {
24
25     @Override
26     public List<StScheduleModelSettingEntity> getByModelId(String modelId) {
27         return baseDao.selectList(
28                 new LambdaQueryWrapperX<StScheduleModelSettingEntity>()
29                         .likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId)
30                         .orderByAsc(StScheduleModelSettingEntity::getSort)
31         );
32     }
33
34     @Override
35     public void deleteByModelId(String modelId) {
36         baseDao.delete(new LambdaQueryWrapperX<StScheduleModelSettingEntity>()
37                 .likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId)
38         );
39     }
40
41     @Override
42     public void saveList(String modelId, List<StScheduleModelSettingSaveReqVO> saveList) {
43         deleteByModelId(modelId);
44         if (CollectionUtils.isEmpty(saveList)) {
45             return;
46         }
056470 47         for (int i = 0; i < saveList.size(); i++) {
48             StScheduleModelSettingSaveReqVO item = saveList.get(i);
bbc1ee 49             StScheduleModelSettingEntity entity = BeanUtils.toBean(item, StScheduleModelSettingEntity.class);
50             entity.setId(UUID.randomUUID().toString());
056470 51             entity.setModelid(modelId);
52             entity.setSort(i);
bbc1ee 53             baseDao.insert(entity);
056470 54         }
bbc1ee 55     }
826d35 56
D 57     @Override
58     public void updatePyFile(String pyModule, String fileName) {
56e36d 59         baseDao.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")+1),pyModule + "." + fileName);
826d35 60     }
bbc1ee 61 }