提交 | 用户 | 时间
|
449017
|
1 |
package com.iailab.module.model.mpk.service.impl; |
D |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
5 |
import com.iailab.framework.common.page.PageData; |
558ffc
|
6 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
449017
|
7 |
import com.iailab.framework.common.service.impl.CrudServiceImpl; |
D |
8 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
9 |
import com.iailab.module.model.mpk.dao.GeneratorCodeHistoryDao; |
558ffc
|
10 |
import com.iailab.module.model.mpk.dao.ModelMethodDao; |
449017
|
11 |
import com.iailab.module.model.mpk.dto.GeneratorCodeHistoryDTO; |
D |
12 |
import com.iailab.module.model.mpk.entity.GeneratorCodeHistoryEntity; |
558ffc
|
13 |
import com.iailab.module.model.mpk.entity.ModelMethodEntity; |
449017
|
14 |
import com.iailab.module.model.mpk.service.GeneratorCodeHistoryService; |
D |
15 |
import org.apache.commons.io.FileUtils; |
|
16 |
import org.apache.commons.lang3.StringUtils; |
|
17 |
import org.springframework.stereotype.Service; |
|
18 |
|
|
19 |
import java.io.File; |
|
20 |
import java.io.IOException; |
558ffc
|
21 |
import java.util.List; |
449017
|
22 |
import java.util.Map; |
D |
23 |
|
|
24 |
/** |
|
25 |
* @description: 生成代码记录表 |
|
26 |
* @author: dzd |
|
27 |
* @date: 2024/8/20 11:49 |
|
28 |
**/ |
|
29 |
|
|
30 |
@Service |
558ffc
|
31 |
public class GeneratorCodeHistoryServiceImpl extends BaseServiceImpl<GeneratorCodeHistoryDao, GeneratorCodeHistoryEntity> implements GeneratorCodeHistoryService { |
449017
|
32 |
|
D |
33 |
@Override |
|
34 |
public PageData<GeneratorCodeHistoryDTO> page(Map<String, Object> params) { |
|
35 |
IPage<GeneratorCodeHistoryEntity> page = baseDao.selectPage( |
|
36 |
getPage(params, "create_time", false), |
|
37 |
getWrapper(params) |
|
38 |
); |
|
39 |
|
|
40 |
return getPageData(page, GeneratorCodeHistoryDTO.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public GeneratorCodeHistoryDTO get(String id) { |
|
45 |
GeneratorCodeHistoryEntity entity = baseDao.selectById(id); |
|
46 |
|
|
47 |
return ConvertUtils.sourceToTarget(entity, GeneratorCodeHistoryDTO.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public byte[] download(GeneratorCodeHistoryDTO dto) throws IOException { |
|
52 |
File file = new File(dto.getFilePath()); |
|
53 |
if (!file.exists()) { |
|
54 |
log.error("文件不存在,路径:" + dto.getFilePath()); |
|
55 |
} |
|
56 |
return FileUtils.readFileToByteArray(file); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public void deleteByMap(Map<String, Object> map) { |
|
61 |
baseDao.delete(getWrapper(map)); |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
558ffc
|
65 |
public List<GeneratorCodeHistoryDTO> list(Map<String, Object> map) { |
D |
66 |
return ConvertUtils.sourceToTarget(baseDao.selectList(getWrapper(map)),GeneratorCodeHistoryDTO.class); |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void save(GeneratorCodeHistoryDTO dto) { |
|
71 |
|
|
72 |
} |
|
73 |
|
449017
|
74 |
public QueryWrapper<GeneratorCodeHistoryEntity> getWrapper(Map<String, Object> params){ |
D |
75 |
String id = (String)params.get("id"); |
|
76 |
String mdkId = (String)params.get("mdkId"); |
|
77 |
String startTime = (String)params.get("startTime"); |
|
78 |
String endTime = (String)params.get("endTime"); |
|
79 |
|
|
80 |
QueryWrapper<GeneratorCodeHistoryEntity> wrapper = new QueryWrapper<>(); |
|
81 |
wrapper.eq(StringUtils.isNotBlank(id), "id", id); |
|
82 |
wrapper.eq(StringUtils.isNotBlank(mdkId), "mdk_id", mdkId); |
|
83 |
wrapper.ge(StringUtils.isNotBlank(startTime), "create_time", startTime); |
|
84 |
wrapper.le(StringUtils.isNotBlank(endTime), "create_time", endTime); |
|
85 |
|
|
86 |
return wrapper; |
|
87 |
} |
|
88 |
|
|
89 |
|
|
90 |
} |