package com.iailab.module.model.mpk.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.service.impl.CrudServiceImpl;
|
import com.iailab.module.model.mpk.dao.ProjectPackageHistoryDao;
|
import com.iailab.module.model.mpk.dto.ProjectPackageHistoryDTO;
|
import com.iailab.module.model.mpk.entity.ProjectPackageHistoryEntity;
|
import com.iailab.module.model.mpk.service.ProjectPackageHistoryService;
|
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.util.Map;
|
|
/**
|
* 项目打包历史记录表
|
*
|
* @author Dzd
|
* @since 1.0.0 2024-08-22
|
*/
|
@Service
|
public class ProjectPackageHistoryServiceImpl extends CrudServiceImpl<ProjectPackageHistoryDao, ProjectPackageHistoryEntity, ProjectPackageHistoryDTO> implements ProjectPackageHistoryService {
|
|
@Override
|
public QueryWrapper<ProjectPackageHistoryEntity> getWrapper(Map<String, Object> params){
|
String id = (String)params.get("id");
|
String projectId = (String)params.get("projectId");
|
String startTime = (String)params.get("startTime");
|
String endTime = (String)params.get("endTime");
|
|
QueryWrapper<ProjectPackageHistoryEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
wrapper.eq(StringUtils.isNotBlank(projectId), "project_id", projectId);
|
wrapper.ge(StringUtils.isNotBlank(startTime), "create_time", startTime);
|
wrapper.le(StringUtils.isNotBlank(endTime), "create_time", endTime);
|
wrapper.orderByDesc("create_time");
|
|
return wrapper;
|
}
|
|
|
@Override
|
public byte[] download(String filePath) throws IOException {
|
File file = new File(filePath);
|
if (!file.exists()) {
|
log.error("文件不存在,路径:" + filePath);
|
}
|
return FileUtils.readFileToByteArray(file);
|
}
|
|
@Override
|
public void deleteByMap(Map<String, Object> map) {
|
baseDao.delete(getWrapper(map));
|
}
|
}
|