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