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.StScheduleModelSettingDao;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity;
|
import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService;
|
import com.iailab.module.model.mcs.sche.vo.StScheduleModelSettingSaveReqVO;
|
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 StScheduleModelSettingServiceImpl extends BaseServiceImpl<StScheduleModelSettingDao, StScheduleModelSettingEntity>
|
implements StScheduleModelSettingService {
|
|
@Override
|
public List<StScheduleModelSettingEntity> getByModelId(String modelId) {
|
return baseDao.selectList(
|
new LambdaQueryWrapperX<StScheduleModelSettingEntity>()
|
.likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId)
|
.orderByAsc(StScheduleModelSettingEntity::getSort)
|
);
|
}
|
|
@Override
|
public void deleteByModelId(String modelId) {
|
baseDao.delete(new LambdaQueryWrapperX<StScheduleModelSettingEntity>()
|
.likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId)
|
);
|
}
|
|
@Override
|
public void saveList(String modelId, List<StScheduleModelSettingSaveReqVO> saveList) {
|
deleteByModelId(modelId);
|
if (CollectionUtils.isEmpty(saveList)) {
|
return;
|
}
|
for (int i = 0; i < saveList.size(); i++) {
|
StScheduleModelSettingSaveReqVO item = saveList.get(i);
|
StScheduleModelSettingEntity entity = BeanUtils.toBean(item, StScheduleModelSettingEntity.class);
|
entity.setId(UUID.randomUUID().toString());
|
entity.setModelid(modelId);
|
entity.setSort(i);
|
baseDao.insert(entity);
|
}
|
}
|
|
@Override
|
public void updatePyFile(String pyModule, String fileName) {
|
baseDao.updatePyFile(pyModule + "." + fileName.substring(0,fileName.lastIndexOf("_")),pyModule + "." + fileName);
|
}
|
}
|