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.framework.common.util.object.ConvertUtils;
|
import com.iailab.module.model.mpk.dao.GeneratorCodeHistoryDao;
|
import com.iailab.module.model.mpk.dao.ModelMethodDao;
|
import com.iailab.module.model.mpk.dto.GeneratorCodeHistoryDTO;
|
import com.iailab.module.model.mpk.entity.GeneratorCodeHistoryEntity;
|
import com.iailab.module.model.mpk.entity.ModelMethodEntity;
|
import com.iailab.module.model.mpk.service.GeneratorCodeHistoryService;
|
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;
|
|
/**
|
* @description: 生成代码记录表
|
* @author: dzd
|
* @date: 2024/8/20 11:49
|
**/
|
|
@Service
|
public class GeneratorCodeHistoryServiceImpl extends BaseServiceImpl<GeneratorCodeHistoryDao, GeneratorCodeHistoryEntity> implements GeneratorCodeHistoryService {
|
|
@Override
|
public PageData<GeneratorCodeHistoryDTO> page(Map<String, Object> params) {
|
IPage<GeneratorCodeHistoryEntity> page = baseDao.selectPage(
|
getPage(params, "create_time", false),
|
getWrapper(params)
|
);
|
|
return getPageData(page, GeneratorCodeHistoryDTO.class);
|
}
|
|
@Override
|
public GeneratorCodeHistoryDTO get(String id) {
|
GeneratorCodeHistoryEntity entity = baseDao.selectById(id);
|
|
return ConvertUtils.sourceToTarget(entity, GeneratorCodeHistoryDTO.class);
|
}
|
|
@Override
|
public byte[] download(GeneratorCodeHistoryDTO dto) throws IOException {
|
File file = new File(dto.getFilePath());
|
if (!file.exists()) {
|
log.error("文件不存在,路径:" + dto.getFilePath());
|
}
|
return FileUtils.readFileToByteArray(file);
|
}
|
|
@Override
|
public void deleteByMap(Map<String, Object> map) {
|
baseDao.delete(getWrapper(map));
|
}
|
|
@Override
|
public List<GeneratorCodeHistoryDTO> list(Map<String, Object> map) {
|
return ConvertUtils.sourceToTarget(baseDao.selectList(getWrapper(map)),GeneratorCodeHistoryDTO.class);
|
}
|
|
@Override
|
public void save(GeneratorCodeHistoryDTO dto) {
|
|
}
|
|
public QueryWrapper<GeneratorCodeHistoryEntity> getWrapper(Map<String, Object> params){
|
String id = (String)params.get("id");
|
String mdkId = (String)params.get("mdkId");
|
String startTime = (String)params.get("startTime");
|
String endTime = (String)params.get("endTime");
|
|
QueryWrapper<GeneratorCodeHistoryEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
wrapper.eq(StringUtils.isNotBlank(mdkId), "mdk_id", mdkId);
|
wrapper.ge(StringUtils.isNotBlank(startTime), "create_time", startTime);
|
wrapper.le(StringUtils.isNotBlank(endTime), "create_time", endTime);
|
|
return wrapper;
|
}
|
|
|
}
|