潘志宝
2024-12-03 51c1c2c9fa28fb1765dd6e81c70b78566792aebe
提交 | 用户 | 时间
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.StScheduleModelParamDao;
7 import com.iailab.module.model.mcs.sche.entity.StScheduleModelParamEntity;
8 import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService;
9 import com.iailab.module.model.mcs.sche.vo.StScheduleModelParamSaveReqVO;
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 StScheduleModelParamServiceImpl extends BaseServiceImpl<StScheduleModelParamDao, StScheduleModelParamEntity>
23         implements StScheduleModelParamService {
24
25     @Override
26     public List<StScheduleModelParamEntity> getByModelId(String modelId) {
27         return baseDao.selectList(
28                 new LambdaQueryWrapperX<StScheduleModelParamEntity>()
29                         .likeIfPresent(StScheduleModelParamEntity::getModelid, modelId)
30                         .orderByAsc(StScheduleModelParamEntity::getModelparamportorder)
31                         .orderByAsc(StScheduleModelParamEntity::getModelparamorder)
32         );
33     }
34
35     @Override
36     public void deleteByModelId(String modelId) {
37         baseDao.delete(new LambdaQueryWrapperX<StScheduleModelParamEntity>()
38                 .likeIfPresent(StScheduleModelParamEntity::getModelid, modelId)
39         );
40     }
41
42     @Override
43     public void saveList(String modelId, List<StScheduleModelParamSaveReqVO> saveList) {
44         deleteByModelId(modelId);
45         if (CollectionUtils.isEmpty(saveList)) {
46             return;
47         }
48         saveList.forEach(item -> {
49             StScheduleModelParamEntity entity = BeanUtils.toBean(item, StScheduleModelParamEntity.class);
50             entity.setId(UUID.randomUUID().toString());
056470 51             entity.setModelid(modelId);
bbc1ee 52             baseDao.insert(entity);
53         });
54     }
55 }