Commit 343ce346 authored by zhengjie's avatar zhengjie
Browse files

v1.9 发布,详情查看发行版说明

parent 31e4a08a
...@@ -67,4 +67,17 @@ public class PictureController { ...@@ -67,4 +67,17 @@ public class PictureController {
pictureService.delete(pictureService.findById(id)); pictureService.delete(pictureService.findById(id));
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
/**
* 删除多张图片
* @param ids
* @return
*/
@Log("删除图片")
@PreAuthorize("hasAnyRole('ADMIN','PICTURE_ALL','PICTURE_DELETE')")
@DeleteMapping(value = "/pictures")
public ResponseEntity deleteAll(@RequestBody Long[] ids) {
pictureService.deleteAll(ids);
return new ResponseEntity(HttpStatus.OK);
}
} }
...@@ -8,15 +8,11 @@ import me.zhengjie.service.QiNiuService; ...@@ -8,15 +8,11 @@ import me.zhengjie.service.QiNiuService;
import me.zhengjie.service.query.QiNiuQueryService; import me.zhengjie.service.query.QiNiuQueryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.nio.charset.Charset;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -108,4 +104,16 @@ public class QiniuController { ...@@ -108,4 +104,16 @@ public class QiniuController {
qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find()); qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find());
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
/**
* 删除多张图片
* @param ids
* @return
*/
@Log("删除图片")
@DeleteMapping(value = "/qiNiuContent")
public ResponseEntity deleteAll(@RequestBody Long[] ids) {
qiNiuService.deleteAll(ids, qiNiuService.find());
return new ResponseEntity(HttpStatus.OK);
}
} }
...@@ -36,4 +36,11 @@ public interface PictureService { ...@@ -36,4 +36,11 @@ public interface PictureService {
*/ */
@CacheEvict(allEntries = true) @CacheEvict(allEntries = true)
void delete(Picture picture); void delete(Picture picture);
/**
* 删除图片
* @param ids
*/
@CacheEvict(allEntries = true)
void deleteAll(Long[] ids);
} }
...@@ -69,4 +69,12 @@ public interface QiNiuService { ...@@ -69,4 +69,12 @@ public interface QiNiuService {
*/ */
@CacheEvict(allEntries = true) @CacheEvict(allEntries = true)
void synchronize(QiniuConfig config); void synchronize(QiniuConfig config);
/**
* 删除文件
* @param ids
* @return
*/
@CacheEvict(allEntries = true)
void deleteAll(Long[] ids, QiniuConfig config);
} }
...@@ -84,4 +84,11 @@ public class PictureServiceImpl implements PictureService { ...@@ -84,4 +84,11 @@ public class PictureServiceImpl implements PictureService {
} }
} }
@Override
public void deleteAll(Long[] ids) {
for (Long id : ids) {
delete(findById(id));
}
}
} }
...@@ -179,4 +179,11 @@ public class QiNiuServiceImpl implements QiNiuService { ...@@ -179,4 +179,11 @@ public class QiNiuServiceImpl implements QiNiuService {
} }
} }
@Override
public void deleteAll(Long[] ids, QiniuConfig config) {
for (Long id : ids) {
delete(findByContentId(id), config);
}
}
} }
...@@ -59,6 +59,13 @@ public class PictureQueryService { ...@@ -59,6 +59,13 @@ public class PictureQueryService {
list.add(cb.like(root.get("filename").as(String.class),"%"+picture.getFilename()+"%")); list.add(cb.like(root.get("filename").as(String.class),"%"+picture.getFilename()+"%"));
} }
if(!ObjectUtils.isEmpty(picture.getUsername())){
/**
* 模糊
*/
list.add(cb.like(root.get("username").as(String.class),"%"+picture.getUsername()+"%"));
}
Predicate[] p = new Predicate[list.size()]; Predicate[] p = new Predicate[list.size()];
return cb.and(list.toArray(p)); return cb.and(list.toArray(p));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.8</version> <version>1.9</version>
<modules> <modules>
<module>eladmin-common</module> <module>eladmin-common</module>
......
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