mirror of https://github.com/elunez/eladmin
增加文件目录和文件上传部分
parent
d694de3260
commit
a9d9962950
|
@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -198,4 +199,18 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
}
|
||||
return weekDays[w];
|
||||
}
|
||||
|
||||
private static byte[] lock = new byte[0];
|
||||
|
||||
// 位数,默认是8位
|
||||
private final static long w = 100000000;
|
||||
|
||||
public static String createID() {
|
||||
long r = 0;
|
||||
synchronized (lock) {
|
||||
r = (long) ((Math.random() + 1) * w);
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmsss");
|
||||
return formatter.format(System.currentTimeMillis()) + String.valueOf(r).substring(1);
|
||||
}
|
||||
}
|
|
@ -42,4 +42,6 @@ public interface RedisService {
|
|||
* 清空所有缓存
|
||||
*/
|
||||
void flushdb();
|
||||
|
||||
Object getObjectByKey(String key);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,16 @@ public class RedisServiceImpl implements RedisService {
|
|||
redisTemplate.getConnectionFactory().getConnection().flushDb();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObjectByKey(String key){
|
||||
try {
|
||||
Object value = redisTemplate.opsForValue().get(key);
|
||||
return value;
|
||||
}catch (Exception e){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCodeVal(String key) {
|
||||
try {
|
||||
|
|
|
@ -70,6 +70,7 @@ public class AuthenticationController {
|
|||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
final JwtUser jwtUser = (JwtUser) userDetailsService.loadUserByUsername(authorizationUser.getUsername());
|
||||
redisService.saveCode("user",jwtUser);
|
||||
|
||||
if(!jwtUser.getPassword().equals(EncryptUtils.encryptPassword(authorizationUser.getPassword()))){
|
||||
throw new AccountExpiredException("密码错误");
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="file")
|
||||
public class FileModel implements Serializable {
|
||||
|
||||
/**s
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "paymentableGenerator")
|
||||
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(name = "file_name",nullable = false)
|
||||
@NotBlank
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(name = "origin_name",nullable = false)
|
||||
@NotBlank
|
||||
private String originName;
|
||||
|
||||
|
||||
/**
|
||||
* 所属目录
|
||||
*/
|
||||
@OneToOne
|
||||
@JoinColumn(name = "filesort_id")
|
||||
private FileSort fileSort;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
@Column(name = "file_type",nullable = false)
|
||||
@NotNull
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 上传人
|
||||
*/
|
||||
@Column(name = "uploader",nullable = false)
|
||||
@NotNull
|
||||
private String uploader;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="file_sort")
|
||||
public class FileSort implements Serializable {
|
||||
|
||||
/**s
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "paymentableGenerator")
|
||||
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(name = "name",nullable = false)
|
||||
@NotBlank
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 上级目录
|
||||
*/
|
||||
@Column(name = "pid",nullable = false)
|
||||
@NotNull
|
||||
private String pid;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
public interface FileRepository extends JpaRepository<FileModel, String>, JpaSpecificationExecutor {
|
||||
|
||||
// /**
|
||||
// * findByPid
|
||||
// * @param fileSortId
|
||||
// * @return
|
||||
// */
|
||||
// List<FileModel> findByFileSortId(String fileSortId);
|
||||
//
|
||||
// @Query(value = "select name from file_sort union all select file_name as name from file where id = ?",nativeQuery = true)
|
||||
// String findAllFileAndSortNameById(String id);
|
||||
|
||||
// Set<Dept> findByRoles_Id(Long id);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
public interface FileSortRepository extends JpaRepository<FileSort, String>, JpaSpecificationExecutor {
|
||||
|
||||
/**
|
||||
* findByPid
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<FileSort> findByPid(String id);
|
||||
|
||||
@Query(value = "select name from file_sort where id = ?",nativeQuery = true)
|
||||
String findNameById(String id);
|
||||
|
||||
// Set<Dept> findByRoles_Id(Long id);
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.config.DataScope;
|
||||
import me.zhengjie.modules.monitor.service.RedisService;
|
||||
import me.zhengjie.modules.security.security.JwtUser;
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.repository.FileRepository;
|
||||
import me.zhengjie.modules.system.service.FileService;
|
||||
import me.zhengjie.modules.system.service.FileSortService;
|
||||
import me.zhengjie.modules.system.service.dto.FileQueryCriteria;
|
||||
import me.zhengjie.modules.system.service.mapper.FileMapper;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class FileController {
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
@Autowired
|
||||
private FileSortService fileSortService;
|
||||
|
||||
// @Autowired
|
||||
// private FileMapper fileMapper;
|
||||
|
||||
@Autowired
|
||||
private DataScope dataScope;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private FileRepository fileRepository;
|
||||
|
||||
@Value("${filePath}")
|
||||
private String UPLOAD_FOLDER;
|
||||
|
||||
private static final String ENTITY_NAME = "file";
|
||||
|
||||
@Log("查询目录")
|
||||
@GetMapping(value = "/file")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_SELECT')")
|
||||
public ResponseEntity getFiles(FileQueryCriteria criteria, Pageable pageable){
|
||||
Set<String> fileSortSet = new HashSet<>();
|
||||
Set<String> result = new HashSet<>();
|
||||
if (!ObjectUtils.isEmpty(criteria.getFileSortId())) {
|
||||
fileSortSet.add(criteria.getFileSortId());
|
||||
}
|
||||
result.addAll(fileSortSet);
|
||||
criteria.setFileSortIds(result);
|
||||
// Page<FileModel> page = fileRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
// Map m = PageUtil.toPage(page.map(fileMapper::toDto));
|
||||
Object m2 = (Map) fileService.queryAll(criteria,pageable);
|
||||
return new ResponseEntity(m2 ,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增文件")
|
||||
@PostMapping(value = "/file")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_CREATE')")
|
||||
public ResponseEntity create(HttpServletRequest request){
|
||||
// if (Objects.isNull(files)) {
|
||||
// return new ResponseEntity("文件为空,请重新上传",HttpStatus.CREATED);
|
||||
// }
|
||||
JwtUser user =(JwtUser)redisService.getObjectByKey("user");
|
||||
String userName="";
|
||||
if(null!=user){
|
||||
userName=user.getUsername();
|
||||
}
|
||||
String fileSortId = request.getParameter("fileSortId");
|
||||
FileSort sort = new FileSort();
|
||||
sort.setId(fileSortId);
|
||||
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
|
||||
Path path = Paths.get(UPLOAD_FOLDER);
|
||||
try {
|
||||
//如果没有files文件夹,则创建
|
||||
if (!Files.isWritable(path)) {
|
||||
Files.createDirectories(Paths.get(UPLOAD_FOLDER));
|
||||
}
|
||||
if(multipartResolver.isMultipart(request)){
|
||||
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
|
||||
Iterator<String> iter = multipartHttpServletRequest.getFileNames();
|
||||
while (iter.hasNext()){
|
||||
FileModel fileModel = new FileModel();
|
||||
MultipartFile file = multipartHttpServletRequest.getFile(iter.next());
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String extensinName = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
String newFileName = StringUtils.createID()+"."+extensinName;
|
||||
file.transferTo(new File(UPLOAD_FOLDER+"\\"+newFileName));
|
||||
fileModel.setUploader(userName);
|
||||
fileModel.setFileName(newFileName);
|
||||
fileModel.setOriginName(originFileName);
|
||||
fileModel.setFileSort(sort);
|
||||
fileModel.setFileType(extensinName);
|
||||
fileService.create(fileModel);
|
||||
}
|
||||
|
||||
}
|
||||
return new ResponseEntity("文件上传成功",HttpStatus.CREATED);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity("文件上传失败",HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Log("修改文件")
|
||||
@PutMapping(value = "/file")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_EDIT')")
|
||||
public ResponseEntity update(@Validated(FileModel.Update.class) @RequestBody FileModel resources){
|
||||
fileService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除部门")
|
||||
@DeleteMapping(value = "/file/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable String id){
|
||||
fileService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
/**
|
||||
* 文件下载到客户端
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@Log("文件下载")
|
||||
@GetMapping(value = "/fileDownload")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_SELECT')")
|
||||
protected ResponseEntity<org.springframework.core.io.Resource> download(String fileNames) {
|
||||
String[] fileArray = fileNames.split(",");
|
||||
File file = new File(UPLOAD_FOLDER+"\\"+fileArray[0]);
|
||||
String fileName = fileArray[0];
|
||||
org.springframework.core.io.Resource body = new FileSystemResource(file);
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
||||
.getRequest();
|
||||
String header = request.getHeader("User-Agent").toUpperCase();
|
||||
HttpStatus status = HttpStatus.CREATED;
|
||||
try {
|
||||
if (header.contains("MSIE") || header.contains("TRIDENT") || header.contains("EDGE")) {
|
||||
// IE下载文件名空格变+号问题
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
fileName = fileName.replace("+", "%20");
|
||||
status = HttpStatus.OK;
|
||||
} else {
|
||||
fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1");
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
headers.setContentDispositionFormData("attachment", fileName);
|
||||
//headers.setContentDisposition();
|
||||
headers.setContentLength(file.length());
|
||||
return new ResponseEntity<org.springframework.core.io.Resource>(body, headers, status);
|
||||
}
|
||||
|
||||
// @Log("文件下载")
|
||||
// @GetMapping(value = "/fileDownload")
|
||||
// @PreAuthorize("hasAnyRole('ADMIN','FILE_ALL','FILE_SELECT')")
|
||||
// public void download(String fileNames, HttpServletResponse response) {
|
||||
// try {
|
||||
// String[] fileArray = fileNames.split(",");
|
||||
// File file = new File(UPLOAD_FOLDER+"\\"+fileArray[0]);
|
||||
// String fileName = fileArray[0];
|
||||
// if(StringUtils.isNotBlank(fileName)){
|
||||
// // 取得文件名。
|
||||
// // 以流的形式下载文件。
|
||||
// InputStream fis = new BufferedInputStream(new FileInputStream(file));
|
||||
// byte[] buffer = new byte[fis.available()];
|
||||
// fis.read(buffer);
|
||||
// fis.close();
|
||||
// // 清空response
|
||||
// response.reset();
|
||||
// String uncod= URLDecoder.decode(fileName,"UTF-8");
|
||||
// fileName = new String(uncod.getBytes("UTF-8"), "iso-8859-1");
|
||||
// response.setHeader("Content-Disposition", "attachment;filename=".concat(String.valueOf(fileName)));
|
||||
// // 设置response的Header
|
||||
// response.addHeader("Content-Length", "" + file.length());
|
||||
// OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
||||
// toClient.write(buffer);
|
||||
// toClient.flush();
|
||||
// toClient.close();
|
||||
// }
|
||||
//// path是指欲下载的文件的路径。
|
||||
// } catch (IOException ex) {
|
||||
// ex.printStackTrace();
|
||||
//}
|
||||
//}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.config.DataScope;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.service.FileSortService;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortDTO;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortQueryCriteria;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class FileSortController {
|
||||
|
||||
@Autowired
|
||||
private FileSortService fileSortService;
|
||||
|
||||
@Autowired
|
||||
private DataScope dataScope;
|
||||
|
||||
private static final String ENTITY_NAME = "fileSort";
|
||||
|
||||
@Log("查询目录")
|
||||
@GetMapping(value = "/fileSort")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILESORT_ALL','FILESORT_SELECT')")
|
||||
public ResponseEntity getFileSorts(FileSortQueryCriteria criteria){
|
||||
// 数据权限
|
||||
//criteria.setIds(dataScope.getDeptIds());
|
||||
List<FileSortDTO> fileSortDTOS = fileSortService.queryAll(criteria);
|
||||
return new ResponseEntity(fileSortService.buildTree(fileSortDTOS),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增部门")
|
||||
@PostMapping(value = "/fileSort")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILESORT_ALL','FILESORT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody FileSort resources){
|
||||
if (StringUtils.isNotEmpty(resources.getId())) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
return new ResponseEntity(fileSortService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改部门")
|
||||
@PutMapping(value = "/fileSort")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILESORT_ALL','FILESORT_EDIT')")
|
||||
public ResponseEntity update(@Validated(FileSort.Update.class) @RequestBody FileSort resources){
|
||||
fileSortService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除部门")
|
||||
@DeleteMapping(value = "/fileSort/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','FILESORT_ALL','FILESORT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable String id){
|
||||
fileSortService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import me.zhengjie.modules.system.service.dto.FileDTO;
|
||||
import me.zhengjie.modules.system.service.dto.FileQueryCriteria;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@CacheConfig(cacheNames = "file")
|
||||
public interface FileService {
|
||||
|
||||
/**
|
||||
* queryAll
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
Object queryAll(FileQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
FileDTO findById(String id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
FileDTO create(FileModel resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(FileModel resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* buildTree
|
||||
* @param fileDTOS
|
||||
* @return
|
||||
*/
|
||||
// @Cacheable(keyGenerator = "keyGenerator")
|
||||
// Object buildTree(List<FileDTO> fileDTOS);
|
||||
//
|
||||
// /**
|
||||
// * findByPid
|
||||
// * @param pid
|
||||
// * @return
|
||||
// */
|
||||
// @Cacheable(keyGenerator = "keyGenerator")
|
||||
// List<FileModel> findByPid(String pid);
|
||||
|
||||
// Set<Dept> findByRoleIds(Long id);
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortDTO;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortQueryCriteria;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@CacheConfig(cacheNames = "fileSort")
|
||||
public interface FileSortService {
|
||||
|
||||
/**
|
||||
* queryAll
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
List<FileSortDTO> queryAll(FileSortQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
FileSortDTO findById(String id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
FileSortDTO create(FileSort resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(FileSort resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* buildTree
|
||||
* @param fileSortDTOS
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
Object buildTree(List<FileSortDTO> fileSortDTOS);
|
||||
|
||||
/**
|
||||
* findByPid
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
List<FileSort> findByPid(String pid);
|
||||
|
||||
// Set<Dept> findByRoleIds(Long id);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Data
|
||||
public class FileDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
|
||||
private String fileType;
|
||||
|
||||
private String originName;
|
||||
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
private String uploader;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private FileSortDTO fileSort;
|
||||
|
||||
private String fileSortId;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class FileQueryCriteria {
|
||||
|
||||
@Query(propName = "id", type = Query.Type.IN, joinName = "fileSort")
|
||||
private Set<String> fileSortIds;
|
||||
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String fileName;
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String uploader;
|
||||
|
||||
private String fileSortId;
|
||||
//
|
||||
// @Query
|
||||
// private Boolean enabled;
|
||||
//
|
||||
// @Query
|
||||
// private String pid;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-6-10 16:32:18
|
||||
*/
|
||||
@Data
|
||||
public class FileSmallDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String fileName;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Data
|
||||
public class FileSortDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<FileSortDTO> children;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class FileSortQueryCriteria {
|
||||
|
||||
@Query(type = Query.Type.IN, propName="id")
|
||||
private Set<String> ids;
|
||||
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String name;
|
||||
|
||||
@Query
|
||||
private Boolean enabled;
|
||||
|
||||
@Query
|
||||
private String pid;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-6-10 16:32:18
|
||||
*/
|
||||
@Data
|
||||
public class FileSortSmallDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import me.zhengjie.modules.system.repository.FileRepository;
|
||||
import me.zhengjie.modules.system.service.FileService;
|
||||
import me.zhengjie.modules.system.service.dto.FileDTO;
|
||||
import me.zhengjie.modules.system.service.dto.FileQueryCriteria;
|
||||
import me.zhengjie.modules.system.service.mapper.FileMapper;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class FileServiceImpl implements FileService {
|
||||
|
||||
@Autowired
|
||||
private FileRepository fileRepository;
|
||||
|
||||
@Autowired
|
||||
private FileMapper fileMapper;
|
||||
|
||||
@Override
|
||||
public Object queryAll(FileQueryCriteria criteria, Pageable pageable) {
|
||||
Page<FileModel> page = fileRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(fileMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileDTO findById(String id) {
|
||||
Optional<FileModel> file = fileRepository.findById(id);
|
||||
ValidationUtil.isNull(file,"File","id",id);
|
||||
return fileMapper.toDto(file.get());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<FileModel> findByPid(String pid) {
|
||||
// return fileRepository.findByPid(pid);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public Set<Dept> findByRoleIds(Long id) {
|
||||
// return fileSortRepository.findByRoles_Id(id);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public Object buildTree(List<FileDTO> fileDTOS) {
|
||||
// Set<FileDTO> trees = new LinkedHashSet<>();
|
||||
// Set<FileSortDTO> fileSorts= new LinkedHashSet<>();
|
||||
// List<String> fileNames = fileDTOS.stream().map(FileDTO::getFileName).collect(Collectors.toList());
|
||||
// Boolean isChild;
|
||||
// for (FileSortDTO fileSortDTO : fileDTOS) {
|
||||
// isChild = false;
|
||||
// if ("0".equals(fileDTO.getPid().toString())) {
|
||||
// trees.add(fileDTO);
|
||||
// }
|
||||
// for (FileSortDTO it : fileDTOS) {
|
||||
// if (it.getPid().equals(fileSortDTO.getId())) {
|
||||
// isChild = true;
|
||||
// if (fileSortDTO.getChildren() == null) {
|
||||
// fileSortDTO.setChildren(new ArrayList<FileSortDTO>());
|
||||
// }
|
||||
// fileSortDTO.getChildren().add(it);
|
||||
// }
|
||||
// }
|
||||
// if(isChild)
|
||||
// fileSorts.add(fileSortDTO);
|
||||
// else if(!fileSortNames.contains(fileSortRepository.findNameById(fileSortDTO.getPid())))
|
||||
// fileSorts.add(fileSortDTO);
|
||||
// }
|
||||
//
|
||||
// if (CollectionUtils.isEmpty(trees)) {
|
||||
// trees = fileSorts;
|
||||
// }
|
||||
//
|
||||
// Integer totalElements = fileSortDTOS!=null?fileSortDTOS.size():0;
|
||||
//
|
||||
// Map map = new HashMap();
|
||||
// map.put("totalElements",totalElements);
|
||||
// map.put("content",CollectionUtils.isEmpty(trees)?fileSortDTOS:trees);
|
||||
// return map;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FileDTO create(FileModel resources) {
|
||||
return fileMapper.toDto(fileRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(FileModel resources) {
|
||||
|
||||
Optional<FileModel> optionalDept = fileRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalDept,"FileModel","id",resources.getId());
|
||||
FileModel file = optionalDept.get();
|
||||
//文件更新只更新所属目录
|
||||
file.setFileSort(resources.getFileSort());
|
||||
resources.setId(file.getId());
|
||||
fileRepository.save(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String id) {
|
||||
fileRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.repository.FileSortRepository;
|
||||
import me.zhengjie.modules.system.service.FileSortService;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortDTO;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortQueryCriteria;
|
||||
import me.zhengjie.modules.system.service.mapper.FileSortMapper;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class FileSortServiceImpl implements FileSortService {
|
||||
|
||||
@Autowired
|
||||
private FileSortRepository fileSortRepository;
|
||||
|
||||
@Autowired
|
||||
private FileSortMapper fileSortMapper;
|
||||
|
||||
@Override
|
||||
public List<FileSortDTO> queryAll(FileSortQueryCriteria criteria) {
|
||||
return fileSortMapper.toDto(fileSortRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileSortDTO findById(String id) {
|
||||
Optional<FileSort> fileSort = fileSortRepository.findById(id);
|
||||
ValidationUtil.isNull(fileSort,"FileSort","id",id);
|
||||
return fileSortMapper.toDto(fileSort.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileSort> findByPid(String pid) {
|
||||
return fileSortRepository.findByPid(pid);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Set<Dept> findByRoleIds(Long id) {
|
||||
// return fileSortRepository.findByRoles_Id(id);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Object buildTree(List<FileSortDTO> fileSortDTOS) {
|
||||
Set<FileSortDTO> trees = new LinkedHashSet<>();
|
||||
Set<FileSortDTO> fileSorts= new LinkedHashSet<>();
|
||||
List<String> fileSortNames = fileSortDTOS.stream().map(FileSortDTO::getName).collect(Collectors.toList());
|
||||
Boolean isChild;
|
||||
for (FileSortDTO fileSortDTO : fileSortDTOS) {
|
||||
isChild = false;
|
||||
if ("0".equals(fileSortDTO.getPid().toString())) {
|
||||
trees.add(fileSortDTO);
|
||||
}
|
||||
for (FileSortDTO it : fileSortDTOS) {
|
||||
if (it.getPid().equals(fileSortDTO.getId())) {
|
||||
isChild = true;
|
||||
if (fileSortDTO.getChildren() == null) {
|
||||
fileSortDTO.setChildren(new ArrayList<FileSortDTO>());
|
||||
}
|
||||
fileSortDTO.getChildren().add(it);
|
||||
}
|
||||
}
|
||||
if(isChild)
|
||||
fileSorts.add(fileSortDTO);
|
||||
else if(!fileSortNames.contains(fileSortRepository.findNameById(fileSortDTO.getPid())))
|
||||
fileSorts.add(fileSortDTO);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(trees)) {
|
||||
trees = fileSorts;
|
||||
}
|
||||
|
||||
Integer totalElements = fileSortDTOS!=null?fileSortDTOS.size():0;
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("totalElements",totalElements);
|
||||
map.put("content",CollectionUtils.isEmpty(trees)?fileSortDTOS:trees);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FileSortDTO create(FileSort resources) {
|
||||
return fileSortMapper.toDto(fileSortRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(FileSort resources) {
|
||||
if(resources.getId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
Optional<FileSort> optionalDept = fileSortRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalDept,"FileSort","id",resources.getId());
|
||||
FileSort fileSort = optionalDept.get();
|
||||
resources.setId(fileSort.getId());
|
||||
fileSortRepository.save(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String id) {
|
||||
fileSortRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import me.zhengjie.modules.system.service.dto.FileDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {FileSortMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface FileMapper extends EntityMapper<FileDTO, FileModel> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.FileModel;
|
||||
import me.zhengjie.modules.system.service.dto.FileSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface FileSmallMapper extends EntityMapper<FileSmallDTO, FileModel> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface FileSortMapper extends EntityMapper<FileSortDTO, FileSort> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.FileSort;
|
||||
import me.zhengjie.modules.system.service.dto.FileSortSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface FileSortSmallMapper extends EntityMapper<FileSortSmallDTO, FileSort> {
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@ spring:
|
|||
druid:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://192.168.2.108:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
|
@ -57,6 +57,8 @@ jwt:
|
|||
generator:
|
||||
enabled: true
|
||||
|
||||
filePath: F:\uploadfile\
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
|
|
@ -23,7 +23,7 @@ spring:
|
|||
redis:
|
||||
#数据库索引
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
host: 192.168.2.108
|
||||
port: 6379
|
||||
password:
|
||||
#连接超时时间
|
||||
|
|
Loading…
Reference in New Issue