实现Thymeleaf分页

This commit is contained in:
昕有灵犀
2018-07-13 16:15:51 +08:00
parent a0ad6ba06c
commit 72d3de9c71
30 changed files with 1045 additions and 47 deletions

Binary file not shown.

View File

@@ -38,7 +38,8 @@ http://xyfs.mydoc.io/
- 2.Dbcp2、Druid数据库连接池2种模式可选 - 2.Dbcp2、Druid数据库连接池2种模式可选
- 3.JPA/Hibernate - 3.JPA/Hibernate
- 4.Ehcache - 4.Ehcache
- 5.HTML、Layer、Bootstrap - 5.HTML、 Only Bootstrap。只使用了单纯的Bootstrap不再含任何前端UI框架纯净、自然、轻量。
- 6.Thymeleaf/Freemarker2种模板引擎可切换
- 6.Tomcat - 6.Tomcat
- 7.MySQL、Oracle、SQLite3种数据库模式可选 - 7.MySQL、Oracle、SQLite3种数据库模式可选
- 8.Gradle - 8.Gradle
@@ -55,7 +56,8 @@ http://xyfs.mydoc.io/
<br> <br>
2018-07-09 16:06:56,794 INFO (StartupInfoLogger.java:59)- Started FileSystemApplication in 14.575 seconds (JVM running for 15.457) 2018-07-09 16:06:56,794 INFO (StartupInfoLogger.java:59)- Started FileSystemApplication in 14.575 seconds (JVM running for 15.457)
<br> <br>
2018-07-09 16:07:18,809 INFO (DirectJDKLog.java:180)- Initializing Spring FrameworkServlet 'dispatcherServlet' 如要了解Gradle编译和运行更多事宜请访问Spring Boot官网文章Building Java Projects with Gradle
地址https://spring.io/guides/gs/gradle/
<br> <br>
这时就可以使用,访问: 这时就可以使用,访问:
<br> <br>

View File

@@ -1,8 +1,12 @@
# tomcat\u670d\u52a1\u7aef\u53e3 # # tomcat\u670d\u52a1\u7aef\u53e3 #
#server.port=${random.int[9000,9099]}
server.port=9091 server.port=9091
#\u542f\u7528shutdown #\u542f\u7528shutdown
endpoints.sensitive=false endpoints.sensitive=false
# \u91c7\u7528\u7684\u6a21\u677f\u5f15\u64ce\uff0c\u6709\u4e09\u79cd\u9009\u62e9\uff1afreemarker\u3001thymeleaf\u3001jsp \u3002 \u76ee\u524d\u672a\u5b9e\u73b0jsp
storage.template = thymeleaf
storage.debug = true
# \u5b58\u50a8\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u5982\u679c storage.source = xyfs \u9700\u8981\u914d\u7f6e # # \u5b58\u50a8\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u5982\u679c storage.source = xyfs \u9700\u8981\u914d\u7f6e #
storage.location = uploadfiledir storage.location = uploadfiledir
@@ -10,7 +14,7 @@ storage.location = uploadfiledir
storage.rename = true storage.rename = true
# \u5b58\u50a8\u6e90.\u53ef\u591a\u9009.\u53ef\u4ee5\u540c\u65f6\u50a8\u5b58\u591a\u4e2a\u6570\u636e\u6e90,\u4fbf\u4e8e\u5907\u4efd # # \u5b58\u50a8\u6e90.\u53ef\u591a\u9009.\u53ef\u4ee5\u540c\u65f6\u50a8\u5b58\u591a\u4e2a\u6570\u636e\u6e90,\u4fbf\u4e8e\u5907\u4efd #
# \u7c7b\u578b\u6709\uff1axyfs\\Seafile\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS # # \u7c7b\u578b\u6709\uff1axyfs\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS #
storage.todisk = true storage.todisk = true
storage.toqiniu = true storage.toqiniu = true
storage.tofastdfs = false storage.tofastdfs = false
@@ -19,8 +23,8 @@ storage.toseaweedfs = false
storage.toalioss = false storage.toalioss = false
storage.tocfs = false storage.tocfs = false
# \u7528\u4e8e\u8bbe\u7f6e\u4e0b\u8f7d\u7684\u6e90 ,\u5355\u9009 # # \u8bbe\u7f6e\u7528\u4e8e\u4e0b\u8f7d\u7684\u6e90 ,\u5355\u9009 #
# \u7c7b\u578b\u6709\uff1axyfs\\Seafile\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS # # \u7c7b\u578b\u6709\uff1axyfs\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS #
storage.downloadfrom = xyfs storage.downloadfrom = xyfs
# xyfs\u5b58\u50a8\u914d\u7f6e # # xyfs\u5b58\u50a8\u914d\u7f6e #
@@ -86,7 +90,7 @@ spring.datasource.type=org.apache.commons.dbcp2.BasicDataSource
spring.datasource.dbcp2.max-wait-millis=10000 spring.datasource.dbcp2.max-wait-millis=10000
spring.datasource.dbcp2.min-idle=5 spring.datasource.dbcp2.min-idle=5
spring.datasource.dbcp2.initial-size=5 spring.datasource.dbcp2.initial-size=5
spring.datasource.dbcp2.validation-query=SELECT 1 FROM app spring.datasource.dbcp2.validation-query=SELECT 1 FROM hibernate_sequence
spring.datasource.dbcp2.connection-properties=characterEncoding=utf8 spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# druid\u8fde\u63a5\u6c60\u7684\u914d\u7f6e\u4fe1\u606f # # druid\u8fde\u63a5\u6c60\u7684\u914d\u7f6e\u4fe1\u606f #
@@ -117,3 +121,23 @@ spring.servlet.multipart.max-request-size=1024MB
# oss \u65e5\u5fd7\u914d\u7f6e # # oss \u65e5\u5fd7\u914d\u7f6e #
logging.config=classpath:logback.xml logging.config=classpath:logback.xml
#==================================
# = Thymeleaf configurations
#==================================
spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
server.contextPath=/
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request

