| | |
| | | package com.lf.server.controller.all; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | 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.aspect.SysLog; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.IdNameEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | | 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 io.swagger.annotations.ApiImplicitParam; |
| | |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgAgnp"), |
| | | @ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "wkt", value = "WKT(著名文本)", dataType = "String", paramType = "query", example = ""), |
| | | @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"), |
| | | @ApiImplicitParam(name = "srid", value = "空间引用标识符", dataType = "Integer", paramType = "query", example = "4326") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Long> selectCount(String name, String filter, String wkt, Integer srid) { |
| | | try { |
| | | BaseMapper baseMapper = baseQueryService.getBaseMapper(name); |
| | | BasicMapper baseMapper = baseQueryService.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | | return fail("查询对象不存在", null); |
| | | } |
| | | |
| | | QueryWrapper<Object> wrapper = new QueryWrapper<>(); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt, srid); |
| | | |
| | |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlgAgnp"), |
| | | @ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = "1=1 and 2>=1"), |
| | | @ApiImplicitParam(name = "filter", value = "过滤条件", dataType = "String", paramType = "query", example = ""), |
| | | @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"), |
| | |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<Object>> selectByPage(String name, String filter, String wkt, Integer srid, Integer pageIndex, Integer pageSize) { |
| | | try { |
| | | BaseMapper baseMapper = baseQueryService.getBaseMapper(name); |
| | | BasicMapper baseMapper = baseQueryService.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | | return fail("查询对象不存在", null); |
| | | } |
| | | |
| | | QueryWrapper<Object> wrapper = new QueryWrapper<>(); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt, srid); |
| | | |
| | |
| | | return fail("查询对象不存在", null); |
| | | } |
| | | |
| | | String wkt = baseMapper.selectWktById(gid); |
| | | 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 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 = baseQueryService.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<DictEntity>> selectTabs() { |
| | | try { |
| | | List<DictEntity> list = baseQueryService.selectTabs(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |