管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-09 3fac36b394206df5f8002fa32bd360021fec743f
1
已修改2个文件
31 ■■■■■ 文件已修改
data/db_tab.sql 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/ReportController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_tab.sql
@@ -949,7 +949,7 @@
comment on table lf.sys_report is '报告模板表';
comment on column lf.sys_report.id is '主键ID';
comment on column lf.sys_report.name is '名称';
comment on column lf.sys_report.type is '类型';
comment on column lf.sys_report.type is '文件类型:1-Word模板,2-Excel模板';
comment on column lf.sys_report.path is '路径';
comment on column lf.sys_report.code is '编码';
comment on column lf.sys_report.create_user is '创建人id';
@@ -957,6 +957,7 @@
comment on column lf.sys_report.update_user is '更新人id';
comment on column lf.sys_report.update_time is '更新时间';
comment on column lf.sys_report.bak is '备注';
-- insert into lf.sys_report (name,type,path,code) values ('统计用户量',2,'1\aa.xlsx','');
select * from lf.sys_report;
----------------------------------------------------------------------------------------------------- 28.下载日志表
src/main/java/com/lf/server/controller/sys/ReportController.java
@@ -5,6 +5,7 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.sys.ReportEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.service.all.UploadAttachService;
import com.lf.server.service.sys.ReportService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -13,8 +14,10 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -30,6 +33,11 @@
    @Autowired
    TokenService tokenService;
    @Autowired
    UploadAttachService uploadAttachService;
    private final static String TAB_NAME = "lf.sys_report";
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
@@ -165,4 +173,24 @@
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "上传文件")
    @ResponseBody
    @PostMapping(value = "/upload")
    public ResponseMsg<String> upload(@RequestParam("file") MultipartFile file, HttpServletRequest req) {
        UserEntity ue = tokenService.getCurrentUser(req);
        return uploadAttachService.upload(ue, TAB_NAME, file, this);
    }
    @SysLog()
    @ApiOperation(value = "下载文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guid", value = "附件Guid", dataType = "String", paramType = "body")
    })
    @GetMapping(value = "/download")
    public void download(String guid, HttpServletResponse res) {
        uploadAttachService.download(guid, res);
    }
}