提交 | 用户 | 时间
|
449017
|
1 |
package com.iailab.module.model.mpk.service.impl; |
D |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
558ffc
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
449017
|
5 |
import com.iailab.framework.common.service.impl.CrudServiceImpl; |
D |
6 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
7 |
import com.iailab.module.model.mpk.dao.ProjectModelDao; |
423f24
|
8 |
import com.iailab.module.model.mpk.dto.MpkFileDTO; |
449017
|
9 |
import com.iailab.module.model.mpk.dto.ProjectModelDTO; |
D |
10 |
import com.iailab.module.model.mpk.entity.ProjectModelEntity; |
|
11 |
import com.iailab.module.model.mpk.service.ProjectModelService; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
|
423f24
|
15 |
import java.util.ArrayList; |
449017
|
16 |
import java.util.List; |
D |
17 |
import java.util.Map; |
423f24
|
18 |
import java.util.UUID; |
449017
|
19 |
|
D |
20 |
/** |
|
21 |
* @description: |
|
22 |
* @author: dzd |
|
23 |
* @date: 2024/8/22 14:41 |
|
24 |
**/ |
|
25 |
@Service |
558ffc
|
26 |
public class ProjectModelServiceImpl extends BaseServiceImpl<ProjectModelDao, ProjectModelEntity> implements ProjectModelService { |
449017
|
27 |
@Override |
D |
28 |
public List<ProjectModelDTO> list(Map<String, Object> params) { |
|
29 |
List<ProjectModelEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
30 |
|
|
31 |
return ConvertUtils.sourceToTarget(entityList, ProjectModelDTO.class); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public void deleteByMap(Map<String,Object> map) { |
|
36 |
baseDao.delete(getWrapper(map)); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
423f24
|
40 |
public void create(List<MpkFileDTO> models, String projectId) { |
D |
41 |
List<ProjectModelEntity> list = new ArrayList<>(models.size()); |
|
42 |
for (MpkFileDTO model : models) { |
|
43 |
ProjectModelEntity projectModel = new ProjectModelEntity(); |
|
44 |
projectModel.setId(UUID.randomUUID().toString()); |
|
45 |
projectModel.setProjectId(projectId); |
|
46 |
projectModel.setModelId(model.getId()); |
|
47 |
list.add(projectModel); |
|
48 |
} |
|
49 |
baseDao.insert(list); |
|
50 |
} |
|
51 |
|
449017
|
52 |
public QueryWrapper<ProjectModelEntity> getWrapper(Map<String, Object> params){ |
D |
53 |
String id = (String)params.get("id"); |
|
54 |
String projectId = (String)params.get("projectId"); |
|
55 |
String modelId = (String)params.get("modelId"); |
|
56 |
|
|
57 |
QueryWrapper<ProjectModelEntity> wrapper = new QueryWrapper<>(); |
|
58 |
wrapper.eq(StringUtils.isNotBlank(id), "id", id) |
|
59 |
.eq(StringUtils.isNotBlank(projectId), "project_id", projectId) |
|
60 |
.eq(StringUtils.isNotBlank(modelId),"model_id",modelId); |
|
61 |
|
|
62 |
return wrapper; |
|
63 |
} |
|
64 |
|
|
65 |
|
|
66 |
} |