更新POI
This commit is contained in:
@ -43,6 +43,16 @@ public class PbfInfoController {
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有地图文件")
|
||||
@GetMapping("/list")
|
||||
public ApiResponse list() {
|
||||
LambdaQueryWrapper<PbfInfo> queryWrapper = new QueryWrapper<PbfInfo>().lambda();
|
||||
// 把启用的排在最前面
|
||||
queryWrapper.orderByDesc(PbfInfo::getIsEnable);
|
||||
queryWrapper.orderByAsc(PbfInfo::getCreatedAt);
|
||||
return ApiResponse.success(pbfInfoService.list(queryWrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "启用地图文件")
|
||||
@PostMapping("/enable")
|
||||
public ApiResponse enable(@Parameter(description = "地图文件ID") @RequestParam(required = true) String id) {
|
||||
@ -74,13 +84,5 @@ public class PbfInfoController {
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有地图文件")
|
||||
@GetMapping("/list")
|
||||
public ApiResponse list() {
|
||||
LambdaQueryWrapper<PbfInfo> queryWrapper = new QueryWrapper<PbfInfo>().lambda();
|
||||
// 把启用的排在最前面
|
||||
queryWrapper.orderByDesc(PbfInfo::getIsEnable);
|
||||
queryWrapper.orderByAsc(PbfInfo::getCreatedAt);
|
||||
return ApiResponse.success(pbfInfoService.list(queryWrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.yj.earth.business.controller;
|
||||
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.vo.PoiVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -36,7 +37,6 @@ public class PoiController {
|
||||
@Operation(summary = "查看数据")
|
||||
public ApiResponse data(@Parameter(description = "分页页码") Integer pageNum, @Parameter(description = "分页大小") Integer pageSize, @Parameter(description = "名称搜索") String name) {
|
||||
int offset = (pageNum - 1) * pageSize;
|
||||
// 构建查询SQL
|
||||
StringBuilder dataSql = new StringBuilder("SELECT id, name, address, lng, lat FROM tbl_pois WHERE 1=1");
|
||||
List<Object> params = new ArrayList<>();
|
||||
// 添加名称搜索条件
|
||||
@ -48,7 +48,7 @@ public class PoiController {
|
||||
dataSql.append(" LIMIT ? OFFSET ?");
|
||||
try {
|
||||
// 执行数据查询、获取List
|
||||
List<Poi> poiList = new ArrayList<>();
|
||||
List<PoiVo> poiList = new ArrayList<>();
|
||||
long dataStartTime = System.currentTimeMillis();
|
||||
try (PreparedStatement dataPs = connection.prepareStatement(dataSql.toString())) {
|
||||
// 设置参数(搜索条件 + 分页参数)
|
||||
@ -61,7 +61,7 @@ public class PoiController {
|
||||
// 处理结果集、填充List
|
||||
try (ResultSet dataRs = dataPs.executeQuery()) {
|
||||
while (dataRs.next()) {
|
||||
Poi poi = new Poi();
|
||||
PoiVo poi = new PoiVo();
|
||||
poi.setId(dataRs.getLong("id"));
|
||||
poi.setName(dataRs.getString("name"));
|
||||
poi.setAddress(dataRs.getString("address"));
|
||||
@ -76,13 +76,4 @@ public class PoiController {
|
||||
return ApiResponse.failure("POI数据查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class Poi {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String address;
|
||||
private String lng;
|
||||
private String lat;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,137 @@
|
||||
package com.yj.earth.business.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yj.earth.business.domain.PoiInfo;
|
||||
import com.yj.earth.business.service.PoiInfoService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.common.util.SQLiteUtil;
|
||||
import com.yj.earth.vo.PoiVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "POI文件管理")
|
||||
@RequestMapping("/poiInfo")
|
||||
public class PoiInfoController {
|
||||
@Resource
|
||||
private PoiInfoService poiInfoService;
|
||||
|
||||
@Operation(summary = "添加POI文件")
|
||||
@PostMapping("/add")
|
||||
public ApiResponse add(@Parameter(description = "POI文件路径") @RequestParam(required = true) String path) {
|
||||
PoiInfo poiInfo = new PoiInfo();
|
||||
poiInfo.setPath(path);
|
||||
poiInfo.setName(FileUtil.mainName(path));
|
||||
poiInfo.setIsEnable(0);
|
||||
poiInfoService.save(poiInfo);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除POI文件")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponse delete(@Parameter(description = "POI文件ID") @RequestParam(required = true) String id) {
|
||||
poiInfoService.removeById(id);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有POI文件")
|
||||
@GetMapping("/list")
|
||||
public ApiResponse list() {
|
||||
LambdaQueryWrapper<PoiInfo> queryWrapper = new QueryWrapper<PoiInfo>().lambda();
|
||||
// 把启用的排在最前面
|
||||
queryWrapper.orderByDesc(PoiInfo::getIsEnable);
|
||||
queryWrapper.orderByAsc(PoiInfo::getCreatedAt);
|
||||
return ApiResponse.success(poiInfoService.list(queryWrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "启用POI文件")
|
||||
@PostMapping("/enable")
|
||||
public ApiResponse enable(@Parameter(description = "地图文件ID") @RequestParam(required = true) String id) {
|
||||
PoiInfo poiInfo = poiInfoService.getById(id);
|
||||
poiInfo.setIsEnable(1);
|
||||
poiInfoService.updateById(poiInfo);
|
||||
// 除这条数据以外的全部为禁用
|
||||
List<PoiInfo> list = poiInfoService.list();
|
||||
for (PoiInfo info : list) {
|
||||
if (!info.getId().equals(id)) {
|
||||
info.setIsEnable(0);
|
||||
poiInfoService.updateById(info);
|
||||
}
|
||||
}
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "禁用POI文件")
|
||||
@PostMapping("/disable")
|
||||
public ApiResponse disable(@Parameter(description = "地图文件ID") @RequestParam(required = true) String id) {
|
||||
PoiInfo poiInfo = new PoiInfo();
|
||||
poiInfo.setId(id);
|
||||
poiInfo.setIsEnable(0);
|
||||
poiInfoService.updateById(poiInfo);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@Operation(summary = "POI搜索")
|
||||
@GetMapping("/search")
|
||||
public ApiResponse search(
|
||||
@Parameter(description = "分页页码") Integer pageNum,
|
||||
@Parameter(description = "分页大小") Integer pageSize,
|
||||
@Parameter(description = "名称搜索") String name) {
|
||||
int offset = (pageNum - 1) * pageSize;
|
||||
// 查询启用的POI文件
|
||||
PoiInfo poiInfo = poiInfoService.getOne(new QueryWrapper<PoiInfo>().lambda().eq(PoiInfo::getIsEnable, 1));
|
||||
if (poiInfo == null) {
|
||||
return ApiResponse.failure("未找到启用的POI数据文件");
|
||||
}
|
||||
String path = poiInfo.getPath();
|
||||
// 构建查询SQL
|
||||
StringBuilder dataSql = new StringBuilder("SELECT id, name, address, lng, lat FROM tbl_pois WHERE 1=1");
|
||||
List<Object> params = new ArrayList<>();
|
||||
// 名称搜索条件
|
||||
if (name != null && !name.trim().isEmpty()) {
|
||||
dataSql.append(" AND name LIKE ?");
|
||||
params.add("%" + name.trim() + "%");
|
||||
}
|
||||
// 分页条件
|
||||
dataSql.append(" LIMIT ? OFFSET ?");
|
||||
// 执行查询
|
||||
try (Connection connection = SQLiteUtil.getConnection(path);
|
||||
PreparedStatement dataPs = connection.prepareStatement(dataSql.toString())) {
|
||||
// 设置参数
|
||||
int paramIndex = 1;
|
||||
for (Object param : params) {
|
||||
dataPs.setObject(paramIndex++, param);
|
||||
}
|
||||
dataPs.setInt(paramIndex++, pageSize);
|
||||
dataPs.setInt(paramIndex++, offset);
|
||||
// 处理结果集
|
||||
List<PoiVo> poiList = new ArrayList<>();
|
||||
try (ResultSet dataRs = dataPs.executeQuery()) {
|
||||
while (dataRs.next()) {
|
||||
PoiVo poi = new PoiVo();
|
||||
poi.setId(dataRs.getLong("id"));
|
||||
poi.setName(dataRs.getString("name"));
|
||||
poi.setAddress(dataRs.getString("address"));
|
||||
poi.setLng(dataRs.getString("lng"));
|
||||
poi.setLat(dataRs.getString("lat"));
|
||||
poiList.add(poi);
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse.success(poiList);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.failure("POI数据查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,6 +26,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -132,11 +134,21 @@ public class SourceController {
|
||||
public ApiResponse list(@Parameter(description = "资源类型") String sourceType,
|
||||
@Parameter(description = "资源名称") String name,
|
||||
@Parameter(description = "分页数量") Integer pageNum,
|
||||
@Parameter(description = "分页大小") Integer pageSize) {
|
||||
@Parameter(description = "分页大小") Integer pageSize,
|
||||
@Parameter(description = "开始时间") String startTime,
|
||||
@Parameter(description = "结束时间") String endTime) {
|
||||
// 获取当前登录用户的ID
|
||||
String userId = StpUtil.getLoginIdAsString();
|
||||
List<Source> sourceList = sourceService.getSourceListByUserId(userId, sourceType, name, pageNum, pageSize);
|
||||
return ApiResponse.success(sourceList);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
LocalDateTime startTimeDate = null;
|
||||
LocalDateTime endTimeDate = null;
|
||||
if (startTime != null && endTime != null) {
|
||||
// 把字符串的 时间字符串 转换成 LocalDateTime
|
||||
startTimeDate = LocalDateTime.parse(startTime, formatter);
|
||||
endTimeDate = LocalDateTime.parse(endTime, formatter);
|
||||
}
|
||||
return ApiResponse.success(sourceService.getSourceListByUserId(userId, sourceType, name, pageNum, pageSize, startTimeDate, endTimeDate));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取资源类型列表")
|
||||
|
||||
@ -84,11 +84,7 @@ public class UserController {
|
||||
@Operation(summary = "用户列表")
|
||||
@GetMapping("/list")
|
||||
@RoleAccess(roleNames = "管理员")
|
||||
public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum,
|
||||
@Parameter(description = "分页大小") Integer pageSize,
|
||||
@Parameter(description = "搜索字段") String searchKey,
|
||||
@Parameter(description = "角色ID") String roleId,
|
||||
@Parameter(description = "用户状态") Integer status) {
|
||||
public ApiResponse list(@Parameter(description = "分页数量") Integer pageNum, @Parameter(description = "分页大小") Integer pageSize, @Parameter(description = "搜索字段") String searchKey, @Parameter(description = "角色ID") String roleId, @Parameter(description = "用户状态") Integer status) {
|
||||
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
|
||||
// 根据用户名或者昵称进行模糊搜索
|
||||
if (StringUtils.isNotBlank(searchKey)) {
|
||||
|
||||
29
src/main/java/com/yj/earth/business/domain/PoiInfo.java
Normal file
29
src/main/java/com/yj/earth/business/domain/PoiInfo.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.yj.earth.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PoiInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "文件路径")
|
||||
private String path;
|
||||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
@Schema(description = "是否启用")
|
||||
private Integer isEnable;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yj.earth.business.mapper;
|
||||
|
||||
import com.yj.earth.business.domain.PoiInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface PoiInfoMapper extends BaseMapper<PoiInfo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yj.earth.business.service;
|
||||
|
||||
import com.yj.earth.business.domain.PoiInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
public interface PoiInfoService extends IService<PoiInfo> {
|
||||
|
||||
}
|
||||
@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yj.earth.common.util.ApiResponse;
|
||||
import com.yj.earth.dto.source.AddModelSourceDto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SourceService extends IService<Source> {
|
||||
String addAndGetSourceId(String sourcePath);
|
||||
@ -21,7 +23,7 @@ public interface SourceService extends IService<Source> {
|
||||
|
||||
String fetchPakDetail(String sourceId);
|
||||
|
||||
List<Source> getSourceListByUserId(String userId, String type,String name,Integer pageNum, Integer pageSize);
|
||||
Map<String, Object> getSourceListByUserId(String userId, String type, String name, Integer pageNum, Integer pageSize, LocalDateTime startTime, LocalDateTime endTime);
|
||||
|
||||
String checkIsPass(String parentId, String sourceName);
|
||||
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yj.earth.business.service.impl;
|
||||
|
||||
import com.yj.earth.business.domain.PoiInfo;
|
||||
import com.yj.earth.business.mapper.PoiInfoMapper;
|
||||
import com.yj.earth.business.service.PoiInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 周志雄
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
@Service
|
||||
public class PoiInfoServiceImpl extends ServiceImpl<PoiInfoMapper, PoiInfo> implements PoiInfoService {
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -26,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -173,38 +175,64 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
||||
return HttpUtil.doGet(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户资源列表
|
||||
*/
|
||||
|
||||
@Override
|
||||
public List<Source> getSourceListByUserId(String userId, String sourceType, String sourceName, Integer pageNum, Integer pageSize) {
|
||||
public Map<String, Object> getSourceListByUserId(String userId, String sourceType, String sourceName, Integer pageNum, Integer pageSize, LocalDateTime startTime, LocalDateTime endTime) {
|
||||
// 结果封装Map
|
||||
Map<String, Object> resultMap = new HashMap<>(2);
|
||||
// 查询该用户信息
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getId, userId);
|
||||
User user = userService.getOne(queryWrapper);
|
||||
if (user == null) {
|
||||
return Collections.emptyList();
|
||||
resultMap.put("list", Collections.emptyList());
|
||||
resultMap.put("total", 0);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// 查询角色信息
|
||||
String roleId = user.getRoleId();
|
||||
LambdaQueryWrapper<Role> roleQueryWrapper = new LambdaQueryWrapper<>();
|
||||
roleQueryWrapper.eq(Role::getId, roleId);
|
||||
Role role = roleService.getOne(roleQueryWrapper);
|
||||
if (role == null) {
|
||||
return Collections.emptyList();
|
||||
resultMap.put("list", Collections.emptyList());
|
||||
resultMap.put("total", 0);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// 创建用于计算总数的查询条件(始终排除directory类型)
|
||||
LambdaQueryWrapper<Source> countQueryWrapper = new LambdaQueryWrapper<>();
|
||||
countQueryWrapper.ne(Source::getSourceType, "directory");
|
||||
|
||||
// 构建资源查询条件
|
||||
LambdaQueryWrapper<Source> sourceQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 公共查询条件
|
||||
if (sourceType != null) {
|
||||
sourceQueryWrapper.eq(Source::getSourceType, sourceType);
|
||||
countQueryWrapper.eq(Source::getSourceType, sourceType);
|
||||
}
|
||||
if (StringUtils.isNotBlank(sourceName)) {
|
||||
sourceQueryWrapper.like(Source::getSourceName, sourceName);
|
||||
countQueryWrapper.like(Source::getSourceName, sourceName);
|
||||
}
|
||||
|
||||
// 增加资源ID的范围限制
|
||||
// 添加createdAt时间范围过滤(如果时间不为空)
|
||||
if (startTime != null && endTime != null) {
|
||||
// 同时存在开始和结束时间:查询范围内的数据
|
||||
sourceQueryWrapper.between(Source::getCreatedAt, startTime, endTime);
|
||||
countQueryWrapper.between(Source::getCreatedAt, startTime, endTime);
|
||||
} else if (startTime != null) {
|
||||
// 仅存在开始时间:查询大于等于开始时间的数据
|
||||
sourceQueryWrapper.ge(Source::getCreatedAt, startTime);
|
||||
countQueryWrapper.ge(Source::getCreatedAt, startTime);
|
||||
} else if (endTime != null) {
|
||||
// 仅存在结束时间:查询小于等于结束时间的数据
|
||||
sourceQueryWrapper.le(Source::getCreatedAt, endTime);
|
||||
countQueryWrapper.le(Source::getCreatedAt, endTime);
|
||||
}
|
||||
|
||||
// 增加资源ID的范围限制(非超级管理员)
|
||||
if (role.getIsSuper() != 1) {
|
||||
LambdaQueryWrapper<RoleSource> roleSourceQueryWrapper = new LambdaQueryWrapper<>();
|
||||
roleSourceQueryWrapper.eq(RoleSource::getRoleId, roleId);
|
||||
@ -213,19 +241,33 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
||||
.map(RoleSource::getSourceId)
|
||||
.toList();
|
||||
if (sourceIdList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
resultMap.put("list", Collections.emptyList());
|
||||
resultMap.put("total", 0);
|
||||
return resultMap;
|
||||
}
|
||||
sourceQueryWrapper.in(Source::getId, sourceIdList);
|
||||
countQueryWrapper.in(Source::getId, sourceIdList);
|
||||
}
|
||||
|
||||
// 判断是否需要分页
|
||||
// 处理分页和总数
|
||||
if (pageNum != null && pageSize != null) {
|
||||
// 执行分页查询,返回分页结果中的记录列表
|
||||
// 分页时,查询条件排除directory类型
|
||||
sourceQueryWrapper.ne(Source::getSourceType, "directory");
|
||||
// 分页查询:获取分页数据
|
||||
Page<Source> page = new Page<>(pageNum, pageSize);
|
||||
Page<Source> resultPage = sourceService.page(page, sourceQueryWrapper);
|
||||
return resultPage.getRecords();
|
||||
IPage<Source> resultPage = sourceService.page(page, sourceQueryWrapper);
|
||||
// 使用单独的count查询条件计算总数(已排除directory)
|
||||
long total = sourceService.count(countQueryWrapper);
|
||||
resultMap.put("list", resultPage.getRecords());
|
||||
resultMap.put("total", total);
|
||||
} else {
|
||||
return sourceService.list(sourceQueryWrapper);
|
||||
// 不分页:获取全部数据(包含所有类型)和总数(排除directory)
|
||||
List<Source> sourceList = sourceService.list(sourceQueryWrapper);
|
||||
long total = sourceService.count(countQueryWrapper);
|
||||
|
||||
resultMap.put("list", sourceList);
|
||||
resultMap.put("total", total);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public class CodeUtil {
|
||||
}
|
||||
|
||||
// 传入需要生成代码的表名
|
||||
Generation("device");
|
||||
Generation("poi_info");
|
||||
}
|
||||
|
||||
public static void Generation(String... tableName) {
|
||||
|
||||
@ -54,6 +54,7 @@ public class DatabaseManager {
|
||||
classes.add(WebSource.class);
|
||||
classes.add(PbfInfo.class);
|
||||
classes.add(Device.class);
|
||||
classes.add(PoiInfo.class);
|
||||
ENTITY_CLASSES = Collections.unmodifiableList(classes);
|
||||
}
|
||||
|
||||
|
||||
22
src/main/java/com/yj/earth/design/PoiInfo.java
Normal file
22
src/main/java/com/yj/earth/design/PoiInfo.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.yj.earth.design;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PoiInfo {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "文件路径")
|
||||
private String path;
|
||||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
@Schema(description = "是否启用")
|
||||
private Integer isEnable;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
66
src/main/java/com/yj/earth/params/Ellipse.java
Normal file
66
src/main/java/com/yj/earth/params/Ellipse.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.yj.earth.params;
|
||||
|
||||
import com.yj.earth.annotation.SourceType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@SourceType("ellipse")
|
||||
public class Ellipse {
|
||||
private String id;
|
||||
private String name;
|
||||
private Position center;
|
||||
private double bearing;
|
||||
private double semiMinorAxis;
|
||||
private double semiMajorAxis;
|
||||
private boolean show;
|
||||
private String color;
|
||||
private int heightMode;
|
||||
private Line line;
|
||||
private Label label;
|
||||
private Attribute attribute;
|
||||
private String richTextContent;
|
||||
private Map<String, Object> customView;
|
||||
|
||||
@Data
|
||||
public static class Position {
|
||||
private double lng;
|
||||
private double lat;
|
||||
private double alt;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Line {
|
||||
private int width;
|
||||
private String color;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Label {
|
||||
private String text;
|
||||
private boolean show;
|
||||
private Position position;
|
||||
private int fontSize;
|
||||
private int fontFamily;
|
||||
private String color;
|
||||
private int lineWidth;
|
||||
private int pixelOffset;
|
||||
private List<String> backgroundColor;
|
||||
private String lineColor;
|
||||
private boolean scaleByDistance;
|
||||
private int near;
|
||||
private int far;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Attribute {
|
||||
private Link link;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Link {
|
||||
private List<Object> content;
|
||||
}
|
||||
}
|
||||
12
src/main/java/com/yj/earth/vo/PoiVo.java
Normal file
12
src/main/java/com/yj/earth/vo/PoiVo.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.yj.earth.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PoiVo {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String address;
|
||||
private String lng;
|
||||
private String lat;
|
||||
}
|
||||
20
src/main/resources/mapper/PoiInfoMapper.xml
Normal file
20
src/main/resources/mapper/PoiInfoMapper.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yj.earth.business.mapper.PoiInfoMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yj.earth.business.domain.PoiInfo">
|
||||
<id column="id" property="id" />
|
||||
<result column="path" property="path" />
|
||||
<result column="name" property="name" />
|
||||
<result column="is_enable" property="isEnable" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, path, name, is_enable, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user