提交 | 用户 | 时间
|
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.baomidou.mybatisplus.core.metadata.IPage; |
D |
5 |
import com.iailab.framework.common.page.PageData; |
|
6 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
449017
|
7 |
import com.iailab.framework.common.service.impl.CrudServiceImpl; |
D |
8 |
import com.iailab.module.model.mpk.dao.ProjectPackageHistoryDao; |
558ffc
|
9 |
import com.iailab.module.model.mpk.dto.ProjectDTO; |
449017
|
10 |
import com.iailab.module.model.mpk.dto.ProjectPackageHistoryDTO; |
D |
11 |
import com.iailab.module.model.mpk.entity.ProjectPackageHistoryEntity; |
|
12 |
import com.iailab.module.model.mpk.service.ProjectPackageHistoryService; |
|
13 |
import org.apache.commons.io.FileUtils; |
|
14 |
import org.apache.commons.lang3.StringUtils; |
|
15 |
import org.springframework.stereotype.Service; |
|
16 |
|
|
17 |
import java.io.File; |
|
18 |
import java.io.IOException; |
558ffc
|
19 |
import java.util.List; |
449017
|
20 |
import java.util.Map; |
D |
21 |
|
|
22 |
/** |
|
23 |
* 项目打包历史记录表 |
|
24 |
* |
|
25 |
* @author Dzd |
|
26 |
* @since 1.0.0 2024-08-22 |
|
27 |
*/ |
|
28 |
@Service |
558ffc
|
29 |
public class ProjectPackageHistoryServiceImpl extends BaseServiceImpl<ProjectPackageHistoryDao, ProjectPackageHistoryEntity> implements ProjectPackageHistoryService { |
449017
|
30 |
|
D |
31 |
public QueryWrapper<ProjectPackageHistoryEntity> getWrapper(Map<String, Object> params){ |
|
32 |
String id = (String)params.get("id"); |
|
33 |
String projectId = (String)params.get("projectId"); |
|
34 |
String startTime = (String)params.get("startTime"); |
|
35 |
String endTime = (String)params.get("endTime"); |
|
36 |
|
|
37 |
QueryWrapper<ProjectPackageHistoryEntity> wrapper = new QueryWrapper<>(); |
|
38 |
wrapper.eq(StringUtils.isNotBlank(id), "id", id); |
|
39 |
wrapper.eq(StringUtils.isNotBlank(projectId), "project_id", projectId); |
|
40 |
wrapper.ge(StringUtils.isNotBlank(startTime), "create_time", startTime); |
|
41 |
wrapper.le(StringUtils.isNotBlank(endTime), "create_time", endTime); |
|
42 |
wrapper.orderByDesc("create_time"); |
|
43 |
|
|
44 |
return wrapper; |
|
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
@Override |
|
49 |
public byte[] download(String filePath) throws IOException { |
|
50 |
File file = new File(filePath); |
|
51 |
if (!file.exists()) { |
|
52 |
log.error("文件不存在,路径:" + filePath); |
|
53 |
} |
|
54 |
return FileUtils.readFileToByteArray(file); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public void deleteByMap(Map<String, Object> map) { |
|
59 |
baseDao.delete(getWrapper(map)); |
|
60 |
} |
558ffc
|
61 |
|
D |
62 |
@Override |
|
63 |
public List<ProjectPackageHistoryEntity> list(Map<String, Object> map) { |
|
64 |
return baseDao.selectList(getWrapper(map)); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public PageData<ProjectPackageHistoryDTO> page(Map<String, Object> params) { |
|
69 |
IPage<ProjectPackageHistoryEntity> page = baseDao.selectPage(getPage(params, "create_time", false), getWrapper(params)); |
|
70 |
return getPageData(page, ProjectPackageHistoryDTO.class); |
|
71 |
} |
449017
|
72 |
} |