代码提交

This commit is contained in:
glj 2023-04-05 17:29:16 +08:00
commit 6ead3b9add
15 changed files with 209 additions and 4 deletions

View File

@ -96,6 +96,9 @@ public class DisasterInfo implements Serializable {
*/ */
private Date respondTime; private Date respondTime;
@TableField(exist = false)
private String name;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -44,7 +44,7 @@ public class RemoteSensingSourceData implements Serializable {
/** /**
* 产品波段树 * 产品波段树
*/ */
private Integer productBandsNum; private String productBandsNum;
/** /**
* 产品分辨率 * 产品分辨率
@ -145,6 +145,14 @@ public class RemoteSensingSourceData implements Serializable {
* 数据条目创建时间 * 数据条目创建时间
*/ */
private Date createTime; private Date createTime;
/**
* 下载链接
*/
private String downloadUrl;
/**
* 来源机构
*/
private String sourceOrganization;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,8 @@
package com.kening.vordm.vo;
import com.kening.vordm.entity.DisasterInfo;
public class HomeDisasterInfo extends DisasterInfo {
private String organization;
}

View File

@ -0,0 +1,82 @@
package com.kening.vordm.controller;
import org.springblade.core.mp.support.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.News;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.NewsService;
import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping
public class DisasterInfoController {
private final DisasterInfoService disasterInfoService;
private final NewsService newsService;
/**
* 查询条件封装
* @param disasterInfo
* @return
*/
@GetMapping("/select-condition")
public List<DisasterInfo> getCountryOrTypeOrTime(DisasterInfo disasterInfo){
QueryWrapper<DisasterInfo> qw = new QueryWrapper<>();
if (disasterInfo.getDisasterType()!=null){
qw.like("disaster_type",disasterInfo.getDisasterType());
}
if (disasterInfo.getDisasterCountry()!=null){
qw.like("disaster_country",disasterInfo.getDisasterCountry());
}
if (disasterInfo.getDisasterTime()!=null){
qw.like("disaster_time",disasterInfo.getDisasterTime());
}
List<DisasterInfo> disasterInfos = disasterInfoService.list(qw);
return disasterInfos;
}
/**
* 灾害id
* @param disasterInfo
* @return
*/
public List<Long> getDisasterIds(DisasterInfo disasterInfo){
List<DisasterInfo> disasterInfos = getCountryOrTypeOrTime(disasterInfo);
// List<DisasterInfo> disasterInfos = disasterInfoService.list(Condition.getQueryWrapper(disasterInfo));
if (!disasterInfos.isEmpty()){
List<Long> ids = new ArrayList<>();
disasterInfos.stream().forEach(disasterInfo1 -> {
ids.add(disasterInfo1.getId());
});
return ids;
}
return null;
}
@GetMapping("/getAllData")
public R<List<DisasterInfo>> getalldata(){
return R.data(disasterInfoService.getAllData());
}
/**
* 指定条件返回数据
* @param query
* @param disasterInfo
* @return
*/
@GetMapping("/test")
public R<IPage<News>> getdata(Query query, DisasterInfo disasterInfo){
List<Long> disasterIds = getDisasterIds(disasterInfo);
return R.data(newsService.page(Condition.getPage(query),new QueryWrapper<News>().in("disaster_id",disasterIds)));
}
}

View File

@ -29,5 +29,6 @@ public class EntityDataController {
return R.data(respondInfoService.getEntityDataList(Condition.getPage(query), entityData)); return R.data(respondInfoService.getEntityDataList(Condition.getPage(query), entityData));
} }
} }

View File

@ -0,0 +1,24 @@
package com.kening.vordm.controller;
import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@AllArgsConstructor
public class RemoteSensingSourceDataController {
private RemoteSensingSourceDataService remoteSensingSourceDataService;
@GetMapping("/remoteSensingSourceData")
public R<List<RemoteSensingSourceData>> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime){
return R.data(remoteSensingSourceDataService.getRemoteSensingSourceData(disasterType, disasterCountry, disasterTime));
}
}

View File

@ -3,6 +3,9 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kening.vordm.entity.DisasterInfo; import com.kening.vordm.entity.DisasterInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author G1393 * @author G1393
@ -12,5 +15,9 @@ import com.kening.vordm.entity.DisasterInfo;
*/ */
public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> { public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
List<DisasterInfo> getSelectCondition(@Param("disaster_type") String disaster_type,
@Param("disaster_country") String disaster_country,
@Param("disaster_time") String disaster_time,
@Param("name") String name);
List<DisasterInfo> getHomeDisasterInfo();
} }

View File

@ -31,4 +31,19 @@
temp_start_time,create_time,vordm_id, temp_start_time,create_time,vordm_id,
respond_time respond_time
</sql> </sql>
<select id="getHomeDisasterInfo" parameterType="com.kening.vordm.entity.DisasterInfo">
select *
from new_vordm.disaster_info
</select>
<select id="getSelectCondition" parameterType="com.kening.vordm.entity.DisasterInfo">
select distinct #{name} as name
from disaster_info
where
<if test="disaster_type!=null"> disaster_type=#{disaster_type} </if>
<if test="disaster_country!=null and (disaster_country!=null or disaster_time!=null)"> and </if>
<if test="disaster_country!=null"> disaster_country=#{disaster_country} </if>
<if test="disaster_time!=null and disaster_country!=null and disaster_time!=null"> and </if>
<if test="disaster_time!=null"> disaster_time like #{disaster_time}</if>
</select>
</mapper> </mapper>

View File

