zqq:多条件检索

This commit is contained in:
qqGroup0 2023-04-11 22:33:30 +08:00
parent 54be606916
commit e0b50eeb08
3 changed files with 65 additions and 39 deletions

View File

@ -32,4 +32,10 @@ public class GroupByUse {
* 类型
*/
private String type;
/**
* 字典value
*/
private String dictValue;
}

View File

@ -24,6 +24,7 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
@Param("disaster_time") String disaster_time,
@Param("name") String name);
/**
* 获取债害详情信息
* @param id

View File

@ -26,7 +26,10 @@
</resultMap>
<sql id="Base_Column_List">
di.id ,di.disaster_type,di.disaster_keyword,
di
.
id
,di.disaster_type,di.disaster_keyword,
di.disaster_time,di.upload_time,di.geometry,
di.disaster_level,di.disaster_country,di.respond_status,
di.visit_count,di.spider_type,di.tempend_time,
@ -34,7 +37,10 @@
di.respond_time,di.download_count,di.sponsor_organization
</sql>
<sql id="Home_Disaster_Info">
d.disaster_type,d.disaster_time,d.disaster_country,
d
.
disaster_type
,d.disaster_time,d.disaster_country,
m.organization
</sql>
@ -58,64 +64,77 @@
</select>
<select id="getSelectCondition" resultType="com.kening.vordm.vo.GroupByUse">
select distinct ${name} as name
select distinct ${name} AS name , bdb.dict_value AS dictValue
from disaster_info
<if test="disaster_type!=null or disaster_country!=null or disaster_time!=null"> where </if>
<if test="disaster_type!=null"> disaster_type like concat('%',#{disaster_type},'%') </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 concat('%',#{disaster_time},'%')</if>
left join blade_dict_biz bdb on bdb.dict_key = disaster_info.disaster_type
<where>
<if test="disaster_type !=null and disaster_type!=''">
disaster_type = #{disaster_type}
</if>
<if test="disaster_country !=null and disaster_country!=''">
and disaster_country like concat('%',#{disaster_country},'%')
</if>
<if test="disaster_time!=null and disaster_time!=''">
and disaster_time like concat('%',#{disaster_time},'%')
</if>
</where>
</select>
<select id="getDisasterStatistics" resultType="com.kening.vordm.vo.GroupByUse">
select ${name} as name, count(*) as cnt
from disaster_info
group by ${name}
order by cnt desc
limit 0,7
order by cnt desc limit 0,7
</select>
<select id="getHomeDisaster" resultType="com.kening.vordm.vo.DisasterMangerInfo">
select *
from (select distinct manager_id,disaster_id from guest_mamanager_info
on g.manager_id=m.id and g.disaster_id=d.id
from (select distinct manager_id, disaster_id
from guest_mamanager_info on g.manager_id=m.id and g.disaster_id=d.id
where d.respond_status=#{respondStatus}
order by d.disaster_time desc
</select>
<select id="getAllUser" resultType="com.kening.vordm.vo.UserTenantVo">
SELECT
bu.organization AS organizationId,
SELECT bu.organization AS organizationId,
bt.tenant_name AS organizationName
FROM
blade_user bu
FROM blade_user bu
LEFT JOIN blade_tenant bt ON bt.id = bu.organization
GROUP BY bu.organization
</select>
<select id="getLeft3Data" resultType="com.kening.vordm.vo.GroupByUse">
select t.sponsor_organization as `name`, count(*) as cnt , 'sponsorOrganization' as `type` from disaster_info t GROUP BY t.sponsor_organization ORDER BY cnt desc LIMIT 3
select t.sponsor_organization as `name`, count(*) as cnt, 'sponsorOrganization' as `type`
from disaster_info t
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, 'responseOrganization' as `type` 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`,
select b.dict_key,
b.dict_value as name,
count(t.disaster_type) as cnt,
'type' as `type`,
CONCAT('/icon_disastertype/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
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
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 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`
order by cnt desc limit 7) b on c.flagname = b.`name`
</select>