| | |
| | | <select id="listActivityType" resultType="com.panzhihua.common.model.vos.community.ComActActivityTypeVO"> |
| | | SELECT * FROM com_act_activity_type WHERE `type` = #{type} AND community_id = ${communityId} ORDER BY id ASC |
| | | </select> |
| | | <!-- <select id="selectResidentActHistogramData"--> |
| | | <!-- resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">--> |
| | | <!-- SELECT activity_type AS filed, COUNT(id) AS num--> |
| | | <!-- FROM com_act_activity--> |
| | | <!-- WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)--> |
| | | <!-- <if test="isResidentAct">--> |
| | | <!-- AND `type` = 2--> |
| | | <!-- </if>--> |
| | | <!-- <if test="!isResidentAct">--> |
| | | <!-- AND `type` = 1--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY filed--> |
| | | <!-- </select>--> |
| | | |
| | | <select id="selectResidentActHistogramData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT activity_type AS filed, COUNT(id) AS num |
| | | FROM com_act_activity |
| | | WHERE community_id = ${communityId} AND `status` IN(2,3,4,5) |
| | | <if test="isResidentAct"> |
| | | AND `type` = 2 |
| | | </if> |
| | | <if test="!isResidentAct"> |
| | | AND `type` = 1 |
| | | </if> |
| | | GROUP BY filed |
| | | </select> |
| | | |
| | | <select id="getIndexResidentActBaseData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT filed, num, IF(total = 0,0,ROUND(num/total,2)) AS percent FROM |
| | |
| | | </if> |
| | | ) temp2 |
| | | </select> |
| | | <!-- <select id="getActAddPolylineData" 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(id) AS num--> |
| | | <!-- FROM com_act_activity--> |
| | | <!-- WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)--> |
| | | <!-- <if test="isResidentAct">--> |
| | | <!-- AND `type` = 2--> |
| | | <!-- </if>--> |
| | | <!-- <if test="!isResidentAct">--> |
| | | <!-- AND `type` = 1--> |
| | | <!-- </if>--> |
| | | <!-- 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="getActAddPolylineData" 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(id) AS num |
| | | FROM com_act_activity |
| | | WHERE community_id = ${communityId} AND `status` IN(2,3,4,5) |
| | | <if test="isResidentAct"> |
| | | AND `type` = 2 |
| | | </if> |
| | | <if test="!isResidentAct"> |
| | | AND `type` = 1 |
| | | </if> |
| | | 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 |
| | | SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(id) AS num |
| | | FROM com_act_activity |
| | | WHERE community_id = ${communityId} AND `status` IN(2,3,4,5) |
| | | 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="getActTotalPolylineData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT COUNT(id) AS num |