@ -37,6 +37,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from entity_data ed from entity_data ed
l
<where> <where>
<if test="entityData.disasterId != null and entityData.disasterId != ''"> <if test="entityData.disasterId != null and entityData.disasterId != ''">
ed.disaster_id = #{entityData.disasterId} ed.disaster_id = #{entityData.disasterId}

View File

@ -3,6 +3,9 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kening.vordm.entity.RemoteSensingSourceData; import com.kening.vordm.entity.RemoteSensingSourceData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author G1393 * @author G1393
@ -12,5 +15,5 @@ import com.kening.vordm.entity.RemoteSensingSourceData;
*/ */
public interface RemoteSensingSourceDataMapper extends BaseMapper<RemoteSensingSourceData> { public interface RemoteSensingSourceDataMapper extends BaseMapper<RemoteSensingSourceData> {
List<RemoteSensingSourceData> getRemoteSensingSourceData(@Param("disasterType") String disasterType,@Param("disasterCountry") String disasterCountry,@Param("disasterTime") String disasterTime);
} }

View File

@ -31,6 +31,8 @@
<result property="lowerLeftLon" column="lower_left_lon" jdbcType="DOUBLE"/> <result property="lowerLeftLon" column="lower_left_lon" jdbcType="DOUBLE"/>
<result property="disasterId" column="disaster_id" jdbcType="BIGINT"/> <result property="disasterId" column="disaster_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="downloadUrl" column="download_url" jdbcType="VARCHAR"/>
<result property="sourceOrganization" column="source_organization" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -42,6 +44,22 @@
upper_left_lon,upper_right_lat,upper_right_lon, upper_left_lon,upper_right_lat,upper_right_lon,
view_center_lat,view_center_lon,lower_right_lat, view_center_lat,view_center_lon,lower_right_lat,
lower_right_lon,lower_left_lat,lower_left_lon, lower_right_lon,lower_left_lat,lower_left_lon,
disaster_id,create_time disaster_id,create_time,download_url,source_organization
</sql> </sql>
<select id="getRemoteSensingSourceData" resultMap="BaseResultMap">
SELECT
r.*,
d.disaster_type,
d.disaster_country,
d.disaster_time
FROM
remote_sensing_source_data AS r,
disaster_info AS d
WHERE
d.id = r.disaster_id
AND d.disaster_type = #{disasterType}
AND d.disaster_country = #{disasterCountry}
AND d.disaster_time = #{disasterTime}
</select>
</mapper> </mapper>

View File

@ -4,11 +4,16 @@ package com.kening.vordm.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.DisasterInfo; import com.kening.vordm.entity.DisasterInfo;
import java.util.List;
/** /**
* @author G1393 * @author G1393
* @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service * @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service
* @createDate 2023-04-04 15:54:30 * @createDate 2023-04-04 15:54:30
*/ */
public interface DisasterInfoService extends IService<DisasterInfo> { public interface DisasterInfoService extends IService<DisasterInfo> {
List<DisasterInfo> getAllData();
// Long getDisasterId(DisasterInfo disasterInfo);
} }

View File

@ -3,6 +3,9 @@ package com.kening.vordm.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.RemoteSensingSourceData; import com.kening.vordm.entity.RemoteSensingSourceData;
import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author G1393 * @author G1393
@ -10,5 +13,6 @@ import com.kening.vordm.entity.RemoteSensingSourceData;
* @createDate 2023-04-04 15:54:31 * @createDate 2023-04-04 15:54:31
*/ */
public interface RemoteSensingSourceDataService extends IService<RemoteSensingSourceData> { public interface RemoteSensingSourceDataService extends IService<RemoteSensingSourceData> {
List<RemoteSensingSourceData> getRemoteSensingSourceData(String disasterType,String disasterCountry, String disasterTime);
} }

View File

@ -1,18 +1,37 @@
package com.kening.vordm.service.impl; package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.entity.DisasterInfo; import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.mapper.DisasterInfoMapper; import com.kening.vordm.mapper.DisasterInfoMapper;
import com.kening.vordm.service.DisasterInfoService; import com.kening.vordm.service.DisasterInfoService;
import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author G1393 * @author G1393
* @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service实现 * @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service实现
* @createDate 2023-04-04 15:54:30 * @createDate 2023-04-04 15:54:30
*/ */
@Service @Service
@RequiredArgsConstructor
public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, DisasterInfo> public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, DisasterInfo>
implements DisasterInfoService { implements DisasterInfoService {
// public DisasterInfoServiceImpl(DisasterInfoService disasterInfoService) {
// this.disasterInfoService = disasterInfoService;
// }
public List<DisasterInfo> getAllData(){
return this.baseMapper.getHomeDisasterInfo();
}
// public Long getDisasterId(DisasterInfo disasterInfo){
// QueryWrapper qw=new QueryWrapper<>(disasterInfo);
// Long va=;
// return va;
//// }
} }

View File

@ -6,6 +6,8 @@ import com.kening.vordm.mapper.RemoteSensingSourceDataMapper;
import com.kening.vordm.service.RemoteSensingSourceDataService; import com.kening.vordm.service.RemoteSensingSourceDataService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author G1393 * @author G1393
* @description 针对表remote_sensing_source_data(遥感影像源数据)的数据库操作Service实现 * @description 针对表remote_sensing_source_data(遥感影像源数据)的数据库操作Service实现
@ -15,4 +17,9 @@ import org.springframework.stereotype.Service;
public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensingSourceDataMapper, RemoteSensingSourceData> public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensingSourceDataMapper, RemoteSensingSourceData>
implements RemoteSensingSourceDataService { implements RemoteSensingSourceDataService {
@Override
public List<RemoteSensingSourceData> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime) {
return this.baseMapper.getRemoteSensingSourceData(disasterType, disasterCountry, disasterTime);
}
} }