dengzedong
2024-09-13 3acc3151d842922fda223cbed8987b3fe9f83e24
提交 | 用户 | 时间
7fd198 1 package com.iailab.module.model.mcs.pre.service.impl;
2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.iailab.framework.common.service.impl.BaseServiceImpl;
5 import com.iailab.module.model.mcs.pre.dao.MmModelArithSettingsDao;
6 import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity;
7 import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService;
8 import org.springframework.stereotype.Service;
9 import org.springframework.util.CollectionUtils;
10
11 import java.util.*;
12
13 /**
14  * @author PanZhibao
15  * @date 2021年04月27日 9:24
16  */
17 @Service
18 public class MmModelArithSettingsServiceImpl extends BaseServiceImpl<MmModelArithSettingsDao, MmModelArithSettingsEntity>
19         implements MmModelArithSettingsService {
20
21     @Override
22     public void saveList(List<MmModelArithSettingsEntity> list) {
23         QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper();
24         queryWrapper.eq("modelid", list.get(0).getModelid());
25         baseDao.delete(queryWrapper);
26         list.forEach(item -> {
27             item.setId(UUID.randomUUID().toString());
28         });
29         baseDao.insertList(list);
30     }
31
32     public List<MmModelArithSettingsEntity> getByModelid(String modelid) {
33         Map<String, Object> params = new HashMap<>(1);
34         params.put("modelid", modelid);
35         List<MmModelArithSettingsEntity> list = baseDao.getMmModelArithSettings(params);
36
37         if (CollectionUtils.isEmpty(list)) {
38             return new ArrayList<>();
39         }
40         return list;
41     }
42
43     @Override
44     public List<MmModelArithSettingsEntity> getByModelId(String modelId) {
45         QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper();
46         queryWrapper.eq("modelid", modelId);
47         return baseDao.selectList(queryWrapper);
48     }
49 }