13693261870
昨天 542a030a93de7dbc39e185d4ce355c5894e3cd5b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.terra.system.controller.data;
 
import com.terra.common.annotation.SysLog;
import com.terra.system.controller.all.BaseQueryController;
import com.terra.common.entity.all.ResponseMsg;
import com.terra.system.entity.sys.UserEntity;
import com.terra.common.helper.StringHelper;
import com.terra.system.service.data.DataQueryService;
import com.terra.system.service.sys.TokenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import javax.annotation.Resource;
 
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.multipart.MultipartFile;
 
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
 
/**
 * 数据检索
 * @author WWW
 */
@Tag(name = "数据管理\\数据查询")
@RestController
@RequestMapping("/dataQuery")
public class DataQueryController extends BaseQueryController {
    @Resource
    TokenService tokenService;
 
    @Resource
    DataQueryService dataQueryService;
 
    @SysLog()
    @Operation(summary = "上传文件")
    @ResponseBody
    @Parameters({
            @Parameter(name = "tabName", description = "表名", in = ParameterIn.QUERY, example = "lf.sys_style"),
            @Parameter(name = "eventid", description = "主键", in = ParameterIn.QUERY, example = "fa25979a5ef8b43ba82a0be35b3fb0d4")
    })
    @PostMapping(value = "/uploadFiles")
    public ResponseMsg<Integer> uploadFiles(String tabName, String eventid, @RequestParam("file") MultipartFile[] files, HttpServletRequest req) {
        try {
            if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) {
                return fail("参数不能为空", null);
            }
            if (null == files || files.length == 0) {
                return fail("文件上传为空", 0);
            }
 
            UserEntity ue = tokenService.getCurrentUser(req);
            Integer count = dataQueryService.uploadFiles(ue, tabName, eventid, files, req);
 
            return success(count);
        } catch (Exception ex) {
            return fail(ex, 0);
        }
    }
}