| | |
| | | SELECT * FROM ( |
| | | SELECT id, `name`, consultation_volume, view_num |
| | | FROM com_convenient_merchants |
| | | WHERE community_id = #{pagePopularMerchantDTO.communityId} AND is_del = 0 ORDER BY (consultation_volume + consultation_volume) DESC LIMIT 100 |
| | | WHERE (community_id = #{pagePopularMerchantDTO.communityId} OR community_id = 0) AND is_del = 0 ORDER BY (consultation_volume + consultation_volume) DESC LIMIT 100 |
| | | ) temp |
| | | </select> |
| | | <select id="getIndexMerchantBaseData" |
| | | resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenMerchantStatisticsInfo"> |
| | | SELECT |
| | | (SELECT 0) AS resourceTypeNum, |
| | | (SELECT COUNT(id) FROM com_convenient_merchants WHERE community_id = #{communityId} AND is_del = 0) AS merchantNum, |
| | | (SELECT COUNT(id) FROM com_convenient_merchants WHERE (community_id = #{communityId} OR community_id = 0) AND is_del = 0) AS merchantNum, |
| | | (SELECT SUM(t1.consultation_volume) |
| | | FROM com_convenient_consultation_statistics t1 |
| | | LEFT JOIN com_convenient_merchants t2 ON t1.merchant_id = t2.id |
| | | WHERE t2.community_id = #{communityId}) AS serviceTimes |
| | | WHERE (t2.community_id = #{communityId} OR t2.community_id = 0)) AS serviceTimes |
| | | </select> |
| | | <select id="selectServiceTypeCircleData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | |
| | | FROM com_convenient_service_categories t1 |
| | | LEFT JOIN com_convenient_service_scope t2 ON t1.id = t2.service_category_id |
| | | LEFT JOIN com_convenient_merchants t3 ON t2.merchant_id = t3.id |
| | | WHERE t3.community_id = #{communityId} AND t3.is_del = 0 GROUP BY t1.id |
| | | WHERE (t3.community_id = #{communityId} OR t3.community_id = 0) AND t3.is_del = 0 GROUP BY t1.id |
| | | </select> |
| | | <select id="getServiceTimesAddPolylineData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT DATE_FORMAT( t1.statistic_date, '%m' ) AS filed, SUM(t1.consultation_volume) AS num |
| | | FROM com_convenient_consultation_statistics t1 |
| | | LEFT JOIN com_convenient_merchants t2 ON t1.merchant_id = t2.id |
| | | WHERE t2.community_id = #{communityId} AND DATE_FORMAT( t1.statistic_date, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed |
| | | WHERE (t2.community_id = #{communityId} OR t2.community_id = 0) AND DATE_FORMAT( t1.statistic_date, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed |
| | | </select> |
| | | <select id="getServiceTimesTotalPolylineDate" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT IF(SUM(t1.consultation_volume) IS NULL,0,SUM(t1.consultation_volume)) AS num |
| | | FROM com_convenient_consultation_statistics t1 |
| | | LEFT JOIN com_convenient_merchants t2 ON t1.merchant_id = t2.id |
| | | WHERE t2.community_id = #{communityId} AND DATE_FORMAT( t1.statistic_date, '%Y%m' ) <= #{date} |
| | | WHERE (t2.community_id = #{communityId} OR t2.community_id = 0) AND DATE_FORMAT( t1.statistic_date, '%Y%m' ) <= #{date} |
| | | </select> |
| | | <select id="indexMerchantList" |
| | | resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> |
| | | SELECT t1.id, t1.`name`, t1.logo, t1.introduction, GROUP_CONCAT(t2.`service_name`) serviceScope |
| | | FROM com_convenient_merchants t1 |
| | | LEFT JOIN com_convenient_service_scope t2 ON t1.id = t2.merchant_id |
| | | WHERE t1.community_id = #{pageBaseDTO.communityId} |
| | | WHERE (t1.community_id = #{pageBaseDTO.communityId} OR t1.community_id = 0) |
| | | <if test="pageBaseDTO.paramId != null"> |
| | | AND t2.service_category_id = #{pageBaseDTO.paramId} |
| | | </if> |