package com.iailab.module.model.mcs.pre.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.pre.dao.MmPredictModelDao; import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; import com.iailab.module.model.mcs.pre.service.MmPredictModelService; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.UUID; /** * @author PanZhibao * @date 2021年04月27日 11:30 */ @Service("mmPredictModelService") public class MmPredictModelServiceImpl extends BaseServiceImpl implements MmPredictModelService { @Override public void savePredictModel(MmPredictModelEntity predictModel) { predictModel.setId(UUID.randomUUID().toString()); baseDao.insert(predictModel); } @Override public void update(MmPredictModelEntity predictModel) { this.updateById(predictModel); } @Override public MmPredictModelEntity getInfo(String id) { return baseDao.selectById(id); } @Override public BigDecimal getSampleLength(String id) { BigDecimal result = BigDecimal.ZERO; List list = baseDao.getSampleLength(id); if (CollectionUtils.isEmpty(list)) { return result; } result = list.get(0).getPredictsamplength(); return result; } public void deleteBatch(String[] itemIds) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.in("itemid", itemIds); baseDao.delete(queryWrapper); } public MmPredictModelEntity getByItemid(String itemid) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("itemid", itemid); List list = baseDao.selectList(queryWrapper); if (CollectionUtils.isEmpty(list)) { return new MmPredictModelEntity(); } return list.get(0); } @Override public List getNoSettingmapPredictModel(Map params) { return baseDao.getNoSettingmapPredictModel(params); } @Override public List getActiveModelByItemId(String itemId) { return baseDao.getActiveModelByItemId(itemId); } }