左边栏

This commit is contained in:
why 2023-04-10 15:07:23 +08:00
parent ea517025f4
commit 609c82c13e
6 changed files with 72 additions and 18 deletions

View File

@ -22,4 +22,14 @@ public class GroupByUse {
* 图标 * 图标
*/ */
private String icon; private String icon;
/**
* 字典值
*/
private String dicKey;
/**
* 类型
*/
private String type;
} }

View File

@ -17,7 +17,9 @@ import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -97,25 +99,34 @@ public class DisasterInfoController {
} }
/** /**
* 灾害信息统计 国家/灾害类型 * 灾害信息统计 国家/灾害类型 左边栏
* *
* @param name * @param
* @return * @return
*/ */
@GetMapping("/disasterStatistics") @GetMapping("/disasterStatistics")
public R<List<GroupByUse>> getDisasterStatistics(String name) { public R<Map<String, List<GroupByUse>>> getDisasterStatistics() {
List<GroupByUse> groupByUseList = new ArrayList<>(); Map dataMap = new HashMap();
if("searchSponsorOrganization".equals(name)){ //按灾害类型查找 第一栏 取前7个
//发起机构方法 第三个左边栏 dataMap.put("type", disasterInfoService.getLeft1Data());
groupByUseList = disasterInfoService.getLeft3Data(); //按国家统计 第2栏 取前7个
} else if ("searchResponseOrganization".equals(name)) { dataMap.put("country", disasterInfoService.getLeft2Data());
//发起机构方法 第四个左边栏 //发起机构方法 第三个左边栏 取前3个
groupByUseList = disasterInfoService.getLeft4Data(); dataMap.put("sponsorOrganization",disasterInfoService.getLeft3Data());
}else{ //发起机构方法 第四个左边栏 取前3个
groupByUseList = disasterInfoService.getDisasterStatistics(name); 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);
} }
/** /**

View File

@ -40,4 +40,8 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
List<GroupByUse> getLeft3Data(); List<GroupByUse> getLeft3Data();
List<GroupByUse> getLeft4Data(); List<GroupByUse> getLeft4Data();
List<GroupByUse> getLeft1Data();
List<GroupByUse> getLeft2Data();
} }

View File

@ -94,10 +94,28 @@
GROUP BY bu.organization GROUP BY bu.organization
</select> </select>
<select id="getLeft3Data" resultType="com.kening.vordm.vo.GroupByUse"> <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>
<select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse"> <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> </select>
</mapper> </mapper>

View File

@ -46,4 +46,8 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
List<GroupByUse> getLeft3Data(); List<GroupByUse> getLeft3Data();
List<GroupByUse> getLeft4Data(); List<GroupByUse> getLeft4Data();
List<GroupByUse> getLeft1Data();
List<GroupByUse> getLeft2Data();
} }

View File

@ -104,8 +104,15 @@ implements DisasterInfoService {
return this.baseMapper.getLeft4Data(); return this.baseMapper.getLeft4Data();
} }
public List<GroupByUse> getLeftData() { @Override
return this.baseMapper.getLeft4Data(); public List<GroupByUse> getLeft1Data() {
return this.baseMapper.getLeft1Data();
} }
@Override
public List<GroupByUse> getLeft2Data() {
return this.baseMapper.getLeft2Data();
}
} }