<?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_community.dao.ComActFourMemberDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActFourMember" id="ComActFourMemberBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="position" column="position"/>
|
<result property="jurisdiction" column="jurisdiction"/>
|
<result property="communityId" column="community_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="jurisdictionContent" column="jurisdiction_content"/>
|
<result property="idCard" column="id_card"/>
|
</resultMap>
|
|
<resultMap id="baseResultMap" type="com.panzhihua.common.model.vos.community.ComActFourMemberVO">
|
<collection property="buildings"
|
ofType="String"
|
column="{id = jurisdiction}"
|
select="selectBuilding"
|
javaType="java.util.ArrayList" />
|
</resultMap>
|
|
<select id="pageList" resultMap="baseResultMap">
|
select t.*,t1.*,t2.role_id from com_act_four_member t left join sys_user t1 on t.user_id = t1.user_id left join sys_user_role t2 on t.user_id =t2.user_id
|
<where>
|
1=1
|
<if test="commonPage.paramId !=null">
|
and t.community_id = ${commonPage.paramId}
|
</if>
|
<if test="commonPage.position !=null and commonPage.position !=''">
|
and t.position like concat('%',#{commonPage.position},'%')
|
</if>
|
<if test="commonPage.keyword !=null and commonPage.keyword !=''">
|
and (t1.name like concat(#{commonPage.keyword},'%') or t1.phone like concat(#{commonPage.keyword},'%') or t.jurisdiction_content like concat('%',#{commonPage.keyword},'%'))
|
</if>
|
<if test="commonPage.status !=null">
|
and t1.status =#{commonPage.status}
|
</if>
|
</where>
|
order by t.create_time desc
|
</select>
|
|
<select id="selectBuilding" resultType="String">
|
select distinct concat(alley,house_num,'号',IFNULL(floor,0),'栋') from com_mng_population_house where id in (${id})
|
</select>
|
|
<select id="getById" resultMap="baseResultMap">
|
select t.*,t1.*,t2.role_id from com_act_four_member t left join sys_user t1 on t.user_id = t1.user_id left join sys_user_role t2 on t.user_id =t2.user_id where t.id =#{id}
|
</select>
|
<select id="getFourMemberBaseData"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenFourMemberStatisticsInfo">
|
SELECT
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId}) AS szsyTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','居民小组长','%') OR position = '全部')) AS jmxzzTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','妇女小组长','%') OR position = '全部')) AS fnxzzTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','党小组长','%') OR position = '全部')) AS dxzzTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','楼栋长','%') OR position = '全部')) AS ldzTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','调解员','%') OR position = '全部')) AS tjyTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','安全员','%') OR position = '全部')) AS aqyTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','宣传员','%') OR position = '全部')) AS xcyTotal,
|
(SELECT COUNT(id) FROM com_act_four_member WHERE community_id = #{communityId} AND (position LIKE CONCAT('%','监督员','%') OR position = '全部')) AS jdyTotal,
|
(SELECT
|
(SELECT COUNT(t1.id)
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_easy_photo t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5 AND t1.service_type = 1 AND t2.`status` = 5
|
) +
|
(SELECT COUNT(t1.id)
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_micro_wish t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5 AND t1.service_type = 2 AND t2.`status` = 6
|
)
|
) AS jjwtTotal,
|
(SELECT COUNT(id) FROM com_act_discuss WHERE community_id = #{communityId} AND content_type = 2 AND is_del = 2) AS ylysTotal
|
</select>
|
<select id="getFourMembers" resultType="com.panzhihua.common.model.vos.community.ComActFourMemberVO">
|
SELECT
|
a.id,
|
su.`name`,
|
su.phone,
|
a.position,
|
a.url,
|
substring_index( substring_index( a.jurisdiction_content, ',', b.help_topic_id + 1 ), ',',- 1 ) AS jurisdiction_content
|
FROM
|
com_act_four_member a
|
LEFT JOIN sys_user su ON a.user_id = su.user_id
|
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.jurisdiction_content ) - length( REPLACE ( a.jurisdiction_content, ',', '' ))+ 1 )
|
WHERE
|
a.community_id = #{communityId}
|
</select>
|
<select id="retrieveJJWTAddPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT filed, SUM(num) AS num FROM (
|
SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(1) AS num
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_easy_photo t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5 AND t1.service_type = 1 AND t2.`status` = 5 AND DATE_FORMAT( create_at, '%Y-%m' ) > DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m'
|
) GROUP BY filed
|
UNION ALL
|
SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(1) AS num
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_micro_wish t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5 AND t1.service_type = 2 AND t2.`status` = 6 AND DATE_FORMAT( create_at, '%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="retrieveJJWTTotalPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT
|
(SELECT COUNT(1) AS num
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_easy_photo t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5
|
AND t1.service_type = 1 AND t2.`status` = 5 AND DATE_FORMAT( t2.create_at, '%Y-%m' ) <= #{date}
|
)
|
+
|
(SELECT COUNT(1) AS num
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_micro_wish t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{communityId} AND t1.`type` = 5
|
AND t1.service_type = 2 AND t2.`status` = 6 AND DATE_FORMAT( t2.create_at, '%Y-%m' ) <= #{date}
|
) AS num
|
</select>
|
<select id="retrieveYLYSAddPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT filed, SUM(num) AS num FROM (
|
SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(1) AS num
|
FROM com_act_discuss
|
WHERE community_id = #{communityId} AND content_type = 2 AND is_del = 2 AND DATE_FORMAT( create_at, '%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="retrieveYLYSTotalPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(1) AS num
|
FROM com_act_discuss
|
WHERE community_id = #{communityId} AND content_type = 2 AND is_del = 2 AND DATE_FORMAT( create_at, '%Y-%m' ) <= #{date}
|
</select>
|
|
</mapper>
|