提交 | 用户 | 时间
|
cf2287
|
1 |
package com.iailab.module.model.mpk.service.impl; |
潘 |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.module.model.mpk.dao.PackDao; |
|
6 |
import com.iailab.module.model.mpk.entity.PackEntity; |
|
7 |
import com.iailab.module.model.mpk.service.PackService; |
|
8 |
import com.iailab.module.model.mpk.vo.PackPageReqVO; |
|
9 |
import lombok.extern.slf4j.Slf4j; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.stereotype.Service; |
|
12 |
import org.springframework.util.CollectionUtils; |
|
13 |
|
|
14 |
import java.util.HashMap; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
import java.util.UUID; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author PanZhibao |
|
21 |
* @Description |
|
22 |
* @createTime 2024年11月05日 |
|
23 |
*/ |
|
24 |
@Slf4j |
|
25 |
@Service |
|
26 |
public class PackServiceImpl implements PackService { |
|
27 |
|
|
28 |
@Autowired |
|
29 |
private PackDao iconDao; |
|
30 |
|
|
31 |
@Override |
|
32 |
public PageResult<PackEntity> page(PackPageReqVO reqVO) { |
|
33 |
return iconDao.selectPage(reqVO); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public List<PackEntity> list() { |
|
38 |
QueryWrapper<PackEntity> qw = new QueryWrapper<>(); |
|
39 |
qw.orderByAsc("sort"); |
|
40 |
return iconDao.selectList(qw); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public Map<String, PackEntity> getNameMap() { |
|
45 |
Map<String, PackEntity> map = new HashMap<>(); |
|
46 |
QueryWrapper<PackEntity> qw = new QueryWrapper<>(); |
|
47 |
List<PackEntity> list = iconDao.selectList(qw); |
|
48 |
if (CollectionUtils.isEmpty(list)) { |
|
49 |
return map; |
|
50 |
} |
|
51 |
list.forEach(packEntity -> { |
|
52 |
map.put(packEntity.getPackName(), packEntity); |
|
53 |
}); |
|
54 |
return map; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public String getModelPath(String packName) { |
|
59 |
QueryWrapper<PackEntity> qw = new QueryWrapper<>(); |
|
60 |
qw.eq("pack_name", packName); |
|
61 |
PackEntity packEntity = iconDao.selectOne(qw); |
|
62 |
|
|
63 |
if (packEntity == null) { |
|
64 |
return null; |
|
65 |
} |
|
66 |
return packEntity.getModelPath(); |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void create(PackEntity entity) { |
|
71 |
entity.setId(UUID.randomUUID().toString()); |
|
72 |
iconDao.insert(entity); |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public void update(PackEntity entity) { |
|
77 |
iconDao.updateById(entity); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public PackEntity get(String id) { |
|
82 |
return iconDao.selectById(id); |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public void delete(String id) { |
|
87 |
iconDao.deleteById(id); |
|
88 |
} |
|
89 |
} |