<?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.ComPropertyDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComProperty" id="ComPropertyBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="introduction" column="introduction"/>
|
<result property="contactName" column="contact_name"/>
|
<result property="phone" column="phone"/>
|
<result property="address" column="address"/>
|
<result property="userId" column="user_id"/>
|
<result property="communityId" column="community_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="areaId" column="area_id"/>
|
</resultMap>
|
|
<select id="pageList" resultType="com.panzhihua.common.model.vos.community.ComPropertyVO">
|
select t.*,t1.account,t1.password,t2.address as areaName,t3.role_id as roleId from com_property t
|
left join sys_user t1 on t.user_id = t1.user_id
|
left join com_mng_village t2 on t.area_id = t2.village_id
|
left join sys_user_role t3 on t.user_id = t3.user_id
|
<where>
|
1=1
|
<if test="commonPage.name !=null and commonPage.name !=''">
|
and t.name like concat(#{commonPage.name},'%')
|
</if>
|
<if test="commonPage.username !=null and commonPage.username !=''">
|
and t.contact_name like concat(#{commonPage.username},'%')
|
</if>
|
<if test="commonPage.phone !=null and commonPage.phone !=''">
|
and t.phone like concat(#{commonPage.phone},'%')
|
</if>
|
<if test="commonPage.paramId !=null">
|
and t.community_id =#{commonPage.paramId}
|
</if>
|
<if test="commonPage.areaId !=null">
|
and t.area_id =#{commonPage.areaId}
|
</if>
|
</where>
|
order by t.create_time desc
|
</select>
|
<select id="getRepairPolylineDate" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT DATE_FORMAT( p1.create_time, '%m' ) AS filed, COUNT(1) AS num FROM com_property_repair p1
|
LEFT JOIN com_property p2 ON p1.property_id = p2.id
|
WHERE p2.community_id = #{communityId} AND DATE_FORMAT( p1.create_time, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed
|
</select>
|
<select id="getRepairTotalPolylineDate"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(1) AS num FROM com_property_repair p1
|
LEFT JOIN com_property p2 ON p1.property_id = p2.id
|
WHERE p2.community_id = #{communityId} AND DATE_FORMAT( p1.create_time, '%Y%m' ) <= #{date}
|
</select>
|
<select id="getEventAddPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT DATE_FORMAT( e.create_at, '%m' ) AS filed, COUNT(e.id) AS num
|
FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE e.event_category = 1 AND e.event_type IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId}
|
AND DATE_FORMAT( e.create_at, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed
|
UNION ALL SELECT
|
DATE_FORMAT( create_at, '%m' ) AS filed, COUNT(id) AS num
|
FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) AND DATE_FORMAT( create_at, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed
|
</select>
|
<select id="getEventTotalPolylineDate"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT SUM(num) AS num FROM (
|
SELECT COUNT(e.id) AS num
|
FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE e.event_category = 1 AND e.event_type IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId}
|
AND DATE_FORMAT( e.create_at, '%Y%m' ) <= #{date}
|
UNION ALL SELECT
|
COUNT(id) AS num
|
FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) AND DATE_FORMAT( create_at, '%Y%m' ) <= #{date}
|
) temp
|
</select>
|
|
</mapper>
|