左边栏
This commit is contained in:
parent
ea517025f4
commit
609c82c13e
|
@ -22,4 +22,14 @@ public class GroupByUse {
|
|||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
private String dicKey;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ import org.springblade.core.tool.api.R;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
@ -97,25 +99,34 @@ public class DisasterInfoController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 灾害信息统计 国家/灾害类型
|
||||
* 灾害信息统计 国家/灾害类型 左边栏
|
||||
*
|
||||
* @param name
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/disasterStatistics")
|
||||
public R<List<GroupByUse>> getDisasterStatistics(String name) {
|
||||
List<GroupByUse> groupByUseList = new ArrayList<>();
|
||||
if("searchSponsorOrganization".equals(name)){
|
||||
//发起机构方法 第三个左边栏
|
||||
groupByUseList = disasterInfoService.getLeft3Data();
|
||||
} else if ("searchResponseOrganization".equals(name)) {
|
||||
//发起机构方法 第四个左边栏
|
||||
groupByUseList = disasterInfoService.getLeft4Data();
|
||||
}else{
|
||||
groupByUseList = disasterInfoService.getDisasterStatistics(name);
|
||||
}
|
||||
public R<Map<String, List<GroupByUse>>> getDisasterStatistics() {
|
||||
Map dataMap = new HashMap();
|
||||
//按灾害类型查找 第一栏 取前7个
|
||||
dataMap.put("type", disasterInfoService.getLeft1Data());
|
||||
//按国家统计 第2栏 取前7个
|
||||
dataMap.put("country", disasterInfoService.getLeft2Data());
|
||||
//发起机构方法 第三个左边栏 取前3个
|
||||
dataMap.put("sponsorOrganization",disasterInfoService.getLeft3Data());
|
||||
//发起机构方法 第四个左边栏 取前3个
|
||||
dataMap.put("responseOrganization",disasterInfoService.getLeft4Data());
|
||||
//List<GroupByUse> groupByUseList = new ArrayList<>();
|
||||
// if("searchSponsorOrganization".equals(name)){
|
||||
// //发起机构方法 第三个左边栏
|
||||
// groupByUseList = disasterInfoService.getLeft3Data();
|
||||
// } else if ("searchResponseOrganization".equals(name)) {
|
||||
// //发起机构方法 第四个左边栏
|
||||
// groupByUseList = disasterInfoService.getLeft4Data();
|
||||
// }else{
|
||||
// groupByUseList = disasterInfoService.getDisasterStatistics(name);
|
||||
// }
|
||||
|
||||
return R.data(groupByUseList);
|
||||
return R.data(dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,4 +40,8 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
|
|||
List<GroupByUse> getLeft3Data();
|
||||
|
||||
List<GroupByUse> getLeft4Data();
|
||||
|
||||
List<GroupByUse> getLeft1Data();
|
||||
|
||||
List<GroupByUse> getLeft2Data();
|
||||
}
|
||||
|
|
|
@ -94,10 +94,28 @@
|
|||
GROUP BY bu.organization
|
||||
</select>
|
||||
<select id="getLeft3Data" resultType="com.kening.vordm.vo.GroupByUse">
|
||||
select t.sponsor_organization as `name`, count(*) as cnt from disaster_info t GROUP BY t.sponsor_organization ORDER BY cnt desc LIMIT 3
|
||||
select t.sponsor_organization as `name`, count(*) as cnt from disaster_info t 'sponsorOrganization' as `type` GROUP BY t.sponsor_organization ORDER BY cnt desc LIMIT 3
|
||||
</select>
|
||||
<select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse">
|
||||
select t.response_organization as `name`, count(*) as cnt from guest_manage_disaster_ref t GROUP BY t.response_organization ORDER BY cnt desc LIMIT 3
|
||||
select t.response_organization as `name`, count(*) as cnt, 'responseOrganization' as `type` from guest_manage_disaster_ref t GROUP BY t.response_organization ORDER BY cnt desc LIMIT 3
|
||||
</select>
|
||||
<select id="getLeft1Data" resultType="com.kening.vordm.vo.GroupByUse">
|
||||
select b.dict_key, b.dict_value as name, count(t.disaster_type) as cnt, 'type' as `type`,
|
||||
CONCAT('@/assets/home/icon-',b.dict_key,'.png') as icon
|
||||
from blade_dict_biz b left join disaster_info t on b.dict_key = t.disaster_type
|
||||
where b.`code` = 'disaster' and b.dict_key is not null
|
||||
group by b.dict_key, b.dict_value
|
||||
order by cnt desc
|
||||
limit 7
|
||||
</select>
|
||||
<select id="getLeft2Data" resultType="com.kening.vordm.vo.GroupByUse">
|
||||
SELECT b.*, c.img as icon from country_icon c INNER JOIN
|
||||
(select t.disaster_country as name, count(*) as cnt, 'country' as `type`
|
||||
from disaster_info t
|
||||
group by t.disaster_country
|
||||
order by cnt desc
|
||||
limit 7) b on c.flagname = b.`name`
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -46,4 +46,8 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
|
|||
List<GroupByUse> getLeft3Data();
|
||||
|
||||
List<GroupByUse> getLeft4Data();
|
||||
|
||||
List<GroupByUse> getLeft1Data();
|
||||
|
||||
List<GroupByUse> getLeft2Data();
|
||||
}
|
||||
|
|
|
@ -104,8 +104,15 @@ implements DisasterInfoService {
|
|||
return this.baseMapper.getLeft4Data();
|
||||
}
|
||||
|
||||
public List<GroupByUse> getLeftData() {
|
||||
return this.baseMapper.getLeft4Data();
|
||||
@Override
|
||||
public List<GroupByUse> getLeft1Data() {
|
||||
return this.baseMapper.getLeft1Data();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupByUse> getLeft2Data() {
|
||||
return this.baseMapper.getLeft2Data();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue