Support attachment query by type.

pull/146/head
ruibaby 2019-04-22 00:24:16 +08:00
parent b17e03acff
commit 6b46e8a897
3 changed files with 11 additions and 5 deletions

View File

@ -17,4 +17,6 @@ public class AttachmentQuery {
private String keyword;
private String mediaType;
private String attachmentType;
}

View File

@ -13,8 +13,10 @@ import run.halo.app.handler.file.FileHandlers;
import run.halo.app.model.dto.AttachmentOutputDTO;
import run.halo.app.model.entity.Attachment;
import run.halo.app.model.enums.AttachmentType;
import run.halo.app.model.enums.converter.AttachmentTypeConverter;
import run.halo.app.model.params.AttachmentQuery;
import run.halo.app.model.properties.AttachmentProperties;
import run.halo.app.model.properties.PropertyEnum;
import run.halo.app.model.support.UploadResult;
import run.halo.app.repository.AttachmentRepository;
import run.halo.app.service.AttachmentService;
@ -73,6 +75,10 @@ public class AttachmentServiceImpl extends AbstractCrudService<Attachment, Integ
predicates.add(criteriaBuilder.equal(root.get("mediaType"), attachmentQuery.getMediaType()));
}
if(attachmentQuery.getAttachmentType() != null){
predicates.add(criteriaBuilder.equal(root.get("type"), PropertyEnum.convertToEnum(attachmentQuery.getAttachmentType(),AttachmentType.class)));
}
if (attachmentQuery.getKeyword() != null) {
String likeCondition = String.format("%%%s%%", StringUtils.strip(attachmentQuery.getKeyword()));

View File

@ -20,8 +20,8 @@ see https://gitee.com/yadong.zhang/DBlog/blob/master/blog-web/src/main/java/com/
#myTable {
list-style: none;
margin: 10px 0px 10px 0px;
padding: 0px;
margin: 10px 0 10px 0;
padding: 0;
width: 100%;
min-width: 804px;
}
@ -80,7 +80,7 @@ see https://gitee.com/yadong.zhang/DBlog/blob/master/blog-web/src/main/java/com/
#footer {
padding: 2px;
margin: 0px;
margin: 0;
font-size: 8pt;
color: gray;
min-width: 900px;
@ -103,7 +103,6 @@ see https://gitee.com/yadong.zhang/DBlog/blob/master/blog-web/src/main/java/com/
margin-top: 10px;
}
/* 窗口缩小到768px以下时 */
@media (max-width: 768px) {
.T2-h, .T3-h, .T4-h, .T2, .T3, .T4 {
display: none;
@ -118,7 +117,6 @@ see https://gitee.com/yadong.zhang/DBlog/blob/master/blog-web/src/main/java/com/
}
}
/* 窗口放大到768px以上时 */
@media (min-width: 768px) {
}