提交 | 用户 | 时间
|
449017
|
1 |
package com.iailab.module.model.mpk.service.impl; |
D |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
8b3ee3
|
5 |
import com.iailab.framework.common.util.object.ConvertUtils; |
449017
|
6 |
import com.iailab.module.model.mpk.dao.ModelMethodDao; |
8b3ee3
|
7 |
import com.iailab.module.model.mpk.dto.ModelMethodDTO; |
449017
|
8 |
import com.iailab.module.model.mpk.entity.ModelMethodEntity; |
587b43
|
9 |
import com.iailab.module.model.mpk.service.MethodSettingService; |
449017
|
10 |
import com.iailab.module.model.mpk.service.ModelMethodService; |
8b3ee3
|
11 |
import com.iailab.module.model.mpk.service.SettingSelectService; |
449017
|
12 |
import lombok.extern.slf4j.Slf4j; |
D |
13 |
import org.apache.commons.lang3.StringUtils; |
8b3ee3
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
449017
|
15 |
import org.springframework.stereotype.Service; |
587b43
|
16 |
import org.springframework.util.CollectionUtils; |
449017
|
17 |
|
8b3ee3
|
18 |
import java.util.HashMap; |
潘 |
19 |
import java.util.List; |
449017
|
20 |
import java.util.Map; |
8b3ee3
|
21 |
import java.util.UUID; |
449017
|
22 |
|
D |
23 |
/** |
|
24 |
* @description: |
|
25 |
* @author: dzd |
|
26 |
* @date: 2024/9/9 10:51 |
|
27 |
**/ |
|
28 |
@Slf4j |
|
29 |
@Service |
|
30 |
public class ModelMethodServiceImpl extends BaseServiceImpl<ModelMethodDao, ModelMethodEntity> implements ModelMethodService { |
|
31 |
|
8b3ee3
|
32 |
@Autowired |
587b43
|
33 |
private MethodSettingService methodSettingService; |
449017
|
34 |
|
D |
35 |
@Override |
|
36 |
public void deleteByMap(Map<String, Object> map) { |
|
37 |
baseDao.delete(getWrapper(map)); |
|
38 |
} |
|
39 |
|
|
40 |
private QueryWrapper<ModelMethodEntity> getWrapper(Map<String, Object> params) { |
|
41 |
String mpkFileId = (String) params.get("mpkFileId"); |
|
42 |
|
|
43 |
QueryWrapper<ModelMethodEntity> wrapper = new QueryWrapper<>(); |
|
44 |
wrapper.eq(StringUtils.isNotBlank(mpkFileId), "mpk_file_id", mpkFileId); |
|
45 |
|
|
46 |
return wrapper; |
|
47 |
} |
8b3ee3
|
48 |
|
潘 |
49 |
@Override |
|
50 |
public void insertList(List<ModelMethodDTO> list, String fileId) { |
|
51 |
for (int i = 0; i < list.size(); i++) { |
|
52 |
ModelMethodEntity entity = ConvertUtils.sourceToTarget(list.get(i), ModelMethodEntity.class); |
|
53 |
entity.setId(UUID.randomUUID().toString()); |
|
54 |
entity.setMpkFileId(fileId); |
|
55 |
entity.setSort(i); |
|
56 |
baseDao.insert(entity); |
587b43
|
57 |
if (!CollectionUtils.isEmpty(list.get(i).getMethodSettings())) { |
D |
58 |
methodSettingService.insertList(list.get(i).getMethodSettings(), entity.getId()); |
|
59 |
} |
8b3ee3
|
60 |
} |
潘 |
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public void deleteModelMethod(String mpkId) { |
|
65 |
Map<String,Object> map = new HashMap<>(); |
|
66 |
map.put("mpk_file_id", mpkId); |
|
67 |
baseDao.deleteByMap(map); |
|
68 |
} |
449017
|
69 |
} |