From f14c50cb0036d3ddd655ce4e34732ba396a836c4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:42:03 +0800
Subject: [PATCH] optimize 统计
---
java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml | 76 ++++++++++++++++++++++++++-----------
1 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
index c505cdf..564f1a5 100755
--- a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
@@ -12,6 +12,11 @@
#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{state},#{operate},#{communityArea},#{tel})
</insert>
+ <!-- 淇濆瓨灏忓尯灞炴�т俊鎭� add by wuxw 2018-07-03 -->
+ <insert id="saveCommunityAttr" parameterType="Map">
+ insert into s_community_attr(b_id,attr_id,community_id,spec_cd,value,month,status_cd)
+ values(#{bId},#{attrId},#{communityId},#{specCd},#{value},#{month},#{statusCd})
+ </insert>
<!-- 淇濆瓨灏忓尯灞炴�т俊鎭� add by wuxw 2018-07-03 -->
@@ -30,7 +35,7 @@
<!-- 鏌ヨ灏忓尯淇℃伅锛圔usiness锛� add by wuxw 2018-07-03 -->
<select id="getBusinessCommunityInfo" parameterType="Map" resultType="Map">
select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,
- s.map_x,s.map_y,s.operate,s.state,s.community_area communityArea,s.community_area
+ s.map_x,s.map_y,s.operate,s.state,s.community_area communityArea,s.community_area,s.tel
from business_community s where 1 = 1
<if test="operate != null and operate != ''">
and s.operate = #{operate}
@@ -79,8 +84,8 @@
<!-- 淇濆瓨灏忓尯淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveCommunityInfoInstance" parameterType="Map">
insert into
- s_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,status_cd,state,community_area)
- values(#{community_id},#{b_id},#{name},#{address},#{city_code},#{nearby_landmarks},#{map_x},#{map_y},'0',#{state},#{communityArea})
+ s_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,status_cd,state,community_area,tel)
+ values(#{community_id},#{b_id},#{name},#{address},#{city_code},#{nearby_landmarks},#{map_x},#{map_y},'0',#{state},#{communityArea},#{tel})
</insert>
<!-- 淇濆瓨灏忓尯灞炴�т俊鎭埌 instance add by wuxw 2018-07-03 -->
@@ -130,8 +135,8 @@
s.list_show listShow
from s_community_attr sa
left join attr_spec s on sa.spec_cd = s.spec_cd and s.status_cd = '0' and s.table_name =
- 'building_community_attr'
- left join attr_value v on sa.`value` = v.`value` and sa.spec_cd = v.spec_cd and v.status_cd = '0'
+ 'building_community_attr' and sa.spec_cd = s.spec_cd
+ left join attr_value v on sa.`value` = v.`value` and s.spec_id = v.spec_id and v.status_cd = '0'
where
1=1
<if test="statusCd != null and statusCd != ''">
@@ -142,6 +147,12 @@
</if>
<if test="communityId != null and communityId !=''">
and sa.community_id = #{communityId}
+ </if>
+ <if test="specCd != null and specCd !=''">
+ and sa.spec_cd = #{specCd}
+ </if>
+ <if test="value != null and value !=''">
+ and sa.value = #{value}
</if>
<if test="communityIds != null ">
and sa.community_id in
@@ -197,7 +208,9 @@
<if test="state != null and state != ''">
,s.state = #{state}
</if>
- ,s.tel = #{tel}
+ <if test="tel != null and tel != ''">
+ ,s.tel = #{tel}
+ </if>
<if test="communityArea != null and communityArea != ''">
,s.community_area = #{communityArea}
</if>
@@ -262,15 +275,15 @@
<!--灏忓尯鎴愬憳鍔犲叆 add by wuxw 2018-10-27 saveBusinessCommunityMember-->
<insert id="saveBusinessCommunityMember" parameterType="Map">
insert into
- business_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,month,operate,audit_status_cd)
- values(#{communityMemberId},#{bId},#{communityId},#{memberId},#{memberTypeCd},#{month},#{operate},#{auditStatusCd})
+ business_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,month,operate,audit_status_cd,start_time,end_time)
+ values(#{communityMemberId},#{bId},#{communityId},#{memberId},#{memberTypeCd},#{month},#{operate},#{auditStatusCd},#{startTime},#{endTime})
</insert>
<!-- 灏忓尯鎴愬憳鍔犲叆 instance琛ㄤ腑 add by wuxw 2018-10-27 -->
<insert id="saveCommunityMemberInstance" parameterType="Map">
insert into
- s_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,status_cd,audit_status_cd)
- select ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,'0',ms.audit_status_cd
+ s_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,status_cd,audit_status_cd,start_time,end_time)
+ select ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,'0',ms.audit_status_cd,ms.start_time,ms.end_time
from business_community_member ms where
ms.operate = 'ADD' and ms.b_id=#{bId}
<if test="communityId != null and communityId != ''">
@@ -281,7 +294,7 @@
<!-- 鏌ヨ灏忓尯鎴愬憳 add by wuxw 2018-10-27 getBusinessCommunityMember-->
<select id="getBusinessCommunityMember" parameterType="Map" resultType="Map">
select
- ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.operate,ms.audit_status_cd
+ ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.operate,ms.audit_status_cd,ms.start_time,ms.end_time
from business_community_member ms where 1 = 1
<if test="operate != null and operate != ''">
and ms.operate = #{operate}
@@ -302,6 +315,7 @@
ms.community_member_id communityMemberId ,ms.b_id bId,ms.community_id communityId,ms.member_id
memberId,ms.member_type_cd memberTypeCd,ms.status_cd statusCd,
ms.audit_status_cd auditStatusCd,
+ ms.start_time,ms.end_time,ms.start_time startTime,ms.end_time endTime,
(CASE
WHEN ms.audit_status_cd='1000'
THEN '寰呭鏍�'
@@ -361,9 +375,9 @@
<if test="communityName != null and communityName != '' and needCommunityInfo == true">
and sc.name like concat('%',#{communityName},'%')
</if>
- <if test="needCommunityInfo == true">
- group by ms.community_id
- </if>
+<!-- <if test="needCommunityInfo == true">-->
+<!-- group by ms.community_id-->
+<!-- </if>-->
order by ms.create_time desc
<if test="page != -1 and page != null">
limit #{page},#{row}
@@ -378,6 +392,12 @@
</if>
<if test="auditStatusCd !=null and auditStatusCd !=''">
,ms.audit_status_cd = #{auditStatusCd}
+ </if>
+ <if test="startTime !=null ">
+ ,ms.start_time = #{startTime}
+ </if>
+ <if test="endTime !=null ">
+ ,ms.end_time = #{endTime}
</if>
where 1=1
<if test="bId != null and bId !=''">
@@ -449,16 +469,16 @@
<if test="communityName != null and communityName != '' and needCommunityInfo == true">
and sc.name like concat('%',#{communityName},'%')
</if>
- <if test="needCommunityInfo == true">
- group by ms.community_id
- </if>
+<!-- <if test="needCommunityInfo == true">-->
+<!-- group by ms.community_id-->
+<!-- </if>-->
</select>
<!-- 鏌ヨ灏忓尯淇℃伅 add by wuxw 2018-07-03 -->
<select id="getCommunityInfoNew" parameterType="Map" resultType="Map">
select t.address,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,
- t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,
+ t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,t.tel,
t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.map_y,t.map_y mapY,
t.map_x,t.map_x mapX,t.state,(CASE
WHEN t.state='1000'
@@ -469,7 +489,7 @@
'瀹℃牳鎷掔粷'
END) stateName,ca.area_code areaCode,ca.area_name areaName,
ca.parent_area_code parentAreaCode,ca.parent_area_name parentAreaName,
- t.community_area communityArea
+ t.community_area communityArea,t.pay_fee_month,t.pay_fee_month payFeeMonth,t.fee_price,t.fee_price feePrice,t.qr_code qrCode
from s_community t,city_area ca
<if test="memberId !=null and memberId !=''">
,s_community_member cm
@@ -487,7 +507,10 @@
and t.city_code= #{cityCode}
</if>
<if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
+ and t.name = #{name}
+ </if>
+ <if test="nameLike !=null and nameLike != ''">
+ and t.name like concat('%',#{nameLike},'%')
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
@@ -527,10 +550,12 @@
#{item}
</foreach>
</if>
- group by t.community_id
+<!-- group by t.community_id-->
+ order by t.create_time ASC
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
+
</select>
@@ -613,10 +638,13 @@
scm.`member_type_cd` memberTypeCd,
scm.audit_status_cd auditStatusCd,
scm.`status_cd` statusCd,
+ scm.`start_time` startTime,
+ scm.`end_time` endTime,
ca.area_name areaName,
ca.parent_area_name cityName,
ca1.parent_area_name provName,
- sc.community_area communityArea
+ sc.community_area communityArea,
+ sc.qr_code qrCode
FROM
s_community sc,
s_community_member scm,
@@ -636,6 +664,8 @@
<if test="auditStatusCd !=null and auditStatusCd !=''">
and scm.audit_status_cd = #{auditStatusCd}
</if>
- group by sc.community_id
+ <if test="communityId != null and communityId != ''">
+ and sc.community_id = #{communityId}
+ </if>
</select>
</mapper>
--
Gitblit v1.8.0