package com.terra.system.controller.data; import com.terra.system.annotation.SysLog; import com.terra.system.controller.all.BaseQueryController; import com.terra.system.entity.all.ResponseMsg; import com.terra.system.entity.sys.UserEntity; import com.terra.system.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 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); } } }