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