提交 | 用户 | 时间
|
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.module.model.mcs.pre.dao.MmItemOutputDao; |
5c6007
|
6 |
import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO; |
7fd198
|
7 |
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
潘 |
8 |
import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
5c6007
|
9 |
import org.springframework.beans.factory.annotation.Autowired; |
7fd198
|
10 |
import org.springframework.stereotype.Service; |
潘 |
11 |
|
|
12 |
import java.util.List; |
|
13 |
import java.util.Map; |
a4891a
|
14 |
import java.util.concurrent.ConcurrentHashMap; |
7fd198
|
15 |
|
潘 |
16 |
/** |
|
17 |
* @author PanZhibao |
|
18 |
* @date 2021年04月27日 9:22 |
|
19 |
*/ |
5c6007
|
20 |
@Service |
L |
21 |
public class MmItemOutputServiceImpl extends ServiceImpl<MmItemOutputDao, MmItemOutputEntity> implements MmItemOutputService { |
7fd198
|
22 |
|
5c6007
|
23 |
@Autowired |
L |
24 |
private MmItemOutputDao mmItemOutputDao; |
a4891a
|
25 |
|
潘 |
26 |
private static Map<String, MmItemOutputEntity> outputMap = new ConcurrentHashMap<>(); |
5c6007
|
27 |
|
7fd198
|
28 |
@Override |
69bd5e
|
29 |
public void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput) { |
5c6007
|
30 |
mmItemOutputDao.insert(mmItemOutput); |
a4891a
|
31 |
// 清空缓存 |
潘 |
32 |
outputMap.clear(); |
7fd198
|
33 |
} |
潘 |
34 |
|
|
35 |
@Override |
|
36 |
public void update(MmItemOutputEntity mmItemOutput) { |
5c6007
|
37 |
mmItemOutputDao.updateById(mmItemOutput); |
a4891a
|
38 |
// 清空缓存 |
潘 |
39 |
outputMap.clear(); |
7fd198
|
40 |
} |
潘 |
41 |
|
|
42 |
public void deleteBatch(String[] itemIds) { |
f283ee
|
43 |
QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
7fd198
|
44 |
queryWrapper.in("itemid", itemIds); |
5c6007
|
45 |
mmItemOutputDao.delete(queryWrapper); |
a4891a
|
46 |
// 清空缓存 |
潘 |
47 |
outputMap.clear(); |
7fd198
|
48 |
} |
潘 |
49 |
|
|
50 |
@Override |
69bd5e
|
51 |
public List<MmItemOutputEntity> getByItemid(String itemid) { |
b368e6
|
52 |
QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
潘 |
53 |
queryWrapper.eq("itemid", itemid).orderByAsc("outputorder"); |
5c6007
|
54 |
List<MmItemOutputEntity> list = mmItemOutputDao.selectList(queryWrapper); |
69bd5e
|
55 |
return list; |
D |
56 |
} |
|
57 |
|
|
58 |
@Override |
b368e6
|
59 |
public MmItemOutputEntity getByItemid(String itemid, String resultstr) { |
潘 |
60 |
QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
|
61 |
queryWrapper.eq("itemid", itemid).eq("resultstr", resultstr); |
|
62 |
return mmItemOutputDao.selectOne(queryWrapper); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
69bd5e
|
66 |
public void deleteByItemId(String itemId) { |
f283ee
|
67 |
QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
69bd5e
|
68 |
queryWrapper.eq("itemid", itemId); |
D |
69 |
mmItemOutputDao.delete(queryWrapper); |
7fd198
|
70 |
} |
潘 |
71 |
|
|
72 |
@Override |
|
73 |
public List<MmItemOutputDTO> queryList(Map<String, Object> params) { |
5c6007
|
74 |
return mmItemOutputDao.queryList(params); |
7fd198
|
75 |
} |
潘 |
76 |
|
|
77 |
@Override |
a4891a
|
78 |
public MmItemOutputEntity getOutPutById(String outputid) { |
潘 |
79 |
if (outputMap.containsKey(outputid)) { |
|
80 |
return outputMap.get(outputid); |
7fd198
|
81 |
} |
a4891a
|
82 |
MmItemOutputEntity entity = mmItemOutputDao.selectById(outputid); |
潘 |
83 |
outputMap.put(outputid, entity); |
|
84 |
return entity; |
7fd198
|
85 |
} |
潘 |
86 |
} |