<?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.ComActEasyPhotoDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActEasyPhotoDO">
|
<id column="id" property="id" />
|
<result column="sponsor_id" property="sponsorId" />
|
<result column="happen_addr" property="happenAddr" />
|
<result column="addr_remark" property="addrRemark" />
|
<result column="status" property="status" />
|
<result column="handler_id" property="handlerId" />
|
<result column="create_at" property="createAt" />
|
<result column="examine_at" property="examineAt" />
|
<result column="detail" property="detail" />
|
<result column="photo_path_list" property="photoPathList" />
|
<result column="handle_result" property="handleResult" />
|
<result column="handle_photo_list" property="handlePhotoList" />
|
<result column="community_id" property="communityId" />
|
<result column="is_hide" property="isHide" />
|
<result column="is_need_feed_back" property="isNeedFeedBack" />
|
<result column="feedback_at" property="feedbackAt" />
|
<result column="reject_reason" property="rejectReason" />
|
<result column="del_tag" property="delTag" />
|
<result column="is_report" property="isReport" />
|
<result column="is_publicity" property="isPublicity" />
|
<result column="handle_status" property="handleStatus" />
|
<result column="lng_lat" property="lngLat" />
|
<result column="activity_type" property="activityType" />
|
<result column="activity_amount" property="activityAmount" />
|
<result column="activity_id" property="activityId" />
|
<result column="img_width" property="imgWidth" />
|
<result column="img_height" property="imgHeight" />
|
<result column="add_type" property="addType" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, sponsor_id, happen_addr, addr_remark, status, handler_id, create_at, examine_at, detail, photo_path_list
|
, handle_result, handle_photo_list, community_id, is_hide, is_need_feed_back, feedback_at, reject_reason
|
, del_tag, is_report, is_publicity, handle_status, lng_lat, activity_type, activity_amount, activity_id
|
, img_width, img_height,add_type
|
</sql>
|
|
<select id="pageEasyPhotoAdmin" parameterType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO"
|
resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.is_report_urban,
|
p.is_report_dpc,
|
p.classify_id,
|
ca.`name` as classifyName,
|
p.examine_at,
|
c.name communityName,
|
p.urban_status,
|
p.transfer_reason,
|
p.add_type,
|
p.handle_status
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.del_tag = 0 and p.`status` != 3
|
<if test='comActEasyPhotoVO.communityId != null and comActEasyPhotoVO.communityId != 0'>
|
and p.community_id = ${comActEasyPhotoVO.communityId}
|
</if>
|
<if test='comActEasyPhotoVO.addType != null'>
|
and p.add_type = #{comActEasyPhotoVO.addType}
|
</if>
|
<if test='comActEasyPhotoVO.status != null and comActEasyPhotoVO.status!=0' >
|
AND p.`status` = #{comActEasyPhotoVO.status}
|
</if>
|
<if test='comActEasyPhotoVO.isPublicity != null' >
|
AND p.`is_publicity` = #{comActEasyPhotoVO.isPublicity}
|
</if>
|
<if test='comActEasyPhotoVO.isReportUrban != null' >
|
AND p.`is_report_urban` = #{comActEasyPhotoVO.isReportUrban}
|
</if>
|
<if test='comActEasyPhotoVO.isReportDpc != null' >
|
AND p.`is_report_dpc` = #{comActEasyPhotoVO.isReportDpc}
|
</if>
|
<if test='comActEasyPhotoVO.classifyId != null' >
|
AND p.`classify_id` = #{comActEasyPhotoVO.classifyId}
|
</if>
|
<if test='comActEasyPhotoVO.urbanStatus != null' >
|
AND p.`urban_status` = #{comActEasyPhotoVO.urbanStatus}
|
</if>
|
<if test='comActEasyPhotoVO.createBegin != null '>
|
AND p.create_at BETWEEN #{comActEasyPhotoVO.createBegin}
|
AND #{comActEasyPhotoVO.createEnd}
|
</if>
|
<if test='comActEasyPhotoVO.activityType != null'>
|
AND p.activity_type =#{comActEasyPhotoVO.activityType}
|
</if>
|
|
<if test='comActEasyPhotoVO.keyWord != null and comActEasyPhotoVO.keyWord != ""'>
|
AND (u.`name` like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
p.happen_addr like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
su.`name` like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
p.detail like concat(#{comActEasyPhotoVO.keyWord},'%') or u.phone like concat(#{comActEasyPhotoVO.keyWord},'%')
|
)
|
</if>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
|
</select>
|
|
<select id="getEasyPhotoStatistics" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoStatisticsVO">
|
SELECT
|
count( id ) AS examineNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` = 2 AND community_id = ${communityId} AND del_tag = 0 ) AS verificationNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` in (1,2,4,5) AND `is_publicity` = 1 AND community_id = ${communityId} AND del_tag = 0 ) AS rejectNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` = 5 AND community_id = ${communityId} AND del_tag = 0 ) AS completeNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` = 4 AND community_id = ${communityId} AND del_tag = 0 ) AS commitAmount,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 1) as yzAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 1 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as yzDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 2) as jlAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 2 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as jlDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 3) as ptAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 3 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as ptDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 4) as ybAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and activity_type = 4 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as ybDayTotal,
|
(select IFNULL(sum(activity_amount),0) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0) as allRewardAmount,
|
(select IFNULL(sum(activity_amount),0) from com_act_easy_photo where `status` in (2,4,5) AND community_id = ${communityId} and del_tag = 0 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as dayRewardAmount
|
FROM
|
com_act_easy_photo
|
WHERE
|
`status` = 1
|
AND community_id = ${communityId}
|
AND del_tag = 0
|
</select>
|
|
<select id="easyPhotoCount" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoCountVO">
|
select count(*) total,(select count(*) today from com_act_easy_photo where transfer_time BETWEEN DATE_FORMAT(CURDATE(),'%Y-%m-%d %H:%i:%s') and DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY)
|
<if test="urbanStatus !=null">
|
and urban_status=#{urbanStatus}
|
</if>)
|
today from com_act_easy_photo
|
<where>
|
1=1
|
<if test="urbanStatus !=null">
|
and urban_status=#{urbanStatus}
|
</if>
|
</where>
|
</select>
|
|
<select id="export" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.examine_at,
|
c.name communityName,
|
p.is_report_urban,
|
p.urban_status,
|
p.add_type,
|
ca.`name` as photoType
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.del_tag = 0 and p.`is_report_urban` =1
|
<if test='communityId != null and communityId != 0'>
|
and p.community_id = ${communityId}
|
</if>
|
<if test='urbanStatus != null ' >
|
AND p.`urban_status` = #{urbanStatus}
|
</if>
|
<if test='createBegin != null '>
|
AND p.create_at BETWEEN #{createBegin}
|
AND #{createEnd}
|
</if>
|
|
<if test='keyWord != null and keyWord != ""'>
|
AND (u.`name` like concat(#{keyWord},'%') or
|
p.happen_addr like concat(#{keyWord},'%') or
|
su.`name` like concat(#{keyWord},'%') or
|
p.detail like concat(#{keyWord},'%') or u.phone like concat(#{comActEasyPhotoVO.keyWord},'%')
|
)
|
</if>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
</select>
|
|
<select id="exportByIds" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.examine_at,
|
c.name communityName,
|
p.is_report_urban,
|
p.is_report_dpc,
|
p.urban_status,
|
p.add_type,
|
ca.`name` as photoType
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.id in
|
<foreach collection="list" item="ids" index="index"
|
open="(" close=")" separator=",">
|
#{ids}
|
</foreach>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
</select>
|
|
<select id="easyPhotoNoHandleIds" resultType="Long">
|
select id from com_act_easy_photo where `status` = 1 and community_id = ${communityId} and del_tag = 0
|
</select>
|
|
<select id="banner" resultType="com.panzhihua.common.model.vos.community.easyPhoto.BannerVO">
|
select id,cover,publish_at as show_time,1 as type,jump_url,jump_type from com_act_dyn where status =1 and category !=10 and cover is not null and community_id = ${communityId}
|
UNION ALL
|
select id,cover,publish_at as show_time,2 as type,"" as jump_url,"" as jump_type from com_act_activity where status =3 and cover is not null and community_id = ${communityId}
|
UNION ALL
|
select id,cover,release_time as show_time,3 as type,"" as jump_url,"" as jump_type from com_pb_activity where status =3 and cover is not null and community_id = ${communityId}
|
UNION ALL
|
select id,"" as cover,publish_time as show_time,4 as type,"" as jump_url,"" as jump_type from com_act_questnaire where state =2 and community_id = ${communityId}
|
UNION ALL
|
select id,cover,publish_at as show_time,5 as type,jump_url,jump_type from com_pb_dyn where status =2 and cover is not null and community_id = ${communityId}
|
UNION ALL
|
select id,img_url as cover,publish_time as show_time,6 as type,"" as jump_url,"" as jump_type from com_act_reserve where status =2 and community_id = ${communityId}
|
UNION ALL
|
select id,logo as cover,release_at as show_time,7 as type,"" as jump_url,"" as jump_type from com_act_easy_photo_activity where status =2 and community_id = ${communityId}
|
order by show_time desc limit 30
|
</select>
|
<select id="selectStatisticsList" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT t1.`name` AS filed, COUNT(t2.id) AS num
|
FROM com_act_easy_photo_classify t1
|
LEFT JOIN (SELECT * FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0) t2 ON t1.id = t2.classify_id
|
WHERE t1.`status` = 1 GROUP BY filed
|
</select>
|
<select id="selectResidentAutonomyStatistics"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO">
|
SELECT * FROM
|
(SELECT COUNT(id) AS easyPhotoCurrentMonCount FROM com_act_easy_photo WHERE community_id = ${communityId} AND del_tag = 0 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t1,
|
(SELECT COUNT(id) AS microWishCurrentMonCount FROM com_act_micro_wish WHERE community_id = ${communityId} AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t2,
|
(SELECT IF(SUM(aim_num) IS NULL,0,SUM(aim_num)) AS aimNum FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` != 4) t3,
|
(SELECT COUNT(id) AS microWishTotal FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` != 4) t4,
|
(SELECT COUNT(id) AS committeeCurrentMonCount FROM com_act_committee WHERE community_id = ${communityId} AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t5,
|
(SELECT COUNT(id) AS committeeTotal FROM com_act_committee WHERE community_id = ${communityId}) t6,
|
(SELECT ROUND( a.num / b.total * 100, 2 ) AS areaCoverPercent FROM
|
(SELECT COUNT(DISTINCT(area_id)) AS num FROM com_act_committee WHERE community_id = ${communityId}) a,
|
(SELECT COUNT(village_id) AS total FROM com_mng_village WHERE community_id = ${communityId}) b
|
) t7,
|
(SELECT COUNT(id) AS discussCurrentMonCount FROM com_act_discuss WHERE community_id = ${communityId} AND is_del = 2 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t8,
|
(SELECT COUNT(id) AS discussTotal FROM com_act_discuss WHERE community_id = ${communityId} AND is_del = 2) t9,
|
(SELECT COUNT(id) AS neighborCurrentMonCount FROM com_act_neighbor_circle WHERE community_id = ${communityId} AND is_del = 2 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t10,
|
(SELECT COUNT(id) AS neighborTotal, SUM(fabulous_num) AS neighborFabulousNum, SUM(forward_num) AS neighborForwardNum,
|
SUM(comment_num) AS neighborCommentNum FROM com_act_neighbor_circle WHERE community_id = ${communityId} AND is_del = 2) t11,
|
(SELECT COUNT(c1.id) AS repairCurrentMonCount FROM com_property_repair c1
|
LEFT JOIN com_property c2 ON c1.property_id = c2.id
|
WHERE c2.community_id = ${communityId} AND DATE_FORMAT( c1.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t12,
|
(SELECT COUNT(c1.id) AS repairTotal FROM com_property_repair c1
|
LEFT JOIN com_property c2 ON c1.property_id = c2.id
|
WHERE c2.community_id = ${communityId}) t13,
|
(SELECT IF(SUM(quantity) IS NULL,0,SUM(quantity)) AS warehouseCurrentMonCount FROM com_act_warehouse_donates WHERE community_id = ${communityId} AND `status` = 2 AND DATE_FORMAT( signing_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t14,
|
(SELECT warehouseTotal, warehouseSurplusTotal, warehouseTotal - warehouseSurplusTotal AS warehouseApplyTotal FROM
|
(SELECT IF(SUM(quantity) IS NULL,0,SUM(quantity)) AS warehouseTotal, IF(SUM(surplus_quantity) IS NULL,0,SUM(surplus_quantity)) AS warehouseSurplusTotal FROM com_act_warehouse_donates WHERE community_id = ${communityId} AND `status` = 2) temp) t15,
|
(SELECT COUNT(DISTINCT d2.user_id) AS discussCount FROM com_act_discuss d1
|
INNER JOIN com_act_discuss_comment d2 ON d1.id = d2.discuss_id
|
WHERE d1.community_id = ${communityId} AND d1.is_del = 2 AND `type` = 1) t16,
|
(SELECT COUNT(DISTINCT d2.user_id) AS voteCount FROM com_act_discuss d1
|
INNER JOIN com_act_discuss_option_user d2 ON d1.id = d2.discuss_id
|
WHERE d1.community_id = ${communityId} AND d1.is_del = 2 AND `type` = 2) t17,
|
(SELECT COUNT(id) AS residentActCurrentMonCount
|
FROM com_act_activity
|
WHERE community_id = ${communityId} AND volunteer_max = 0 AND DATE_FORMAT( publish_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t18
|
</select>
|
<select id="selectGridsGovernance"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO">
|
SELECT
|
IFNULL((SELECT count( e.id ) 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 = 5 AND e.event_status = 2 AND egd.grid_community_id = ${communityId}), 0) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 7), 0) AS eventTFTotal,
|
|
IFNULL(( SELECT count( e1.id ) FROM `event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND egd1.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 4), 0) AS eventZATotal,
|
|
IFNULL(( SELECT count( e2.id ) FROM `event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND egd2.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 5), 0) AS eventMDTotal,
|
|
IFNULL(( SELECT count( e3.id ) FROM `event` AS e3 LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND egd3.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 3), 0) AS eventTSTotal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 8), 0) AS eventFJTotal,
|
|
IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND egd5.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 6), 0) AS eventMSTotal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 1), 0) AS otherTotal,
|
|
IFNULL((SELECT count( e.id ) 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 = 5 AND e.event_deal_status = 4 AND egd.grid_community_id = ${communityId}), 0) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 7), 0) AS eventTFDeal,
|
|
IFNULL(( SELECT count( e1.id ) FROM `event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE event_category = 1 AND event_type = 1 AND event_deal_status = 4 AND egd1.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 4), 0) AS eventZADeal,
|
|
IFNULL(( SELECT count( e2.id ) FROM `event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE event_category = 1 AND event_type = 3 AND event_deal_status = 4 AND egd2.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 5), 0) AS eventMDDeal,
|
|
IFNULL(( SELECT count( e3.id ) FROM `event` AS e3 LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE event_category = 1 AND event_type = 6 AND event_deal_status = 4 AND egd3.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 3), 0) AS eventTSDeal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 8), 0) AS eventFJDeal,
|
|
IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 2 AND event_deal_status = 4 AND egd5.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 6), 0) AS eventMSDeal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1), 0) AS otherDeal,
|
IFNULL((SELECT count(id) FROM event_grid_data WHERE grid_community_id = ${communityId}), 0) AS gridTotal,
|
IFNULL((select count(egmr.id) from event_grid_member_relation as egmr left join event_grid_data as egd1 on egd1.id = egmr.grid_id where egd1.grid_community_id = ${communityId}), 0) AS gridMemberTotal
|
</select>
|
<select id="selectIndexEasyPhotoBaseData"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenEasyPhotoStatisticsInfo">
|
SELECT
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id IN (1552663338578743296,1552663345243492353,1552663345524510720,1552663345570648064,1552663345683894273,1552663345751003136,1552663345885220866)) AS eventDealTotal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345751003136) AS eventTFDeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345524510720) AS eventZADeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345570648064) AS eventMDDeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345243492353) AS eventTSDeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345683894273) AS eventMSDeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663345885220866) AS eventFJDeal,
|
(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN(4,5) AND del_tag = 0 AND classify_id = 1552663338578743296) AS otherDeal
|
</select>
|
<select id="getEasyPhotoAddPolylineData"
|
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_easy_photo
|
WHERE community_id = ${communityId} AND del_tag = 0
|
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="getEasyPhotoTotalPolylineDate"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(id) AS num FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND del_tag = 0
|
AND DATE_FORMAT( create_at, '%Y-%m' ) <= #{date}
|
</select>
|
<select id="indexEasyPhotoList" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT t1.id, t1.detail, t1.photo_path_list, t1.`status`, t2.`name` AS classifyName
|
FROM com_act_easy_photo t1
|
LEFT JOIN com_act_easy_photo_classify t2 ON t1.classify_id = t2.id
|
WHERE t1.community_id = ${pageBaseDTO.communityId} AND t1.`status` IN(4,5) AND t1.del_tag = 0
|
<if test="pageBaseDTO.paramId != null">
|
AND t1.classify_id = #{pageBaseDTO.paramId}
|
</if>
|
ORDER BY t1.id DESC
|
</select>
|
|
<select id="selectBigscreenGridsGovern" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigscreenGridsGovernanceStatisticsVO">
|
SELECT
|
IFNULL((SELECT count( e.id ) 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 = 5 AND e.event_status = 2 AND egd.grid_community_id = ${communityId}), 0) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 7), 0) AS eventTFTotal,
|
|
IFNULL(( SELECT count( e1.id ) FROM `event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND egd1.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 4), 0) AS eventZATotal,
|
|
IFNULL(( SELECT count( e2.id ) FROM `event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND egd2.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 5), 0) AS eventMDTotal,
|
|
IFNULL(( SELECT count( e3.id ) FROM `event` AS e3 LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND egd3.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 3), 0) AS eventTSTotal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 8), 0) AS eventFJTotal,
|
|
IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND egd5.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 6), 0) AS eventMSTotal,
|
|
IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 8 AND event_status = 2 AND egd5.grid_community_id = ${communityId} ), 0 ) +
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 2), 0) AS eventFGTotal,
|
|
IFNULL((SELECT COUNT(1) FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND `status` IN (1,2,4,5) AND del_tag = 0 AND classify_id = 1), 0) AS otherTotal,
|
IFNULL((SELECT count( e.id ) 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_status = 2 AND egd.grid_community_id = ${communityId}), 0) AS eventTotal,
|
|
IFNULL((SELECT count(id) FROM com_sw_patrol_record WHERE community_id = ${communityId}), 0) AS safety
|
</select>
|
<select id="getPartyBuildIngRecord"
|
resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT t1.id, t1.create_at, t2.`name` AS classifyName, t3.nick_name AS userNickName, t4.score
|
FROM com_act_easy_photo t1
|
LEFT JOIN com_act_easy_photo_classify t2 ON t1.classify_id = t2.id
|
LEFT JOIN sys_user t3 ON t1.sponsor_id = t3.user_id
|
LEFT JOIN (SELECT * FROM com_act_easy_photo_evaluate WHERE service_type = 1) t4 ON t1.id = t4.service_id
|
WHERE t1.community_id = #{communityId} AND t1.`status` = 5 AND t1.del_tag = 0 LIMIT #{pageSize}
|
</select>
|
<select id="pageEasyPhotoApplets" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.`nick_name` userNickName,
|
u.phone sponsor_phone,
|
(SELECT count(pu.id) FROM com_act_easy_photo_user pu WHERE pu.easy_photo_id = p.id) giveThumbsUpNum,
|
(SELECT count(c.id) FROM com_act_easy_photo_comment c WHERE c.easy_photo_id =p.id) commentNum,
|
u.image_url,
|
p.happen_addr,
|
p.addr_remark,
|
su.`name` handler_name,
|
p.`status`,
|
p.`is_hide`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.activity_type,
|
p.activity_amount,
|
p.classify_id,
|
p.community_id,
|
ca.name as communityName,
|
class.`name` AS classifyName,
|
p.img_width,
|
p.img_height,
|
p.examine_at,
|
p.add_type,
|
f.id AS fid,
|
p.handle_status
|
FROM
|
com_act_easy_photo p
|
JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
LEFT JOIN com_act ca ON ca.community_id=p.community_id
|
LEFT JOIN com_act_easy_photo_classify class ON p.classify_id = class.id
|
LEFT JOIN (SELECT * FROM com_act_easy_photo_feedback WHERE `type` = 2) f ON p.id = f.easy_id
|
<where> p.del_tag = 0
|
<if test = 'comActEasyPhotoVO.communityId != null and comActEasyPhotoVO.communityId != 0' >
|
AND p.community_id = ${comActEasyPhotoVO.communityId}
|
</if>
|
<if test="comActEasyPhotoVO.addType != null and comActEasyPhotoVO.addType != ''">
|
AND p.add_type=${comActEasyPhotoVO.addType}
|
</if>
|
<if test = 'comActEasyPhotoVO.status != null and comActEasyPhotoVO.status!=0' >
|
AND p.`status` = #{comActEasyPhotoVO.status}
|
</if>
|
<if test='comActEasyPhotoVO.sponsorId != null and comActEasyPhotoVO.sponsorId != 0'>
|
AND p.sponsor_id = #{comActEasyPhotoVO.sponsorId}
|
</if>
|
<if test='comActEasyPhotoVO.sponsorId == null or comActEasyPhotoVO.sponsorId==0'>
|
AND p.`status` in (2,4,5)
|
<if test="comActEasyPhotoVO.isFeedBackForDpc == null or comActEasyPhotoVO.isDpcMember == 0">
|
AND p.is_publicity = 1
|
</if>
|
</if>
|
<if test='comActEasyPhotoVO.isReportDpc != null' >
|
AND p.`is_report_dpc` = #{comActEasyPhotoVO.isReportDpc}
|
</if>
|
<if test='comActEasyPhotoVO.keyWord != null and comActEasyPhotoVO.keyWord != ""'>
|
AND (class.`name` like concat(#{comActEasyPhotoVO.keyWord},'%') or p.detail like concat(#{comActEasyPhotoVO.keyWord},'%'))
|
</if>
|
<if test='comActEasyPhotoVO.classifyId != null and comActEasyPhotoVO.classifyId != ""'>
|
AND p.classify_id =#{comActEasyPhotoVO.classifyId}
|
</if>
|
</where>
|
group by p.id
|
<if test="comActEasyPhotoVO.isFeedBackForDpc != null">
|
HAVING
|
<if test="comActEasyPhotoVO.isFeedBackForDpc == 1">
|
fid IS NULL
|
</if>
|
<if test="comActEasyPhotoVO.isFeedBackForDpc == 2">
|
fid IS NOT NULL
|
</if>
|
</if>
|
order by p.create_at desc
|
</select>
|
<select id="getEasyPhotoAddPolylineDataForDpc"
|
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_easy_photo
|
WHERE community_id = ${communityId} AND del_tag = 0 AND is_report_dpc = 1
|
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="getEasyPhotoTotalPolylineDateForDpc"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(id) AS num FROM com_act_easy_photo
|
WHERE community_id = ${communityId} AND del_tag = 0 AND is_report_dpc = 1
|
AND DATE_FORMAT( create_at, '%Y-%m' ) <= #{date}
|
</select>
|
<select id="dpcEasyPhotoList" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT t1.id, t1.detail, t1.photo_path_list, t1.`status`, t2.`name` AS classifyName
|
FROM com_act_easy_photo t1
|
LEFT JOIN com_act_easy_photo_classify t2 ON t1.classify_id = t2.id
|
WHERE t1.community_id = ${pageBaseDTO.communityId} AND t1.`status` IN(4,5) AND t1.del_tag = 0 AND t1.is_report_dpc = 1
|
<if test="pageBaseDTO.paramId != null">
|
AND t1.classify_id = #{pageBaseDTO.paramId}
|
</if>
|
ORDER BY t1.id DESC
|
</select>
|
<select id="selectDpcBaseData"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenDpcStatisticsInfo">
|
SELECT
|
(select count(id) from com_act_dpc where community_id = ${communityId} AND is_del = 0) AS dpcNum
|
</select>
|
<select id="getBanner" resultType="com.panzhihua.common.model.vos.community.easyPhoto.BannerVO">
|
select id,type,cover,jump_url,jump_type,image_url from com_act_dyn where type=1 AND on_top=1
|
</select>
|
|
<select id="selectPhotoAll" resultType="com.panzhihua.common.model.vos.community.StatisticsPhotoVO">
|
SELECT count(1) count_num,(case `status` when 1 THEN '待处理' WHEN 2 THEN '进行中' WHEN 3 THEN '已驳回' WHEN 4 THEN '待评价' WHEN 5 THEN '已完成' ELSE '其他' END) count_name
|
FROM `com_act_easy_photo` where del_tag = 0 GROUP BY `status`
|
</select>
|
<select id="selectPhotoByMonth" resultType="com.panzhihua.common.model.vos.community.StatisticsPhotoVO">
|
SELECT count(1) count_num,(case `status` when 1 THEN '待处理' WHEN 2 THEN '进行中' WHEN 3 THEN '已驳回' WHEN 4 THEN '待评价' WHEN 5 THEN '已完成' ELSE '其他' END) count_name,date_format(create_at,'%Y-%m') as statistics_date
|
FROM `com_act_easy_photo` WHERE date_format(create_at,'%Y-%m') >= date_format(date_sub(now(), INTERVAL 9 MONTH),'%Y-%m') and del_tag = 0 GROUP BY statistics_date, `status`
|
</select>
|
|
|
|
<!-- 浪潮专用接口 -->
|
<select id="pageEasyPhotoAdminLC" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.is_report_urban,
|
p.is_report_dpc,
|
p.classify_id,
|
ca.`name` as classifyName,
|
p.examine_at,
|
c.name communityName,
|
p.urban_status,
|
p.transfer_reason,
|
p.add_type,
|
p.handle_status
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.del_tag = 0
|
and p.add_type = 1
|
AND p.`status` = 5
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
|
</select>
|
|
|
|
|
|
|
|
|
</mapper>
|