package com.iailab.module.model.mcs.sche.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.object.ConvertUtils;
|
import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO;
|
import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO;
|
import com.iailab.module.model.mcs.sche.dao.StScheduleModelOutDao;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity;
|
import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService;
|
import com.iailab.module.model.mpk.service.MethodSettingService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.UUID;
|
|
/**
|
* @description:
|
* @author: dyk
|
* @date: 2024/12/30 17:43
|
**/
|
@Slf4j
|
@Service
|
public class StScheduleModelOutServiceImpl extends BaseServiceImpl<StScheduleModelOutDao, StScheduleModelOutEntity> implements StScheduleModelOutService {
|
|
@Autowired
|
private MethodSettingService methodSettingService;
|
|
@Override
|
public void deleteByMap(Map<String, Object> map) {
|
baseDao.delete(getWrapper(map));
|
}
|
|
private QueryWrapper<StScheduleModelOutEntity> getWrapper(Map<String, Object> params) {
|
String mpkFileId = (String) params.get("modelId");
|
|
QueryWrapper<StScheduleModelOutEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(mpkFileId), "mpk_file_id", mpkFileId);
|
|
return wrapper;
|
}
|
|
@Override
|
public void insertList(List<StScheduleModelOutEntity> list, String modelId) {
|
for (int i = 0; i < list.size(); i++) {
|
StScheduleModelOutEntity entity = ConvertUtils.sourceToTarget(list.get(i), StScheduleModelOutEntity.class);
|
entity.setId(UUID.randomUUID().toString());
|
entity.setModelId(modelId);
|
entity.setSort(i);
|
baseDao.insert(entity);
|
}
|
}
|
|
@Override
|
public void deleteScheduleModelOut(String modelId) {
|
Map<String,Object> map = new HashMap<>();
|
map.put("model_id", modelId);
|
baseDao.deleteByMap(map);
|
}
|
|
@Override
|
public List<StScheduleModelOutDTO> list(String modelId) {
|
QueryWrapper<StScheduleModelOutEntity> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("model_id", modelId);
|
List<StScheduleModelOutEntity> list = baseDao.selectList(queryWrapper);
|
return ConvertUtils.sourceToTarget(list, StScheduleModelOutDTO.class);
|
}
|
}
|