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.MmModelArithSettingsDao; import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; /** * @author PanZhibao * @date 2021年04月27日 9:24 */ @Service public class MmModelArithSettingsServiceImpl extends BaseServiceImpl implements MmModelArithSettingsService { @Override public void saveList(List list) { QueryWrapper queryWrapper = new QueryWrapper(); queryWrapper.eq("modelid", list.get(0).getModelid()); baseDao.delete(queryWrapper); list.forEach(item -> { item.setId(UUID.randomUUID().toString()); }); baseDao.insertList(list); } public List getByModelid(String modelid) { Map params = new HashMap<>(1); params.put("modelid", modelid); List list = baseDao.getMmModelArithSettings(params); if (CollectionUtils.isEmpty(list)) { return new ArrayList<>(); } return list; } @Override public List getByModelId(String modelId) { QueryWrapper queryWrapper = new QueryWrapper(); queryWrapper.eq("modelid", modelId); return baseDao.selectList(queryWrapper); } }