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 implements StScheduleModelSettingService { @Override public List getByModelId(String modelId) { return baseDao.selectList( new LambdaQueryWrapperX() .likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId) .orderByAsc(StScheduleModelSettingEntity::getSort) ); } @Override public void deleteByModelId(String modelId) { baseDao.delete(new LambdaQueryWrapperX() .likeIfPresent(StScheduleModelSettingEntity::getModelid, modelId) ); } @Override public void saveList(String modelId, List saveList) { deleteByModelId(modelId); if (CollectionUtils.isEmpty(saveList)) { return; } saveList.forEach(item -> { StScheduleModelSettingEntity entity = BeanUtils.toBean(item, StScheduleModelSettingEntity.class); entity.setId(UUID.randomUUID().toString()); baseDao.insert(entity); }); } }