热点资源
This commit is contained in:
@@ -3,11 +3,11 @@ package com.quinn.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.quinn.common.QuinnConstant;
|
||||
import com.quinn.pojo.*;
|
||||
import com.quinn.service.SourceCategoryService;
|
||||
import com.quinn.service.SourceCommentService;
|
||||
import com.quinn.service.SourceService;
|
||||
import com.quinn.utils.UUIDGenerator;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -41,8 +41,7 @@ public class SourceController {
|
||||
|
||||
// 列表展示
|
||||
@GetMapping("/source")
|
||||
public String blogList(@RequestParam String name,@RequestParam int category,Model model){
|
||||
System.out.println(name + category);
|
||||
public String sourceList(@RequestParam String name,@RequestParam int category,Model model){
|
||||
Page<Source> pageParam = new Page<>(1, 10);
|
||||
QueryWrapper<Source> sourceQuery = new QueryWrapper<>();
|
||||
sourceQuery.orderByDesc("gmt_create");
|
||||
@@ -59,6 +58,20 @@ public class SourceController {
|
||||
return "source/list";
|
||||
}
|
||||
|
||||
// 列表展示
|
||||
@GetMapping("/hot/source")
|
||||
public String sourceHotPot(Model model){
|
||||
Page<Source> pageParam = new Page<>(1, 10);
|
||||
QueryWrapper<Source> sourceQuery = new QueryWrapper<>();
|
||||
sourceQuery.orderByDesc("down_record");
|
||||
sourceService.page(pageParam,sourceQuery);
|
||||
// 结果
|
||||
List<Source> sourceList = pageParam.getRecords();
|
||||
model.addAttribute("sourceList",sourceList);
|
||||
return "source/list";
|
||||
}
|
||||
|
||||
|
||||
// 查看文件详情
|
||||
@GetMapping("/source/view/{sid}")
|
||||
public String read(@PathVariable("sid") String sid, Model model){
|
||||
@@ -73,11 +86,11 @@ public class SourceController {
|
||||
// 下载文件
|
||||
@GetMapping("/source/download/{sid}")
|
||||
public void read(HttpServletResponse response, @PathVariable("sid") String sid) throws IOException {
|
||||
Source source = sourceService.getOne(new QueryWrapper<Source>().eq("id", sid));
|
||||
//通知浏览器以附件形式下载
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;filename=" + UUIDGenerator.randomUUID());
|
||||
this.sourceService.downloadSource(response.getOutputStream(),sid);
|
||||
"attachment;filename=" + source.getEnName() + QuinnConstant.LINK_SUFFIX + source.getFileType());
|
||||
this.sourceService.downloadSource(response.getOutputStream(),source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user