View File

@@ -31,9 +31,11 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter-data-rest") compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-devtools") compile("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-actuator") compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-freemarker")
compile 'mysql:mysql-connector-java' compile 'mysql:mysql-connector-java'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.0.3.RELEASE'
compile group: 'io.github.jpenren', name: 'thymeleaf-spring-data-dialect', version: '3.3.1'
compile group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect', version: '2.3.0'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.4.0' compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.4.0'
compile group: 'com.alibaba', name: 'druid', version: '1.1.10' compile group: 'com.alibaba', name: 'druid', version: '1.1.10'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1' compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.23.1'

View File

@@ -3,50 +3,95 @@ package xy.FileSystem.Controller;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.util.UriComponentsBuilder;
import xy.FileSystem.Entity.App; import xy.FileSystem.Entity.App;
import xy.FileSystem.Entity.AppRepository; import xy.FileSystem.Entity.AppRepository;
@Controller @Controller
@RequestMapping(path="/apps") @RequestMapping(path = "/apps")
public class AppController { public class AppController {
@Autowired @Autowired
private AppRepository appRepository; private AppRepository appRepository;
@GetMapping(path="/add") @GetMapping(path = "/add")
public @ResponseBody String addNewUser (@RequestParam String name public @ResponseBody String addNewUser(@RequestParam String name, @RequestParam String code,
, @RequestParam String code, @RequestParam String appkey) { @RequestParam String appkey) {
add(name, code, appkey); add(name, code, appkey);
return "ok"; return "ok";
} }
@PostMapping("/addApp")
public ResponseEntity<Void> addApp(@RequestBody App app, UriComponentsBuilder builder) {
App appSaved = appRepository.save(app);
if (appSaved == null) {
return new ResponseEntity<Void>(HttpStatus.CONFLICT);
}
HttpHeaders headers = new HttpHeaders();
headers.setLocation(builder.path("/apps/{id}").buildAndExpand(app.getId()).toUri());
return new ResponseEntity<Void>(headers, HttpStatus.CREATED);
}
public void add(String name, String code, String appkey) { public void add(String name, String code, String appkey) {
App model = new App(); App model = new App();
model.setName(name); model.setName(name);
model.setAvailable("1"); model.setAvailable("1");
model.setCode(code); model.setCode(code);
model.setAppkey(appkey); model.setAppkey(appkey);
appRepository.save(model); appRepository.save(model);
} }
@GetMapping(path="/findall")
public @ResponseBody Iterable<App> findall() {
return appRepository.findAll();
}
@GetMapping(path="/findbycode")
public @ResponseBody Iterable<App> getcode(@RequestParam String code) {
List<App> apps = appRepository.findbyCode(code); @GetMapping(path = "/findall")
return apps; public @ResponseBody Iterable<App> findall() {
return appRepository.findAll();
} }
@GetMapping(path = "/findbycode")
public @ResponseBody Iterable<App> getCode(@RequestParam String code) {
List<App> apps = appRepository.findbyCode(code);
return apps;
}
@GetMapping(path = "/findbycodeandname")
public @ResponseBody Iterable<App> getCodeAndName(@RequestParam String code, @RequestParam String name) {
List<App> apps = appRepository.findByCodeAndName(code, name);
return apps;
}
@GetMapping(path = "/deletebycode")
public ResponseEntity<Void> deleteByCode(@RequestParam String code) {
appRepository.deleteAppByCode(code);
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}
@GetMapping(path = "/deletebyid")
public ResponseEntity<Void> deleteById(@RequestParam int id) {
appRepository.deleteById(id);
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}
@GetMapping(path = "/updateapp")
public Integer updateApp(@RequestParam int id, @RequestParam String name) {
int result = appRepository.updateAppName(name, id);
return result;
}
} }

View File

@@ -0,0 +1,149 @@
package xy.FileSystem.Controller;
import java.util.Optional;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import xy.FileSystem.Entity.ClientModel;
import xy.FileSystem.Entity.ClientRepository;
import xy.FileSystem.Entity.PagerModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@Controller
public class ClientController {
private static final int BUTTONS_TO_SHOW = 3;
private static final int INITIAL_PAGE = 0;
private static final int INITIAL_PAGE_SIZE = 5;
private static final int[] PAGE_SIZES = { 5, 10};
@Autowired
ClientRepository clientrepository;
@GetMapping("/client")
public ModelAndView homepage(@RequestParam("pageSize") Optional<Integer> pageSize,
@RequestParam("page") Optional<Integer> page){
if(clientrepository.count()!=0){
;//pass
}else{
addtorepository();
}
ModelAndView modelAndView = new ModelAndView("client");
//
// Evaluate page size. If requested parameter is null, return initial
// page size
int evalPageSize = pageSize.orElse(INITIAL_PAGE_SIZE);
// Evaluate page. If requested parameter is null or less than 0 (to
// prevent exception), return initial size. Otherwise, return value of
// param. decreased by 1.
int evalPage = (page.orElse(0) < 1) ? INITIAL_PAGE : page.get() - 1;
// print repo
System.out.println("here is client repo " + clientrepository.findAll());
Page<ClientModel> clientlist = clientrepository.findAll(new PageRequest(evalPage, evalPageSize));
System.out.println("client list get total pages" + clientlist.getTotalPages() + "client list get number " + clientlist.getNumber());
PagerModel pager = new PagerModel(clientlist.getTotalPages(),clientlist.getNumber(),BUTTONS_TO_SHOW);
// add clientmodel
modelAndView.addObject("clientlist",clientlist);
// evaluate page size
modelAndView.addObject("selectedPageSize", evalPageSize);
// add page sizes
modelAndView.addObject("pageSizes", PAGE_SIZES);
// add pager
modelAndView.addObject("pager", pager);
return modelAndView;
}
public void addtorepository(){
//below we are adding clients to our repository for the sake of this example
ClientModel widget = new ClientModel();
widget.setAddress("123 Fake Street");
widget.setCurrentInvoice(10000);
widget.setName("Widget Inc");
clientrepository.save(widget);
//next client
ClientModel foo = new ClientModel();
foo.setAddress("456 Attorney Drive");
foo.setCurrentInvoice(20000);
foo.setName("Foo LLP");
clientrepository.save(foo);
//next client
ClientModel bar = new ClientModel();
bar.setAddress("111 Bar Street");
bar.setCurrentInvoice(30000);
bar.setName("Bar and Food");
clientrepository.save(bar);
//next client
ClientModel dog = new ClientModel();
dog.setAddress("222 Dog Drive");
dog.setCurrentInvoice(40000);
dog.setName("Dog Food and Accessories");
clientrepository.save(dog);
//next client
ClientModel cat = new ClientModel();
cat.setAddress("333 Cat Court");
cat.setCurrentInvoice(50000);
cat.setName("Cat Food");
clientrepository.save(cat);
//next client
ClientModel hat = new ClientModel();
hat.setAddress("444 Hat Drive");
hat.setCurrentInvoice(60000);
hat.setName("The Hat Shop");
clientrepository.save(hat);
//next client
ClientModel hatB = new ClientModel();
hatB.setAddress("445 Hat Drive");
hatB.setCurrentInvoice(60000);
hatB.setName("The Hat Shop B");
clientrepository.save(hatB);
//next client
ClientModel hatC = new ClientModel();
hatC.setAddress("446 Hat Drive");
hatC.setCurrentInvoice(60000);
hatC.setName("The Hat Shop C");
clientrepository.save(hatC);
//next client
ClientModel hatD = new ClientModel();
hatD.setAddress("446 Hat Drive");
hatD.setCurrentInvoice(60000);
hatD.setName("The Hat Shop D");
clientrepository.save(hatD);
//next client
ClientModel hatE = new ClientModel();
hatE.setAddress("447 Hat Drive");
hatE.setCurrentInvoice(60000);
hatE.setName("The Hat Shop E");
clientrepository.save(hatE);
//next client
ClientModel hatF = new ClientModel();
hatF.setAddress("448 Hat Drive");
hatF.setCurrentInvoice(60000);
hatF.setName("The Hat Shop F");
clientrepository.save(hatF);
}
}

View File

