Commit 905c8c64 authored by dqjdda's avatar dqjdda
Browse files

所有列表加入日期搜索与导出功能

parent 938ae1fc
......@@ -3,6 +3,7 @@ package me.zhengjie.service.dto;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.sql.Timestamp;
/**
......@@ -11,7 +12,7 @@ import java.sql.Timestamp;
*/
@Getter
@Setter
public class LocalStorageDTO{
public class LocalStorageDTO implements Serializable {
// ID
private Long id;
......
......@@ -14,4 +14,10 @@ public class LocalStorageQueryCriteria{
// 模糊
@Query(blurry = "name,suffix,type,operate,size")
private String blurry;
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
private Timestamp startTime;
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
private Timestamp endTime;
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package me.zhengjie.service.dto;
import lombok.Data;
import me.zhengjie.annotation.Query;
import java.sql.Timestamp;
/**
* sm.ms图床
*
......@@ -17,4 +19,10 @@ public class PictureQueryCriteria{
@Query(type = Query.Type.INNER_LIKE)
private String username;
@Query(type = Query.Type.GREATER_THAN,propName = "createTime")
private Timestamp startTime;
@Query(type = Query.Type.LESS_THAN,propName = "createTime")
private Timestamp endTime;
}
......@@ -3,6 +3,8 @@ package me.zhengjie.service.dto;
import lombok.Data;
import me.zhengjie.annotation.Query;
import java.sql.Timestamp;
/**
* @author Zheng Jie
* @date 2019-6-4 09:54:37
......@@ -12,4 +14,10 @@ public class QiniuQueryCriteria{
@Query(type = Query.Type.INNER_LIKE)
private String key;
@Query(type = Query.Type.GREATER_THAN,propName = "updateTime")
private Timestamp startTime;
@Query(type = Query.Type.LESS_THAN,propName = "updateTime")
private Timestamp endTime;
}
......@@ -17,10 +17,18 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* @author Zheng Jie
* @date 2019-09-05
......@@ -54,7 +62,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
@Override
@Cacheable
public Object queryAll(LocalStorageQueryCriteria criteria){
public List<LocalStorageDTO> queryAll(LocalStorageQueryCriteria criteria){
return localStorageMapper.toDto(localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
......@@ -126,4 +134,20 @@ public class LocalStorageServiceImpl implements LocalStorageService {
localStorageRepository.delete(storage);
}
}
@Override
public void download(List<LocalStorageDTO> queryAll, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (LocalStorageDTO localStorageDTO : queryAll) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("文件名", localStorageDTO.getRealName());
map.put("备注名", localStorageDTO.getName());
map.put("文件类型", localStorageDTO.getType());
map.put("文件大小", localStorageDTO.getSize());
map.put("操作人", localStorageDTO.getOperate());
map.put("创建日期", localStorageDTO.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}
......@@ -19,8 +19,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.HashMap;
import java.io.IOException;
import java.util.*;
/**
* @author Zheng Jie
......@@ -50,6 +53,11 @@ public class PictureServiceImpl implements PictureService {
return PageUtil.toPage(pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
}
@Override
public List<Picture> queryAll(PictureQueryCriteria criteria) {
return pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
}
@Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Throwable.class)
......@@ -106,4 +114,22 @@ public class PictureServiceImpl implements PictureService {
delete(findById(id));
}
}
@Override
public void download(List<Picture> queryAll, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (Picture picture : queryAll) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("文件名", picture.getFilename());
map.put("图片地址", picture.getUrl());
map.put("文件大小", picture.getSize());
map.put("操作人", picture.getUsername());
map.put("高度", picture.getHeight());
map.put("宽度", picture.getWidth());
map.put("删除地址", picture.getDelete());
map.put("创建日期", picture.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}
......@@ -31,7 +31,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author Zheng Jie
......@@ -60,6 +63,11 @@ public class QiNiuServiceImpl implements QiNiuService {
return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
}
@Override
public List<QiniuContent> queryAll(QiniuQueryCriteria criteria) {
return qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
}
@Override
@Cacheable(key = "'1'")
public QiniuConfig find() {
......@@ -206,4 +214,20 @@ public class QiNiuServiceImpl implements QiNiuService {
public void update(String type) {
qiNiuConfigRepository.update(type);
}
@Override
public void downloadList(List<QiniuContent> queryAll, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (QiniuContent content : queryAll) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("文件名", content.getKey());
map.put("文件类型", content.getSuffix());
map.put("空间名称", content.getBucket());
map.put("文件大小", content.getSize());
map.put("空间类型", content.getType());
map.put("创建日期", content.getUpdateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment