| | |
| | | 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.ctrl.TabEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.DomainEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @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"), |
| | | @ApiImplicitParam(name = "srid", value = "空间引用标识符", dataType = "Integer", paramType = "query", example = "4326") |
| | | @ApiImplicitParam(name = "wkt", value = "WKT(著名文本)", dataType = "String", paramType = "query", example = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Long> selectCount(String name, String filter, String wkt, Integer srid) { |
| | | @GetMapping(value = "/selectCount") |
| | | @PostMapping(value = "/selectCount") |
| | | public ResponseMsg<Long> selectCount(String name, String filter, String wkt) { |
| | | try { |
| | | BasicMapper baseMapper = baseQueryService.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | |
| | | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt, srid); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); |
| | | |
| | | long count = baseMapper.selectCount(wrapper); |
| | | |
| | |
| | | @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 = "srid", value = "空间引用标识符", dataType = "Integer", paramType = "query", example = "4326"), |
| | | //@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") |
| | | public ResponseMsg<List<Object>> selectByPage(String name, String filter, String wkt, Integer srid, Integer pageIndex, Integer pageSize) { |
| | | @PostMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<Object>> selectByPage(String name, String filter, String wkt, Integer pageIndex, Integer pageSize) { |
| | | try { |
| | | BasicMapper baseMapper = baseQueryService.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | |
| | | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt, srid); |
| | | baseQueryService.addGeomWrapper(baseMapper, wrapper, wkt); |
| | | |
| | | Page<Object> page = new Page<>(pageIndex, pageSize); |
| | | page.addOrder(OrderItem.asc("gid")); |
| | |
| | | if (StringHelper.isEmpty(field) || StringHelper.isSqlInjection(field)) { |
| | | return fail("查询字段不正确", null); |
| | | } |
| | | if (!StringHelper.isEmpty(value)) { |
| | | value = value.trim().replace("'", ""); |
| | | } |
| | | |
| | | value = value == null ? StringHelper.getLikeStr("") : StringHelper.getLikeStr(value.replace("'", "")); |
| | | value = StringHelper.getLikeStr2(value); |
| | | List<String> rs = baseMapper.selectFieldFuzzy(tab, field, value); |
| | | |
| | | return success(rs); |
| | |
| | | @GetMapping(value = "/selectUserFuzzy") |
| | | public ResponseMsg<List<IdNameEntity>> selectUserFuzzy(String name) { |
| | | try { |
| | | List<IdNameEntity> rs = null; |
| | | List<IdNameEntity> rs = baseQueryService.selectUserFuzzy(name); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | |
| | | @GetMapping(value = "/selectDepFuzzy") |
| | | public ResponseMsg<List<IdNameEntity>> selectDepFuzzy(String name) { |
| | | try { |
| | | List<IdNameEntity> rs = null; |
| | | 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 = "查询字段信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlg25wAanp") |
| | | }) |
| | | @GetMapping(value = "/selectFields") |
| | | public ResponseMsg<List<DictEntity>> selectFields(String name) { |
| | | try { |
| | | BasicMapper baseMapper = baseQueryService.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 = "name", value = "映射名称", dataType = "String", paramType = "query", example = "dlg25wAanp") |
| | | }) |
| | | @GetMapping(value = "/selectDomains") |
| | | public ResponseMsg<List<DomainEntity>> selectDomains(String name) { |
| | | try { |
| | | BasicMapper baseMapper = baseQueryService.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); |
| | | } |
| | | } |
| | | } |