@@ -1,5 +1,81 @@
package xy.FileSystem.Controller; package xy.FileSystem.Controller;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import xy.FileSystem.Entity.Diskfile;
import xy.FileSystem.Entity.DiskfileRepository;
import xy.FileSystem.Entity.PagerModel;
import xy.FileSystem.Propert.StorageProperties;
import xy.FileSystem.Utils.DebugUtil;
@Controller
@RequestMapping(path = "/files")
public class FileController { public class FileController {
private static final int BUTTONS_TO_SHOW = 7;
private static final int INITIAL_PAGE = 0;
private static final int INITIAL_PAGE_SIZE = 10;
private static final int[] PAGE_SIZES = { 5,10,20,50};
@Autowired
private DiskfileRepository repository;
@Autowired
private StorageProperties prop;
@GetMapping("/all")
public ModelAndView getAll(@RequestParam("pageSize") Optional<Integer> pageSize,
@RequestParam("page") Optional<Integer> page){
ModelAndView modelAndView = new ModelAndView("file/"+prop.getTemplate()+"/allfile");
int evalPageSize = pageSize.orElse(INITIAL_PAGE_SIZE);
int evalPage = (page.orElse(0) < 1) ? INITIAL_PAGE : page.get() - 1;
DebugUtil.debug("evalPage:"+evalPage);
PageRequest pageRequest = PageRequest.of(evalPage, evalPageSize);
//PageRequest pageRequest = PageRequest.of(evalPage, evalPageSize, Sort.by(Sort.Direction.ASC,"fileid"))
Page<Diskfile> filelist = repository.findAll(pageRequest);
PagerModel pager = new PagerModel(filelist.getTotalPages(),filelist.getNumber(),BUTTONS_TO_SHOW);
modelAndView.addObject("filelist",filelist);
modelAndView.addObject("selectedPageSize", evalPageSize);
modelAndView.addObject("pageSizes", PAGE_SIZES);
modelAndView.addObject("pager", pager);
return modelAndView;
}
@GetMapping("/allfilebyauto")
public String list(ModelMap model, Pageable pageable){
model.addAttribute("page", repository.findAll(pageable));
return "file/"+prop.getTemplate()+"/allfilebyauto";
}
@RequestMapping(value = "/findallsort", method=RequestMethod.GET)
public Page<Diskfile> getEntryByPageable(@PageableDefault(value = 15, sort = { "fileid" }, direction = Sort.Direction.DESC)
Pageable pageable) {
return repository.findAll(pageable);
}
} }

View File

@@ -2,10 +2,27 @@ package xy.FileSystem.Entity;
import java.util.List; import java.util.List;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
public interface AppRepository extends CrudRepository<App, Integer> { public interface AppRepository extends CrudRepository<App, Integer> {
public List<App> findbyCode(String code); public List<App> findbyCode(String code);
public List<App> findByCodeAndName(String code,String name);
public List<App> deleteByCode(String code);
@Query(value = "delete from app where code=?1 ", nativeQuery = true)
@Modifying
@Transactional
public void deleteAppByCode(String code);
@Query(value = "update app set name=?1 where id=?2 ", nativeQuery = true)
@Modifying
@Transactional
public Integer updateAppName(String name,int id);
} }

View File

@@ -0,0 +1,43 @@
package xy.FileSystem.Entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class ClientModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getCurrentInvoice() {
return currentInvoice;
}
public void setCurrentInvoice(Integer currentInvoice) {
this.currentInvoice = currentInvoice;
}
private String name;
private String address;
private Integer currentInvoice;
}

View File

@@ -0,0 +1,9 @@
package xy.FileSystem.Entity;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ClientRepository extends PagingAndSortingRepository<ClientModel,Long> {
}

View File

@@ -1,7 +1,8 @@
package xy.FileSystem.Entity; package xy.FileSystem.Entity;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface DailyreportRepository extends CrudRepository<Dailyreport, Long> { public interface DailyreportRepository extends PagingAndSortingRepository<Dailyreport, Long> {
} }

View File

@@ -1,7 +1,12 @@
package xy.FileSystem.Entity; package xy.FileSystem.Entity;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface DiskfileRepository extends CrudRepository<Diskfile, String> { public interface DiskfileRepository extends JpaRepository<Diskfile, String> {
Page<Diskfile> findByAppid(int appid, Pageable pageable);
} }

View File

@@ -1,7 +1,8 @@
package xy.FileSystem.Entity; package xy.FileSystem.Entity;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface DiskuserRepository extends CrudRepository<Diskuser, String> { public interface DiskuserRepository extends PagingAndSortingRepository<Diskuser, String> {
} }

View File

@@ -1,7 +1,8 @@
package xy.FileSystem.Entity; package xy.FileSystem.Entity;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface HistoryRepository extends CrudRepository<History, Long> { public interface HistoryRepository extends PagingAndSortingRepository<History, Long> {
} }

View File

