package com.iailab.module.model.mcs.sche.service.impl;
|
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.object.BeanUtils;
|
import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.iailab.module.model.mcs.sche.dao.StScheduleModelParamDao;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleModelParamEntity;
|
import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService;
|
import com.iailab.module.model.mcs.sche.vo.StScheduleModelParamSaveReqVO;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.List;
|
import java.util.UUID;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年09月06日
|
*/
|
@Service
|
public class StScheduleModelParamServiceImpl extends BaseServiceImpl<StScheduleModelParamDao, StScheduleModelParamEntity>
|
implements StScheduleModelParamService {
|
|
@Override
|
public List<StScheduleModelParamEntity> getByModelId(String modelId) {
|
return baseDao.selectList(
|
new LambdaQueryWrapperX<StScheduleModelParamEntity>()
|
.likeIfPresent(StScheduleModelParamEntity::getModelid, modelId)
|
.orderByAsc(StScheduleModelParamEntity::getModelparamportorder)
|
.orderByAsc(StScheduleModelParamEntity::getModelparamorder)
|
);
|
}
|
|
@Override
|
public void deleteByModelId(String modelId) {
|
baseDao.delete(new LambdaQueryWrapperX<StScheduleModelParamEntity>()
|
.likeIfPresent(StScheduleModelParamEntity::getModelid, modelId)
|
);
|
}
|
|
@Override
|
public void saveList(String modelId, List<StScheduleModelParamSaveReqVO> saveList) {
|
deleteByModelId(modelId);
|
if (CollectionUtils.isEmpty(saveList)) {
|
return;
|
}
|
saveList.forEach(item -> {
|
StScheduleModelParamEntity entity = BeanUtils.toBean(item, StScheduleModelParamEntity.class);
|
entity.setId(UUID.randomUUID().toString());
|
entity.setModelid(modelId);
|
baseDao.insert(entity);
|
});
|
}
|
}
|