提交 | 用户 | 时间
|
6eeac9
|
1 |
package com.iailab.module.model.mcs.sche.service.impl; |
D |
2 |
|
|
3 |
|
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
5 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
6 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
7 |
import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO; |
|
8 |
import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO; |
|
9 |
import com.iailab.module.model.mcs.sche.dao.StScheduleModelOutDao; |
|
10 |
import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity; |
|
11 |
import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
|
12 |
import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService; |
|
13 |
import com.iailab.module.model.mpk.service.MethodSettingService; |
|
14 |
import lombok.extern.slf4j.Slf4j; |
|
15 |
import org.apache.commons.lang3.StringUtils; |
|
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
17 |
import org.springframework.stereotype.Service; |
|
18 |
|
|
19 |
import java.util.HashMap; |
|
20 |
import java.util.List; |
|
21 |
import java.util.Map; |
|
22 |
import java.util.UUID; |
|
23 |
|
|
24 |
/** |
|
25 |
* @description: |
|
26 |
* @author: dyk |
|
27 |
* @date: 2024/12/30 17:43 |
|
28 |
**/ |
|
29 |
@Slf4j |
|
30 |
@Service |
|
31 |
public class StScheduleModelOutServiceImpl extends BaseServiceImpl<StScheduleModelOutDao, StScheduleModelOutEntity> implements StScheduleModelOutService { |
|
32 |
|
|
33 |
@Autowired |
|
34 |
private MethodSettingService methodSettingService; |
|
35 |
|
|
36 |
@Override |
|
37 |
public void deleteByMap(Map<String, Object> map) { |
|
38 |
baseDao.delete(getWrapper(map)); |
|
39 |
} |
|
40 |
|
|
41 |
private QueryWrapper<StScheduleModelOutEntity> getWrapper(Map<String, Object> params) { |
|
42 |
String mpkFileId = (String) params.get("modelId"); |
|
43 |
|
|
44 |
QueryWrapper<StScheduleModelOutEntity> wrapper = new QueryWrapper<>(); |
|
45 |
wrapper.eq(StringUtils.isNotBlank(mpkFileId), "mpk_file_id", mpkFileId); |
|
46 |
|
|
47 |
return wrapper; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public void insertList(List<StScheduleModelOutEntity> list, String modelId) { |
|
52 |
for (int i = 0; i < list.size(); i++) { |
|
53 |
StScheduleModelOutEntity entity = ConvertUtils.sourceToTarget(list.get(i), StScheduleModelOutEntity.class); |
|
54 |
entity.setId(UUID.randomUUID().toString()); |
|
55 |
entity.setModelId(modelId); |
|
56 |
entity.setSort(i); |
|
57 |
baseDao.insert(entity); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public void deleteScheduleModelOut(String modelId) { |
|
63 |
Map<String,Object> map = new HashMap<>(); |
|
64 |
map.put("model_id", modelId); |
|
65 |
baseDao.deleteByMap(map); |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public List<StScheduleModelOutDTO> list(String modelId) { |
|
70 |
QueryWrapper<StScheduleModelOutEntity> queryWrapper = new QueryWrapper<>(); |
b2f92d
|
71 |
queryWrapper.eq("model_id", modelId) |
D |
72 |
.orderByAsc("sort"); |
6eeac9
|
73 |
List<StScheduleModelOutEntity> list = baseDao.selectList(queryWrapper); |
D |
74 |
return ConvertUtils.sourceToTarget(list, StScheduleModelOutDTO.class); |
|
75 |
} |
|
76 |
} |