修改发布清单的分页查询接口,添加数据目录、数据类别参数
| | |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "dircode", value = "目录", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "type", 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 = "/selectByPageAndCount") |
| | | public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, String dircode, String type, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | type = getPubType(type); |
| | | |
| | | int count = publishService.selectCount(name); |
| | | int count = publishService.selectCount(name, dircode, type); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<PublishEntity> rs = publishService.selectByPage(name, dircode, type, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取发布类型 |
| | | */ |
| | | private String getPubType(String type) { |
| | | if (StringHelper.isEmpty(type)) { |
| | | return null; |
| | | } |
| | | |
| | | switch (type) { |
| | | case "DOM": |
| | | return "type = 'DOM'"; |
| | | case "DEM": |
| | | return "type = 'DEM'"; |
| | | case "MPT": |
| | | return "type = 'mpt'"; |
| | | case "3DML": |
| | | return "type = '3dml'"; |
| | | case "CPT": |
| | | return "type = 'cpt'"; |
| | | case "BIM": |
| | | return "type in ('ifc', 'fbx', 'rvt')"; |
| | | case "LAS": |
| | | return "type in ('las', 'laz')"; |
| | | case "OSGB": |
| | | return "type = 'osgb'"; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询") |
| | | @ApiImplicitParams({ |
| | |
| | | /** |
| | | * 查询记录数 |
| | | * |
| | | * @param name 名称 |
| | | * @param name 名称 |
| | | * @param dircode 目录编码 |
| | | * @param type 类别 |
| | | * @return 记录数 |
| | | */ |
| | | public Integer selectCount(String name); |
| | | public Integer selectCount(String name, String dircode, String type); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param name 名称 |
| | | * @param limit 记录数 |
| | | * @param offset 偏移量 |
| | | * @param name 名称 |
| | | * @param dircode 目录编码 |
| | | * @param type 类别 |
| | | * @param limit 记录数 |
| | | * @param offset 偏移量 |
| | | * @return 列表 |
| | | */ |
| | | public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset); |
| | | public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * 查询所有 |
| | |
| | | private final static Log log = LogFactory.getLog(PublishService.class); |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | public Integer selectCount(String name, String dircode, String type) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | |
| | | return publishMapper.selectCount(name); |
| | | return publishMapper.selectCount(name, dircode, type); |
| | | } |
| | | |
| | | @Override |
| | | public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | |
| | | return publishMapper.selectByPage(name, limit, offset); |
| | | return publishMapper.selectByPage(name, dircode, type, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_publish |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(name) like #{name} |
| | | and upper(name) like #{name} |
| | | </if> |
| | | <if test="dircode != null"> |
| | | and dirid like #{dircode} |
| | | </if> |
| | | <if test="type != null"> |
| | | and ${type} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName |
| | | from lf.sys_publish a |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(name) like #{name} |
| | | and upper(name) like #{name} |
| | | </if> |
| | | <if test="dircode != null"> |
| | | and dirid like #{dircode} |
| | | </if> |
| | | <if test="type != null"> |
| | | and ${type} |
| | | </if> |
| | | </where> |
| | | order by id desc |