| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.HttpStatus; |
| | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.Md5Helper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询上传数据并返回记录数") |
| | | @ApiOperation(value = "查询表中数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "Integer", paramType = "query", example = "115"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10") |
| | | }) |
| | | @GetMapping(value = "/selectByPageForUpload") |
| | | public ResponseMsg<Object> selectByPageForUpload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) { |
| | | @GetMapping(value = "/selectDbData") |
| | | public ResponseMsg<Object> selectDbData(Integer id, Integer pageIndex, Integer pageSize) { |
| | | // noinspection AlibabaRemoveCommentedCode |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | if (null == id || id < 0) { |
| | | return fail("元数据ID不能为空或小于0", null); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | |
| | | int count = metaService.selectCountForUpload(name, ue.getId(), StaticData.FILE_TYPES); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | return fail("找不到元数据信息", null); |
| | | } |
| | | |
| | | List<MetaEntity> list = metaService.selectByPageForUpload(name, ue.getId(), StaticData.FILE_TYPES, pageSize, pageSize * (pageIndex - 1)); |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (null == baseMapper) { |
| | | return null; |
| | | } |
| | | |
| | | return success(count, list); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | //wrapper.eq("dirid", meta.getDirid()); |
| | | //wrapper.eq("depid", meta.getDepid()); |
| | | //wrapper.eq("verid", meta.getVerid()); |
| | | wrapper.eq("createuser", meta.getCreateUser()); |
| | | wrapper.eq("createtime", meta.getCreateTime()); |
| | | |
| | | Page<Object> page = new Page<>(pageIndex, pageSize); |
| | | page.addOrder(OrderItem.asc("gid")); |
| | | IPage<Object> paged = baseMapper.selectPage(page, wrapper); |
| | | |
| | | return success(paged.getTotal(), paged.getRecords()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |