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.MmModelParamDao;
|
import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity;
|
import com.iailab.module.model.mcs.pre.service.MmModelParamService;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.UUID;
|
|
/**
|
* @author PanZhibao
|
* @date 2021年04月27日 9:25
|
*/
|
@Service("mmModelParamService")
|
public class MmModelParamServiceImpl extends BaseServiceImpl<MmModelParamDao, MmModelParamEntity> implements MmModelParamService {
|
|
@Override
|
public void saveList(List<MmModelParamEntity> list) {
|
QueryWrapper<MmModelParamEntity> queryWrapper = new QueryWrapper();
|
queryWrapper.eq("modelid", list.get(0).getModelid());
|
baseDao.delete(queryWrapper);
|
list.forEach(item -> {
|
item.setId(UUID.randomUUID().toString());
|
baseDao.insert(item);
|
});
|
}
|
|
@Override
|
public List<MmModelParamEntity> getByModelid(String modelid) {
|
QueryWrapper<MmModelParamEntity> queryWrapper = new QueryWrapper();
|
queryWrapper.eq("modelid", modelid);
|
queryWrapper.orderByAsc("MODELPARAMPORTORDER");
|
queryWrapper.orderByAsc("MODELPARAMORDER");
|
List<MmModelParamEntity> list = baseDao.selectList(queryWrapper);
|
if (CollectionUtils.isEmpty(list)) {
|
return new ArrayList<>();
|
}
|
return list;
|
}
|
}
|