package com.lf.server.controller.all;
|
|
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.entity.all.ResponseMsg;
|
import com.lf.server.entity.ctrl.DownloadReqEntity;
|
import com.lf.server.entity.ctrl.IdNameEntity;
|
import com.lf.server.entity.ctrl.KeyValueEntity;
|
import com.lf.server.entity.ctrl.TabEntity;
|
import com.lf.server.entity.data.*;
|
import com.lf.server.entity.sys.AttachEntity;
|
import com.lf.server.entity.sys.UserEntity;
|
import com.lf.server.helper.AesHelper;
|
import com.lf.server.helper.ClassHelper;
|
import com.lf.server.helper.StringHelper;
|
import com.lf.server.mapper.all.BasicMapper;
|
import com.lf.server.mapper.all.GeomBaseMapper;
|
import com.lf.server.service.all.BaseQueryService;
|
import com.lf.server.service.data.DirService;
|
import com.lf.server.service.data.DownloadService;
|
import com.lf.server.service.data.MetaService;
|
import com.lf.server.service.show.DataLibService;
|
import com.lf.server.service.sys.AttachService;
|
import com.lf.server.service.sys.DepService;
|
import com.lf.server.service.sys.TokenService;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* 父查询控制器
|
* @author WWW
|
*/
|
public class BaseQueryController extends BaseController {
|
@Autowired
|
AttachService attachService;
|
|
@Autowired
|
TokenService tokenService;
|
|
@Autowired
|
DepService depService;
|
|
@Autowired
|
DirService dirService;
|
|
@Autowired
|
MetaService metaService;
|
|
@Autowired
|
DataLibService dataLibService;
|
|
@Autowired
|
DownloadService downloadService;
|
|
@Autowired
|
BaseQueryService baseQueryService;
|
|
@SysLog()
|
@ApiOperation(value = "查询记录数")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgagnp"),
|
@ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = "gid >= 50 and name like '县' and objectid < 5000.0"),
|
@ApiImplicitParam(name = "wkt", value = "WKT(著名文本)", dataType = "String", paramType = "query", example = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA")
|
})
|
@GetMapping(value = "/selectCount")
|
@PostMapping(value = "/selectCount")
|
public ResponseMsg<Long> selectCount(String name, String filter, String wkt) {
|
try {
|
BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
QueryWrapper wrapper = new QueryWrapper();
|
baseQueryService.addFilterWrapper(wrapper, filter);
|
baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt);
|
|
long count = baseMapper.selectCount(wrapper);
|
|
return success(count);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "分页查询")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgagnp"),
|
@ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"),
|
@ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"),
|
@ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = "gid >= 50 and name like '县' and objectid < 5000.0"),
|
@ApiImplicitParam(name = "wkt", value = "WKT(著名文本)", dataType = "String", paramType = "query", example = ""),
|
//@ApiImplicitParam(name = "srid", value = "空间引用标识符", dataType = "Integer", paramType = "query", example = "4326"),
|
@ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"),
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10")
|
})
|
@GetMapping(value = "/selectByPage")
|
@PostMapping(value = "/selectByPage")
|
public ResponseMsg<List<Object>> selectByPage(String name, String depcode, String dirs, String filter, String wkt, Integer pageIndex, Integer pageSize) {
|
try {
|
BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
QueryWrapper wrapper = new QueryWrapper();
|
baseQueryService.addFilterWrapper(wrapper, filter);
|
baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt);
|
if (!StringHelper.isEmpty(depcode)) {
|
wrapper.likeRight("depid", depcode);
|
}
|
|
dirs = DataLibService.copeCodes(dirs, "dirid");
|
if (!StringHelper.isEmpty(dirs)) {
|
wrapper.apply(dirs);
|
}
|
|
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);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "根据父ID分页查询并返回记录数")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "metaid", value = "父ID", dataType = "String", paramType = "query", example = "0"),
|
@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")
|
})
|
@GetMapping(value = "/selectPageAndCountByPid")
|
public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) {
|
try {
|
if (pageSize < 1 || pageIndex < 1) {
|
return fail("每页页数或分页数小于1", null);
|
}
|
if (null == metaid || metaid < 1) {
|
return fail("父ID不能为空且大于1", null);
|
}
|
|
int count = metaService.selectCountByPid(metaid, name);
|
if (count == 0) {
|
return success(0, null);
|
}
|
|
List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1));
|
|
return success(count, rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "根据ID查询WKT")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgagnp"),
|
@ApiImplicitParam(name = "gid", value = "GID", dataType = "Integer", paramType = "query", example = "1")
|
})
|
@GetMapping(value = "/selectWktById")
|
public ResponseMsg<String> selectWktById(String name, Integer gid) {
|
try {
|
GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
String tab = BaseQueryService.getTabName(baseMapper);
|
if (StringHelper.isNull(tab)) {
|
return fail("查询对象不存在", null);
|
}
|
|
String wkt = baseMapper.selectWktById(tab, gid);
|
if (!StringHelper.isEmpty(wkt)) {
|
wkt = AesHelper.encrypt(wkt);
|
}
|
|
return success(wkt);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "模糊搜索字段")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgagnp"),
|
@ApiImplicitParam(name = "field", value = "字段", dataType = "String", paramType = "query", example = "name"),
|
@ApiImplicitParam(name = "value", value = "值", dataType = "String", paramType = "query", example = "'县'")
|
})
|
@GetMapping(value = "/selectFieldFuzzy")
|
public ResponseMsg<List<String>> selectFieldFuzzy(String name, String field, String value) {
|
try {
|
BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
String tab = BaseQueryService.getTabName(baseMapper);
|
if (StringHelper.isNull(tab)) {
|
return fail("查询对象不存在", null);
|
}
|
if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) {
|
return fail("查询字段不正确", null);
|
}
|
if (!StringHelper.isEmpty(value)) {
|
value = value.trim().replace("'", "");
|
}
|
|
value = StringHelper.getLikeStr2(value);
|
List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value);
|
|
return success(rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "模糊搜索用户")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "用户名", dataType = "String", paramType = "query", example = "室")
|
})
|
@GetMapping(value = "/selectUserFuzzy")
|
public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) {
|
try {
|
List<IdNameEntity> rs = baseQueryService.selectUserFuzzy(name);
|
|
return success(rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "模糊搜索单位")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "单位名", dataType = "String", paramType = "query", example = "司")
|
})
|
@GetMapping(value = "/selectDepFuzzy")
|
public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) {
|
try {
|
List<IdNameEntity> rs = baseQueryService.selectDepFuzzy(name);
|
|
return success(rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询所有表")
|
@GetMapping(value = "/selectTabs")
|
public ResponseMsg<List<TabEntity>> selectTabs() {
|
try {
|
List<TabEntity> list = baseQueryService.selectTabs();
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "根据表名分页查询表")
|
@GetMapping(value = "/selectTabsByPage")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"),
|
@ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"),
|
@ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_"),
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
|
@ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
|
})
|
public ResponseMsg<List<TabEntity>> selectTabsByPage(String depcode, String dirs, String tab, Integer pageSize, Integer pageIndex) {
|
try {
|
if (pageSize < 1 || pageIndex < 1) {
|
return fail("每页页数或分页数小于1", null);
|
}
|
if (StringHelper.isSqlInjection(depcode)) {
|
return fail("单位代码含有非法字符", null);
|
}
|
|
String filters = "1=1";
|
if (!StringHelper.isEmpty(depcode)) {
|
filters += String.format(" and depid like '%s%%'", depcode);
|
}
|
dirs = DataLibService.copeCodes(dirs, "dirid");
|
if (dirs != null) {
|
filters += String.format(" and (%s)", dirs);
|
}
|
|
int count = baseQueryService.selectTabsForCount(tab);
|
if (count == 0) {
|
return success(0, null);
|
}
|
|
List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, filters, pageSize, pageSize * (pageIndex - 1));
|
|
return success(count, rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询字段信息")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlg25wAanp")
|
})
|
@GetMapping(value = "/selectFields")
|
public ResponseMsg<List<DictEntity>> selectFields(String name) {
|
try {
|
BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
String tabName = BaseQueryService.getTabName(baseMapper);
|
if (tabName == null) {
|
return null;
|
}
|
|
String[] strs = tabName.split("\\.");
|
List<DictEntity> list = baseQueryService.selectFields(strs[0], strs[1]);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询字段信息")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "ns", value = "名称空间", dataType = "String", paramType = "query", example = "bd"),
|
@ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg25wAanp")
|
})
|
@GetMapping(value = "/selectTabFields")
|
public ResponseMsg<List<DictEntity>> selectTabFields(String ns, String tab) {
|
try {
|
if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(tab)) {
|
return fail("名称空间和表名不能为空", null);
|
}
|
|
List<DictEntity> list = baseQueryService.selectFields(ns, tab);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询值域信息")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlg25wAanp")
|
})
|
@GetMapping(value = "/selectDomains")
|
public ResponseMsg<List<DomainEntity>> selectDomains(String name) {
|
try {
|
BasicMapper baseMapper = ClassHelper.getBasicMapper(name);
|
if (baseMapper == null) {
|
return fail("查询对象不存在", null);
|
}
|
|
String tabName = BaseQueryService.getTabName(baseMapper);
|
if (tabName == null) {
|
return null;
|
}
|
|
String[] strs = tabName.split("\\.");
|
List<DomainEntity> list = baseQueryService.selectDomains(strs[0], strs[1]);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询文件")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "tabName", value = "表名", dataType = "String", paramType = "query", example = "lf.sys_style"),
|
@ApiImplicitParam(name = "eventid", value = "主键", dataType = "String", paramType = "query", example = "fa25979a5ef8b43ba82a0be35b3fb0d4")
|
})
|
@GetMapping(value = "/selectFiles")
|
public ResponseMsg<List<AttachEntity>> selectFiles(String tabName, String eventid) {
|
try {
|
if (StringHelper.isEmpty(tabName) || StringHelper.isEmpty(eventid)) {
|
return fail("参数不能为空", null);
|
}
|
|
List<AttachEntity> list = attachService.selectByTab(tabName, eventid);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "删除文件")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
|
})
|
@GetMapping(value = "/deletes")
|
public ResponseMsg<Integer> deleteFiles(@RequestParam List<Integer> ids) {
|
try {
|
if (ids == null || ids.isEmpty()) {
|
return fail("id数组不能为空", -1);
|
}
|
|
int rows = attachService.deletes(ids);
|
|
return success(rows);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), 0);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询DB中溢出的单位ID")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body")
|
})
|
@ResponseBody
|
@PostMapping(value = "/selectDbOverflowDep")
|
public ResponseMsg<Object> selectDbOverflowDep(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) {
|
try {
|
if (null == reqEntity || null == reqEntity.getEntities() || reqEntity.getEntities().isEmpty()) {
|
return fail("请选择要下载的实体名");
|
}
|
reqEntity.setWkt(AesHelper.decrypt(reqEntity.getWkt()));
|
if (StringHelper.isEmpty(reqEntity.getWkt())) {
|
return fail("请选择要下载的WKT范围");
|
}
|
|
UserEntity ue = tokenService.getCurrentUser(req);
|
List<String> list = dataLibService.selectDbOverflowDep(ue, reqEntity.getEntities(), reqEntity.getWkt());
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "根据单位编码数组查询单位")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "codes", value = "单位编码数组", dataType = "String", paramType = "query", allowMultiple = true, example = "00,0001")
|
})
|
@GetMapping(value = "/selectDepsByCodes")
|
public ResponseMsg<Object> selectDepsByCodes(String[] codes) {
|
try {
|
if (null == codes || codes.length == 0) {
|
return fail("单位ID集合为空");
|
}
|
|
List<IdNameEntity> list = depService.selectDepsByCodes(codes);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "请求DB数据下载")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "dre", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body")
|
})
|
@ResponseBody
|
@PostMapping(value = "/downloadDbReq")
|
public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
|
try {
|
if (null == dre || StringHelper.isEmpty(dre.getPwd())) {
|
return fail("密码不能为空");
|
}
|
if (null == dre.getEntities() || dre.getEntities().isEmpty()) {
|
return fail("请选择要下载的实体名");
|
}
|
dre.setWkt(AesHelper.decrypt(dre.getWkt()));
|
if (StringHelper.isEmpty(dre.getWkt())) {
|
return fail("请选择要下载的WKT范围");
|
}
|
if (!DownloadService.decryptPwd(dre)) {
|
return fail("密码解密失败", null);
|
}
|
if (StringHelper.isPwdInvalid(dre.getPwd())) {
|
return fail("密码不符合要求");
|
}
|
|
UserEntity ue = tokenService.getCurrentUser(req);
|
String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0);
|
String guid = dataLibService.createZipFile(ue, dre.getEntities(), depcode, dre.getDirs(), dre.getWkt(), dre.getPwd());
|
|
return success(guid);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "请求实体数据下载")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "dre", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body")
|
})
|
@ResponseBody
|
@PostMapping(value = "/downloadEntityReq")
|
public ResponseMsg<Object> downloadEntityReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
|
try {
|
if (null == dre || StringHelper.isEmpty(dre.getPwd())) {
|
return fail("密码不能为空");
|
}
|
if (null == dre.getEntities() || dre.getEntities().isEmpty()) {
|
return fail("请选择要下载的实体名");
|
}
|
if (!DownloadService.decryptPwd(dre)) {
|
return fail("密码解密失败", null);
|
}
|
if (StringHelper.isPwdInvalid(dre.getPwd())) {
|
return fail("密码不符合要求");
|
}
|
|
UserEntity ue = tokenService.getCurrentUser(req);
|
String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0);
|
String guid = dataLibService.zipDbData(ue, dre.getEntities().get(0), depcode, dre.getDirs(), dre.getFilter(), dre.getPwd());
|
|
return success(guid);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@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")
|
})
|
@GetMapping(value = "/selectPageCountForDownload")
|
public ResponseMsg<List<DownloadEntity>> selectPageCountForDownload(String name, Integer pageSize, Integer pageIndex, HttpServletRequest req) {
|
try {
|
if (pageSize < 1 || pageIndex < 1) {
|
return fail("每页页数或分页数小于1", null);
|
}
|
|
UserEntity ue = tokenService.getCurrentUser(req);
|
if (ue == null) {
|
return fail("用户未登录", null);
|
}
|
|
int count = downloadService.selectCountForUser(ue.getId(), 4, name);
|
if (count == 0) {
|
return success(0, null);
|
}
|
List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), 4, name, pageSize, pageSize * (pageIndex - 1));
|
|
return success(count, rs);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询目录类别")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "D")
|
})
|
@GetMapping(value = "/selectDirTypes")
|
public ResponseMsg<Object> selectDirTypes(String name) {
|
try {
|
List<KeyValueEntity> list = baseQueryService.selectDirTypes(name);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "查询项目名称")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "西")
|
})
|
@GetMapping(value = "/selectProject")
|
public ResponseMsg<Object> selectProject(String name) {
|
try {
|
List<DirEntity> list = dirService.selectProject(name);
|
|
return success(list);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
|
@SysLog()
|
@ApiOperation(value = "根据源数据ID查询")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1")
|
})
|
@GetMapping(value = "/selectMetaById")
|
public ResponseMsg<MetaEntity> selectMetaById(int id) {
|
try {
|
MetaEntity entity = metaService.selectById(id);
|
|
return success(entity);
|
} catch (Exception ex) {
|
return fail(ex.getMessage(), null);
|
}
|
}
|
}
|