<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.panzhihua.service_jinhui_community.dao.JinhuiLargeScreenDao">
|
|
<!-- 获取金汇风采数量 -->
|
<select id="getMienNum" resultType="String">
|
select
|
count(id) as number
|
from com_act_activity
|
where community_id=#{communityId}
|
</select>
|
|
<!-- 获取志愿者服务 -->
|
<select id="getVolunteerServeNum" resultType="String">
|
select
|
count(id) as number
|
from com_act_activity
|
where community_id=#{communityId}
|
and aattend_people in ('志愿者')
|
</select>
|
|
<!-- 获取微心愿数量 -->
|
<select id="getMicroVolunteeringNum" resultType="String">
|
select
|
count(id) as number
|
from jinhui_micro_volunteering
|
where state=#{state}
|
</select>
|
|
<!-- 便民服务商家 -->
|
<select id="getConvenientMerchantsNum" resultType="String">
|
select
|
count(id) as number
|
from jinhui_com_convenient_merchants
|
<where>
|
<if test=" auditType != null and auditType != '' ">
|
audit_type=#{auditType}
|
</if>
|
</where>
|
</select>
|
|
|
<!-- 商家类型 -->
|
<select id="getMerchantTypeNum" resultType="com.panzhihua.common.model.vos.jinhui.JinhuiMerchantTypeVO">
|
select
|
jccsc.name,
|
count(jccm.id) as number
|
from jinhui_com_convenient_service_categories as jccsc
|
left join jinhui_com_convenient_merchants as jccm on jccm.convenient_type=jccsc.id
|
GROUP BY jccsc.name
|
</select>
|
|
|
<!-- 商家类型 -->
|
<select id="getWorkGuideNum" resultType="String">
|
select
|
count(id) as number
|
from jinhui_com_act_work_guide
|
</select>
|
|
|
<!-- 商家类型 -->
|
<select id="getInterspaceApplyNum" resultType="String">
|
select
|
count(id) as number
|
from jinhui_interspace_apply_for
|
<where>
|
<if test="state!=null and state != ''">
|
state=#{state}
|
</if>
|
</where>
|
</select>
|
|
<!-- 商家类型 -->
|
<select id="getShoppingOrderNum" resultType="String">
|
select
|
count(id) as number
|
from jinhui_shopping_order
|
<where>
|
<if test="cancelType!=null and cancelType != ''">
|
cancel_type=#{cancelType}
|
</if>
|
</where>
|
</select>
|
|
<!-- 党员 志愿者数量 -->
|
<select id="baseInfo" resultType="com.panzhihua.common.model.vos.jinhui.JinhuiCommunityServicesVO">
|
select
|
count(id) as population,
|
IFNULL((select count(id) from com_act_announcement where community_id = ${communityId}) ,0) as announcement,
|
IFNULL((select count(id) from com_pb_member where community_id = ${communityId} and audit_result =1 ),0) as partyMember,
|
IFNULL((select count(id) from com_mng_volunteer_mng where community_id = ${communityId} and state=2 ),0) as volunteer
|
from com_mng_population_community_tags AS cmpct
|
where cmpct.community_id = ${communityId}
|
</select>
|
|
<!-- 获取社区工作者 -->
|
<select id="getServiceTeam" resultType="String">
|
SELECT
|
count(id) as number
|
from com_pb_service_team
|
<where>
|
1=1
|
<if test="communityId != null and communityId !=''">
|
and community_id=#{communityId}
|
</if>
|
<if test="type != null and type !=''">
|
and `type`=#{type}
|
</if>
|
</where>
|
</select>
|
|
|
<!-- 老人手环异常列表数量统计 -->
|
<select id="getEarlyWarningNum" resultType="String">
|
SELECT
|
count(id) as number
|
from bracelet_early_warning
|
<where>
|
1=1
|
<if test="disposeType != null and disposeType !=''">
|
and dispose_type=#{disposeType}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and community_id=#{communityId}
|
</if>
|
</where>
|
</select>
|
|
<!-- 老人手环异常列表 -->
|
<select id="getEarlyWarningList" resultType="com.panzhihua.common.model.vos.jinhui.JinhuiOldManVO">
|
SELECT
|
bew.dispose_time,
|
bew.creation_time,
|
bew.dispose_type,
|
bud.address,
|
bud.detail_address,
|
bud.mobile,
|
bud.bin_phone,
|
bud.emergency_contact,
|
bud.user_name
|
from bracelet_early_warning as bew
|
left join bracelet_user_data as bud on bew.equipment_number=bud.device_id
|
<where>
|
1=1
|
<if test="disposeType != null and disposeType !=''">
|
and bew.dispose_type=#{disposeType}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and bew.community_id=#{communityId}
|
</if>
|
</where>
|
</select>
|
|
|
<!-- 老人手环用户数据 -->
|
<select id="getBraceletUser" resultType="String">
|
SELECT
|
count(bew.id) as number
|
from bracelet_user_data as bew
|
<where>
|
1=1
|
<if test="sex != null and sex !=''">
|
and bew.sex=#{sex}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and bew.community_id=#{communityId}
|
</if>
|
</where>
|
</select>
|
|
|
<!-- 新增折线数据 -->
|
<select id="getEventAddPolylineData"
|
resultType="com.panzhihua.common.model.vos.jinhui.JinhuiOldManBrokenLineVO">
|
SELECT filed, SUM(num) AS num FROM (
|
SELECT DATE_FORMAT( e.creation_time, '%Y-%m' ) AS filed, COUNT(e.id) AS num
|
FROM `bracelet_user_data` AS e
|
WHERE e.community_id = #{communityId}
|
AND DATE_FORMAT( e.creation_time, '%Y-%m' ) > DATE_FORMAT(date_sub(curdate(),
|
interval 12 month),'%Y-%m')
|
GROUP BY filed
|
UNION ALL SELECT * FROM
|
(
|
SELECT DATE_FORMAT(curdate(),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 1 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 2 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 4 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 5 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 7 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 8 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 9 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 10 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 11 month),'%Y-%m') AS filed, 0 AS num
|
) temT
|
) temp GROUP BY filed ORDER BY filed ASC
|
</select>
|
|
<!-- 累计折线数据 -->
|
<select id="getEventTotalPolylineDate" resultType="String">
|
SELECT SUM(num) AS num
|
FROM (
|
SELECT COUNT(e.id) AS num
|
FROM `bracelet_user_data` AS e
|
WHERE e.community_id = #{communityId}
|
AND DATE_FORMAT( e.creation_time, '%Y-%m' ) <=#{date}
|
) temp
|
</select>
|
|
|
|
|
<select id="getOldManUserDate" resultType="com.panzhihua.common.model.vos.jinhui.JinhuiOldManUserDateVO">
|
SELECT
|
user_name,
|
device_id,
|
IFNULL(lng ,add_lng) AS lng,
|
IFNULL(lat ,add_lat) as lat,
|
is_abnormal
|
FROM bracelet_user_data
|
WHERE community_id = #{communityId}
|
</select>
|
|
|
<select id="getEarlyNewDate" resultType="String">
|
SELECT
|
dispose_type
|
FROM bracelet_early_warning
|
WHERE community_id = #{communityId} AND equipment_number=#{equipmentNumber}
|
order by creation_time desc
|
LIMIT 1
|
</select>
|
|
|
|
|
|
</mapper>
|