package com.iailab.module.model.mpk.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.iailab.framework.common.page.PageData;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.service.impl.CrudServiceImpl;
|
import com.iailab.module.model.mpk.dao.ProjectPackageHistoryDao;
|
import com.iailab.module.model.mpk.dto.ProjectDTO;
|
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.List;
|
import java.util.Map;
|
|
/**
|
* 项目打包历史记录表
|
*
|
* @author Dzd
|
* @since 1.0.0 2024-08-22
|
*/
|
@Service
|
public class ProjectPackageHistoryServiceImpl extends BaseServiceImpl<ProjectPackageHistoryDao, ProjectPackageHistoryEntity> implements ProjectPackageHistoryService {
|
|
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));
|
}
|
|
@Override
|
public List<ProjectPackageHistoryEntity> list(Map<String, Object> map) {
|
return baseDao.selectList(getWrapper(map));
|
}
|
|
@Override
|
public PageData<ProjectPackageHistoryDTO> page(Map<String, Object> params) {
|
IPage<ProjectPackageHistoryEntity> page = baseDao.selectPage(getPage(params, "create_time", false), getWrapper(params));
|
return getPageData(page, ProjectPackageHistoryDTO.class);
|
}
|
}
|