遥感影像联动,以及数据查询
This commit is contained in:
parent
6ead3b9add
commit
392831be1e
|
@ -0,0 +1,22 @@
|
|||
package com.kening.vordm.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class groupByUse {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String count;
|
||||
}
|
|
@ -26,44 +26,27 @@ 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());
|
||||
}
|
||||
public R<List<DisasterInfo>> getSelectCondition(DisasterInfo disasterInfo){
|
||||
String disaster_time=null;
|
||||
if (disasterInfo.getDisasterTime()!=null){
|
||||
qw.like("disaster_time",disasterInfo.getDisasterTime());
|
||||
disaster_time=disasterInfo.getDisasterTime().toString();
|
||||
}
|
||||
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;
|
||||
return R.data(disasterInfoService.getConditionData(disasterInfo.getDisasterType(),disasterInfo.getDisasterCountry(),disaster_time,disasterInfo.getName()
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAllData")
|
||||
public R<List<DisasterInfo>> getalldata(){
|
||||
return R.data(disasterInfoService.getAllData());
|
||||
|
@ -74,9 +57,10 @@ public class DisasterInfoController {
|
|||
* @param disasterInfo
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping("/test")
|
||||
public R<IPage<News>> getdata(Query query, DisasterInfo disasterInfo){
|
||||
List<Long> disasterIds = getDisasterIds(disasterInfo);
|
||||
List<Long> disasterIds = disasterInfoService.getDisasterId(disasterInfo);
|
||||
return R.data(newsService.page(Condition.getPage(query),new QueryWrapper<News>().in("disaster_id",disasterIds)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package com.kening.vordm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.kening.vordm.entity.News;
|
||||
import com.kening.vordm.service.DisasterInfoService;
|
||||
import javafx.beans.binding.LongExpression;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import com.kening.vordm.entity.DisasterInfo;
|
||||
import com.kening.vordm.entity.RemoteSensingSourceData;
|
||||
import com.kening.vordm.service.RemoteSensingSourceDataService;
|
||||
import io.swagger.models.auth.In;
|
||||
|
@ -7,18 +15,29 @@ 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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/remoteSensing")
|
||||
public class RemoteSensingSourceDataController {
|
||||
|
||||
private RemoteSensingSourceDataService remoteSensingSourceDataService;
|
||||
private DisasterInfoService disasterInfoService;
|
||||
|
||||
@GetMapping("/remoteSensingSourceData")
|
||||
public R<List<RemoteSensingSourceData>> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime){
|
||||
return R.data(remoteSensingSourceDataService.getRemoteSensingSourceData(disasterType, disasterCountry, disasterTime));
|
||||
/**
|
||||
* 根据页码和灾害信息查出遥感影像源数据,可多个灾害
|
||||
* @param disasterInfo
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/SourceData")
|
||||
public R<IPage<RemoteSensingSourceData>> getRemoteSensingSourceData(DisasterInfo disasterInfo, Query query){
|
||||
List<Long> disasterIds=disasterInfoService.getDisasterId(disasterInfo);
|
||||
return R.data(remoteSensingSourceDataService.page(Condition.getPage(query),new QueryWrapper<RemoteSensingSourceData>().in("disaster_id",disasterIds)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
select *
|
||||
from new_vordm.disaster_info
|
||||
</select>
|
||||
<select id="getSelectCondition" parameterType="com.kening.vordm.entity.DisasterInfo">
|
||||
select distinct #{name} as name
|
||||
<select id="getSelectCondition" resultType="com.kening.vordm.vo.groupByUse">
|
||||
select distinct ${name} as name
|
||||
from disaster_info
|
||||
where
|
||||
<if test="disaster_time!=null or disaster_country!=null or disaster_time!=null"> where </if>
|
||||
|
||||
<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_type!=null and (disaster_country!=null or disaster_time!=null)"> and </if>
|
||||
<if test="disaster_country!=null"> disaster_country like concat('%',#{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>
|
||||
<if test="disaster_time!=null"> disaster_time like concat('%',#{disaster_time},'%')</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -14,6 +14,13 @@ import java.util.List;
|
|||
public interface DisasterInfoService extends IService<DisasterInfo> {
|
||||
List<DisasterInfo> getAllData();
|
||||
|
||||
List<DisasterInfo> getConditionData(String type,String country,String time,String name);
|
||||
// Long getDisasterId(DisasterInfo disasterInfo);
|
||||
|
||||
/**
|
||||
* 根据灾害信息获取灾害id
|
||||
* @param disasterInfo
|
||||
* @return
|
||||
*/
|
||||
List<Long> getDisasterId(DisasterInfo disasterInfo);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +29,33 @@ implements DisasterInfoService {
|
|||
public List<DisasterInfo> getAllData(){
|
||||
return this.baseMapper.getHomeDisasterInfo();
|
||||
}
|
||||
public List<DisasterInfo> getConditionData(String type,String country,String time,String name){
|
||||
List<DisasterInfo> disasterInfos=this.baseMapper.getSelectCondition(type,country,time,name);
|
||||
return disasterInfos;
|
||||
}
|
||||
|
||||
public List<Long> getDisasterId(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 = this.baseMapper.selectList(qw);
|
||||
// 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;
|
||||
}
|
||||
// public Long getDisasterId(DisasterInfo disasterInfo){
|
||||
// QueryWrapper qw=new QueryWrapper<>(disasterInfo);
|
||||
// Long va=;
|
||||
|
|
Loading…
Reference in New Issue