@@ -0,0 +1,73 @@
package xy.FileSystem.Entity;
public class PagerModel {
private int buttonsToShow = 5;
private int startPage;
private int endPage;
public PagerModel(int totalPages, int currentPage, int buttonsToShow) {
setButtonsToShow(buttonsToShow);
int halfPagesToShow = getButtonsToShow() / 2;
if (totalPages <= getButtonsToShow()) {
setStartPage(1);
setEndPage(totalPages);
} else if (currentPage - halfPagesToShow <= 0) {
setStartPage(1);
setEndPage(getButtonsToShow());
} else if (currentPage + halfPagesToShow == totalPages) {
setStartPage(currentPage - halfPagesToShow);
setEndPage(totalPages);
} else if (currentPage + halfPagesToShow > totalPages) {
setStartPage(totalPages - getButtonsToShow() + 1);
setEndPage(totalPages);
} else {
setStartPage(currentPage - halfPagesToShow);
setEndPage(currentPage + halfPagesToShow);
}
}
public int getButtonsToShow() {
return buttonsToShow;
}
public void setButtonsToShow(int buttonsToShow) {
if (buttonsToShow % 2 != 0) {
this.buttonsToShow = buttonsToShow;
} else {
throw new IllegalArgumentException("Must be an odd value!");
}
}
public int getStartPage() {
return startPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
@Override
public String toString() {
return "Pager [startPage=" + startPage + ", endPage=" + endPage + "]";
}
}

View File

@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.thymeleaf.dialect.springdata.SpringDataDialect;
import xy.FileSystem.Cache.UsesCache; import xy.FileSystem.Cache.UsesCache;
import xy.FileSystem.File.StoreSource; import xy.FileSystem.File.StoreSource;
@@ -25,14 +26,19 @@ public class FileSystemApplication {
@Autowired @Autowired
private StorageProperties prop; private StorageProperties prop;
@Autowired @Autowired
QiniuService qiniuService; QiniuService qiniuService;
@Autowired @Autowired
AliService aliService; AliService aliService;
@Autowired @Autowired
FastdfsServcice fastdfsServcice; FastdfsServcice fastdfsServcice;
@Autowired @Autowired
MongoService mongoService; MongoService mongoService;
@Autowired @Autowired
SeaweedfsService seaweedfsService; SeaweedfsService seaweedfsService;
@@ -51,6 +57,11 @@ public class FileSystemApplication {
registerStoreSource(); registerStoreSource();
}; };
} }
@Bean
public SpringDataDialect springDataDialect() {
return new SpringDataDialect();
}
public void registerStoreSource() { public void registerStoreSource() {
if (prop.isToqiniu()){ if (prop.isToqiniu()){

View File

@@ -6,11 +6,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class StorageProperties { public class StorageProperties {
private String location = "uploadfiles"; private String location = "uploadfiles";
private boolean rename = true;
private boolean rename = true;
private String downloadfrom = ""; private String downloadfrom = "";
private String template = "thymeleaf";
private boolean debug = true;
private boolean todisk = true; private boolean todisk = true;
private boolean toqiniu = true; private boolean toqiniu = true;
private boolean tofastdfs = false; private boolean tofastdfs = false;
@@ -248,4 +248,20 @@ public class StorageProperties {
public void setDownloadfrom(String downloadfrom) { public void setDownloadfrom(String downloadfrom) {
this.downloadfrom = downloadfrom; this.downloadfrom = downloadfrom;
} }
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
}
} }

View File

@@ -60,13 +60,13 @@ public class AliService implements FileListener{
OSS ossClient = init(); OSS ossClient = init();
try { try {
UploadFileRequest uploadFileRequest = new UploadFileRequest(prop.getAlibucketname(), prop.getAlidownloadkey()); UploadFileRequest uploadFileRequest = new UploadFileRequest(prop.getAlibucketname(), prop.getAlidownloadkey());
// The local file to upload---it must exist. //local file
uploadFileRequest.setUploadFile(filePath); uploadFileRequest.setUploadFile(filePath);
// Sets the concurrent upload task number to 5. //5线程
uploadFileRequest.setTaskNum(5); uploadFileRequest.setTaskNum(5);
// Sets the part size to 1MB. // 切分 1MB.
uploadFileRequest.setPartSize(1024 * 1024 * 1); uploadFileRequest.setPartSize(1024 * 1024 * 1);
// Enables the checkpoint file. By default it's off. // 检查点
uploadFileRequest.setEnableCheckpoint(true); uploadFileRequest.setEnableCheckpoint(true);
UploadFileResult uploadResult = ossClient.uploadFile(uploadFileRequest); UploadFileResult uploadResult = ossClient.uploadFile(uploadFileRequest);
@@ -100,7 +100,7 @@ public class AliService implements FileListener{
OSS ossClient = init(); OSS ossClient = init();
try { try {
// 下载请求,10个任务并发下载启动断点续传。 // 下载请求,启动断点续传。
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(prop.getAlibucketname(), fileKey); DownloadFileRequest downloadFileRequest = new DownloadFileRequest(prop.getAlibucketname(), fileKey);
downloadFileRequest.setDownloadFile(localFile); downloadFileRequest.setDownloadFile(localFile);
downloadFileRequest.setPartSize(1 * 1024 * 1024); downloadFileRequest.setPartSize(1 * 1024 * 1024);

View File

@@ -17,13 +17,13 @@ public class FastdfsServcice implements FileListener {
@Override @Override
public UploadResult Store(UploadFileExt ufe) { public UploadResult Store(UploadFileExt ufe) {
///上传回调 //TODO 上传回调
return null; return null;
} }
@Override @Override
public void Download(String fileKeyorName) { public void Download(String fileKeyorName) {
// TODO Auto-generated method stub // TODO 下载
} }

View File

@@ -0,0 +1,20 @@
package xy.FileSystem.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import xy.FileSystem.Propert.StorageProperties;
public class DebugUtil {
@Autowired
StorageProperties prop;
public DebugUtil() {
// TODO Auto-generated constructor stub
}
public static void debug(String str){
System.out.println(str);
}
}

View File

@@ -1,8 +1,12 @@
# tomcat\u670d\u52a1\u7aef\u53e3 # # tomcat\u670d\u52a1\u7aef\u53e3 #
#server.port=${random.int[9000,9099]}
server.port=9091 server.port=9091
#\u542f\u7528shutdown #\u542f\u7528shutdown
endpoints.sensitive=false endpoints.sensitive=false
# \u91c7\u7528\u7684\u6a21\u677f\u5f15\u64ce\uff0c\u6709\u4e09\u79cd\u9009\u62e9\uff1afreemarker\u3001thymeleaf\u3001jsp \u3002 \u76ee\u524d\u672a\u5b9e\u73b0jsp
storage.template = thymeleaf
storage.debug = true
# \u5b58\u50a8\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u5982\u679c storage.source = xyfs \u9700\u8981\u914d\u7f6e # # \u5b58\u50a8\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u5982\u679c storage.source = xyfs \u9700\u8981\u914d\u7f6e #
storage.location = uploadfiledir storage.location = uploadfiledir
@@ -10,7 +14,7 @@ storage.location = uploadfiledir
storage.rename = true storage.rename = true
# \u5b58\u50a8\u6e90.\u53ef\u591a\u9009.\u53ef\u4ee5\u540c\u65f6\u50a8\u5b58\u591a\u4e2a\u6570\u636e\u6e90,\u4fbf\u4e8e\u5907\u4efd # # \u5b58\u50a8\u6e90.\u53ef\u591a\u9009.\u53ef\u4ee5\u540c\u65f6\u50a8\u5b58\u591a\u4e2a\u6570\u636e\u6e90,\u4fbf\u4e8e\u5907\u4efd #
# \u7c7b\u578b\u6709\uff1axyfs\\Seafile\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS # # \u7c7b\u578b\u6709\uff1axyfs\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS #
storage.todisk = true storage.todisk = true
storage.toqiniu = true storage.toqiniu = true
storage.tofastdfs = false storage.tofastdfs = false
@@ -19,8 +23,8 @@ storage.toseaweedfs = false
storage.toalioss = false storage.toalioss = false
storage.tocfs = false storage.tocfs = false
# \u7528\u4e8e\u8bbe\u7f6e\u4e0b\u8f7d\u7684\u6e90 ,\u5355\u9009 # # \u8bbe\u7f6e\u7528\u4e8e\u4e0b\u8f7d\u7684\u6e90 ,\u5355\u9009 #
# \u7c7b\u578b\u6709\uff1axyfs\\Seafile\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS # # \u7c7b\u578b\u6709\uff1axyfs\\FastDFS\\SeaweedFS\\MongoDB\\aliOSS\\qiniu\\CFS #
storage.downloadfrom = xyfs storage.downloadfrom = xyfs
# xyfs\u5b58\u50a8\u914d\u7f6e # # xyfs\u5b58\u50a8\u914d\u7f6e #
@@ -86,7 +90,7 @@ spring.datasource.type=org.apache.commons.dbcp2.BasicDataSource
spring.datasource.dbcp2.max-wait-millis=10000 spring.datasource.dbcp2.max-wait-millis=10000
spring.datasource.dbcp2.min-idle=5 spring.datasource.dbcp2.min-idle=5
spring.datasource.dbcp2.initial-size=5 spring.datasource.dbcp2.initial-size=5
spring.datasource.dbcp2.validation-query=SELECT 1 FROM app spring.datasource.dbcp2.validation-query=SELECT 1 FROM hibernate_sequence
spring.datasource.dbcp2.connection-properties=characterEncoding=utf8 spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# druid\u8fde\u63a5\u6c60\u7684\u914d\u7f6e\u4fe1\u606f # # druid\u8fde\u63a5\u6c60\u7684\u914d\u7f6e\u4fe1\u606f #
@@ -117,3 +121,23 @@ spring.servlet.multipart.max-request-size=1024MB
# oss \u65e5\u5fd7\u914d\u7f6e # # oss \u65e5\u5fd7\u914d\u7f6e #
logging.config=classpath:logback.xml logging.config=classpath:logback.xml
#==================================
# = Thymeleaf configurations
#==================================
spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
server.contextPath=/
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,136 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<!-- CSS INCLUDE -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"></link>
<!-- EOF CSS INCLUDE -->
<style>
.pagination-centered {
text-align: center;
}
.disabled {
pointer-events: none;
opacity: 0.5;
}
.pointer-disabled {
pointer-events: none;
}
</style>
</head>
<body>
<!-- START PAGE CONTAINER -->
<div class="container-fluid">
<!-- START PAGE SIDEBAR -->
<!-- commented out <div th:replace="fragments/header :: header">&nbsp;</div> -->
<!-- END PAGE SIDEBAR -->
<!-- PAGE TITLE -->
<div class="page-title">
<h2>
<span class="fa fa-arrow-circle-o-left"></span> Client Viewer
</h2>
</div>
<!-- END PAGE TITLE -->
<div class="row">
<table class="table datatable">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Load</th>
</tr>
</thead>
<tbody>
<tr th:each="clientlist : ${clientlist}">
<td th:text="${clientlist.name}">Text ...</td>
<td th:text="${clientlist.address}">Text ...</td>
<td><button type="button"
class="btn btn-primary btn-condensed">
<i class="glyphicon glyphicon-folder-open"></i>
</button></td>
</tr>
</tbody>
</table>
<div class="row">
<div class="form-group col-md-1">
<select class="form-control pagination" id="pageSizeSelect">
<option th:each="pageSize : ${pageSizes}" th:text="${pageSize}"
th:value="${pageSize}"
th:selected="${pageSize} == ${selectedPageSize}"></option>
</select>
</div>
<div th:if="${clientlist.totalPages != 1}"
class="form-group col-md-11 pagination-centered">
<ul class="pagination">
<li th:class="${clientlist.number == 0} ? disabled"><a
class="pageLink"
th:href="@{/client/(pageSize=${selectedPageSize}, page=1)}">&laquo;</a>
</li>
<li th:class="${clientlist.number == 0} ? disabled"><a
class="pageLink"
th:href="@{/client/(pageSize=${selectedPageSize}, page=${clientlist.number})}">&larr;</a>
</li>
<li
th:class="${clientlist.number == (page - 1)} ? 'active pointer-disabled'"
th:each="page : ${#numbers.sequence(pager.startPage, pager.endPage)}">
<a class="pageLink"
th:href="@{/client/(pageSize=${selectedPageSize}, page=${page})}"
th:text="${page}"></a>
</li>
<li
th:class="${clientlist.number + 1 == clientlist.totalPages} ? disabled">
<a class="pageLink"
th:href="@{/client/(pageSize=${selectedPageSize}, page=${clientlist.number + 2})}">&rarr;</a>
</li>
<li
th:class="${clientlist.number + 1 == clientlist.totalPages} ? disabled">
<a class="pageLink"
th:href="@{/client/(pageSize=${selectedPageSize}, page=${clientlist.totalPages})}">&raquo;</a>
</li>
</ul>
</div>
</div>
</div>
<!-- END PAGE CONTENT -->
<!-- END PAGE CONTAINER -->
</div>
<script
src="https://code.jquery.com/jquery-1.11.1.min.js"
integrity="sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE="
crossorigin="anonymous"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script th:inline="javascript">
/*<![CDATA[*/
$(document).ready(function() {
changePageAndSize();
});
function changePageAndSize() {
$('#pageSizeSelect').change(function(evt) {
window.location.replace("/client/?pageSize=" + this.value + "&page=1");
});
}
/*]]>*/
</script>
</body>
</html>

View File

@@ -0,0 +1,94 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<!-- CSS INCLUDE -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"></link>
<!-- EOF CSS INCLUDE -->
<style>
.pagination-centered {
text-align: center;
}
.disabled {
pointer-events: none;
opacity: 0.5;
}
.pointer-disabled {
pointer-events: none;
}
</style>
</head>
<body>
<!-- START PAGE CONTAINER -->
<div class="container-fluid">
<!-- START PAGE SIDEBAR -->
<!-- commented out <div th:replace="fragments/header :: header">&nbsp;</div> -->
<div class="page-header">
<h1>公共页面....</h1>
</div>
<!-- END PAGE SIDEBAR -->
<!-- PAGE TITLE -->
<div class="page-title">
<h2>
<span class="fa fa-arrow-circle-o-left"></span> 文件清单
</h2>
</div>
<!-- END PAGE TITLE -->
<div class="row">
<table class="table datatable">
<thead>
<tr>
<th>#</th>
<th>id</th>
<th>FileName</th>
<th>AppId</th>
</tr>
</thead>
<tbody>
<#list filelist as item>
<tr>
<td >Text ...</td>
<td >${item.fileid}</td>
<td >${item.fileName}</td>
<td><button type="button"
class="btn btn-primary btn-condensed">
<i class="glyphicon glyphicon-folder-open"></i>
</button>
</td>
</tr>
</#list>
</tbody>
</table>
<!-- PAGE Nav -->
<!-- PAGE NAV END-->
</div>
<!-- END PAGE CONTENT -->
<footer class="footer">
<div class="container">
<p class="text-muted">©2016-2019 昕有灵犀</p>
</div>
</footer>
<!-- END PAGE CONTAINER -->
</div>
<script
src="https://code.jquery.com/jquery-1.11.1.min.js"
integrity="sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE="
crossorigin="anonymous"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
</body>
</html>

View File

@@ -0,0 +1,142 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<!-- CSS INCLUDE -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"></link>
<!-- EOF CSS INCLUDE -->
<style>
.pagination-centered {
text-align: center;
}
.disabled {
pointer-events: none;
opacity: 0.5;
}
.pointer-disabled {
pointer-events: none;
}
</style>
</head>
<body>
<!-- START PAGE CONTAINER -->
<div class="container-fluid">
<!-- START PAGE SIDEBAR -->
<!-- commented out <div th:replace="fragments/header :: header">&nbsp;</div> -->
<div class="page-header">
<h1>公共页面....</h1>
</div>
<!-- END PAGE SIDEBAR -->
<!-- PAGE TITLE -->
<div class="page-title">
<h2>
<span class="fa fa-arrow-circle-o-left"></span> 文件清单
</h2>
</div>
<!-- END PAGE TITLE -->
<div class="row">
<table class="table datatable table-striped table-hover">
<thead>
<tr>
<th>#</th>
<th>id</th>
<th>FileName</th>
<th>AppId</th>
</tr>
</thead>
<tbody>
<tr th:each="filelist : ${filelist}">
<td th:text="${numberOfElements}">Text ...</td>
<td th:text="${filelist.fileid}">Text ...</td>
<td th:text="${filelist.fileName}">Text ...</td>
<td><button type="button"
class="btn btn-primary btn-condensed">
<i class="glyphicon glyphicon-folder-open"></i>
</button></td>
</tr>
</tbody>
</table>
<!-- PAGE Nav -->
<div class="row">
<div class="form-group col-md-2">
每页记录:<select class="form-control pagination" id="pageSizeSelect">
<option th:each="pageSize : ${pageSizes}" th:text="${pageSize}"
th:value="${pageSize}"
th:selected="${pageSize} == ${selectedPageSize}"></option>
</select>
</div>
<div th:if="${filelist.totalPages != 1}"
class="form-group col-md-10 pagination-centered">
<ul class="pagination">
<li th:class="${filelist.number == 0} ? disabled"><a
class="pageLink"
th:href="@{/files/all/(pageSize=${selectedPageSize}, page=1)}">&laquo;</a>
</li>
<li th:class="${filelist.number == 0} ? disabled"><a
class="pageLink"
th:href="@{/files/all/(pageSize=${selectedPageSize}, page=${filelist.number})}">&larr;</a>
</li>
<li
th:class="${filelist.number == (page - 1)} ? 'active pointer-disabled'"
th:each="page : ${#numbers.sequence(pager.startPage, pager.endPage)}">
<a class="pageLink"
th:href="@{/files/all/(pageSize=${selectedPageSize}, page=${page})}"
th:text="${page}"></a>
</li>
<li
th:class="${filelist.number + 1 == filelist.totalPages} ? disabled">
<a class="pageLink"
th:href="@{/files/all/(pageSize=${selectedPageSize}, page=${filelist.number + 2})}">&rarr;</a>
</li>
<li
th:class="${filelist.number + 1 == filelist.totalPages} ? disabled">
<a class="pageLink"
th:href="@{/files/all/(pageSize=${selectedPageSize}, page=${filelist.totalPages})}">&raquo;</a>
</li>
</ul>
</div>
</div>
<!-- PAGE NAV END-->
</div>
<!-- END PAGE CONTENT -->
<footer class="footer">
<div class="container">
<p class="text-muted">©2016-2019 昕有灵犀</p>
</div>
</footer>
<!-- END PAGE CONTAINER -->
</div>
<script
src="https://code.jquery.com/jquery-1.11.1.min.js"
integrity="sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE="
crossorigin="anonymous"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script th:inline="javascript">
/*<![CDATA[*/
$(document).ready(function() {
changePageAndSize();
});
function changePageAndSize() {
$('#pageSizeSelect').change(function(evt) {
window.location.replace("/files/all?pageSize=" + this.value + "&page=1");
});
}
/*]]>*/
</script>
</body>
</html>

View File

@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sd="http://io.github.jpenren/sd">
<head>
<title>xyFS私有文件云存储OSS服务</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
</head>
<body>
<div class="container">
<!-- START PAGE SIDEBAR -->
<div class="page-header">
<h1>公共页面....</h1>
</div>
<!-- END PAGE SIDEBAR -->
<!-- PAGE TITLE -->
<div class="page-title">
<h2>
<span class="fa fa-arrow-circle-o-left"></span> 文件清单
</h2>
</div>
<!-- PAGE TITLE END-->
<table class="table table-striped table-hover">
<thead>
<tr>
<th><a class="sorted" sd:pagination-sort="username" >Username</a></th>
<th><a class="sorted" sd:pagination-sort="firstName" >First name</a></th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr th:each="row : ${page}">
<th scope="row" th:text="${row.fileid}">Username</th>
<td th:text="${row.fileName}">Name</td>
<td ><button type="button"
class="btn btn-primary btn-condensed">
<i class="glyphicon glyphicon-folder-open"></i>
</button></td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
每页<span sd:page-size-selector="javascript"></span>记录
<!-- <div sd:pagination-summary="">info</div> -->
</div>
<div class="col-sm-6">
<nav class="pull-right">
<ul class="pagination" sd:pagination="full">
<li class="disabled"><a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
<li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
</ul>
</nav>
</div>
</div>
</div>
<!-- PAGE FOOT -->
<footer class="footer">
<div class="container">
<p class="text-muted">©2016-2019 昕有灵犀</p>
</div>
</footer>
<!-- PAGE FOOT END -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
package xy.FileSystem;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import junit.framework.Assert;
import xy.FileSystem.Propert.StorageProperties;
@RunWith(SpringJUnit4ClassRunner.class)
@ConfigurationProperties("storage")
public class PropertiesTest {
@Autowired
private StorageProperties storageProperties;
@Test
public void getHello() throws Exception {
Assert.assertEquals(storageProperties.isRename(), true);
Assert.assertEquals(storageProperties.getQiniuprefix(), "http://pbby0yzdu.bkt.clouddn.com/");
}
}