管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-23 e782fd07af69d056d0b0258e9dd9dc23e2cc98fe
src/main/java/com/lf/server/controller/data/DataLoaderController.java
@@ -13,6 +13,7 @@
import com.lf.server.helper.WebHelper;
import com.lf.server.service.all.BaseQueryService;
import com.lf.server.service.data.DataLoaderService;
import com.lf.server.service.data.MetaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -35,14 +36,47 @@
@RequestMapping("/dataLoader")
public class DataLoaderController extends BaseUploadController {
    @Autowired
    MetaService metaService;
    @Autowired
    BaseQueryService baseQueryService;
    @Autowired
    DataLoaderService dataLoaderService;
    private final static String FILE_TYPES = "'xls','shp','gdb','mdb'";
    public static List<String> extList = new ArrayList<>(Arrays.asList(".xls", ".xlsx", ".mdb", ".zip"));
    @SysLog()
    @ApiOperation(value = "分页查询上传数据并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageForUpload")
    public ResponseMsg<Object> selectByPageForUpload(Integer pageSize, Integer pageIndex, HttpServletRequest req) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            int count = metaService.selectCountForUpload(ue.getId(), FILE_TYPES);
            if (count == 0) {
                return success(0, null);
            }
            List<MetaEntity> list = metaService.selectByPageForUpload(ue.getId(), FILE_TYPES, pageSize, pageSize * (pageIndex - 1));
            return success(count, list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query")