From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能
---
java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml | 258 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 215 insertions(+), 43 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index 0080e9a..6b78daf
--- a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
@@ -3,27 +3,39 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="communityServiceDaoImpl">
-
+
<!-- 淇濆瓨灏忓尯淇℃伅 add by wuxw 2018-07-03 -->
<insert id="saveBusinessCommunityInfo" parameterType="Map">
- insert into business_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,month,state,operate)
- values(#{communityId},#{bId},#{name},#{address},#{cityCode},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{state},#{operate})
+ insert into business_community(community_id,b_id,name,address,city_code,
+ nearby_landmarks,map_x,map_y,month,state,operate,community_area,tel)
+ values(#{communityId},#{bId},#{name},#{address},#{cityCode},
+ #{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 -->
<insert id="saveBusinessCommunityAttr" parameterType="Map">
insert into business_community_attr(b_id,attr_id,community_id,spec_cd,value,month,operate)
values(#{bId},#{attrId},#{communityId},#{specCd},#{value},#{month},#{operate})
</insert>
+
<!-- 淇濆瓨灏忓尯鐓х墖淇℃伅 add by wuxw 2018-07-03 -->
<insert id="saveBusinessCommunityPhoto" parameterType="Map">
- insert into business_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,month,operate)
+ insert into
+ business_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,month,operate)
values(#{communityPhotoId},#{bId},#{communityId},#{communityPhotoTypeCd},#{photo},#{month},#{operate})
</insert>
-
<!-- 鏌ヨ灏忓尯淇℃伅锛圔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
+ 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.tel
from business_community s where 1 = 1
<if test="operate != null and operate != ''">
and s.operate = #{operate}
@@ -35,7 +47,6 @@
and s.community_id = #{communityId}
</if>
</select>
-
<!-- 鏌ヨ灏忓尯灞炴�т俊鎭紙Business锛� add by wuxw 2018-07-03 -->
<select id="getBusinessCommunityAttrs" parameterType="Map" resultType="Map">
@@ -70,11 +81,11 @@
</if>
</select>
-
<!-- 淇濆瓨灏忓尯淇℃伅鑷� 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)
- values(#{community_id},#{b_id},#{name},#{address},#{city_code},#{nearby_landmarks},#{map_x},#{map_y},'0',#{state})
+ insert into
+ 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 -->
@@ -87,18 +98,17 @@
and sa.community_id = #{communityId}
</if>
</insert>
-
+
<!-- 淇濆瓨 灏忓尯鐓х墖淇℃伅 instance add by wuxw 2018-07-03 -->
<insert id="saveCommunityPhotoInstance" parameterType="Map">
insert into s_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,status_cd)
select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,'0'
from business_community_photo sp
- where sp.operate = 'ADD' and sp.b_id=#{bId}
+ where sp.operate = 'ADD' and sp.b_id=#{bId}
<if test="communityId != null and communityId != ''">
and sp.community_id = #{communityId}
</if>
</insert>
-
<!-- 鏌ヨ灏忓尯淇℃伅 add by wuxw 2018-07-03 -->
<select id="getCommunityInfo" parameterType="Map" resultType="Map">
@@ -108,7 +118,6 @@
<if test="statusCd != null and statusCd != ''">
and s.status_cd = #{statusCd}
</if>
-
<if test="bId != null and bId !=''">
and s.b_id = #{bId}
</if>
@@ -119,8 +128,15 @@
<!-- 鏌ヨ灏忓尯灞炴�т俊鎭� add by wuxw 2018-07-03 -->
<select id="getCommunityAttrs" parameterType="Map" resultType="Map">
- select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.status_cd
+ select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.status_cd,
+ sa.b_id bId,sa.attr_id attrId,sa.community_id communityId,sa.spec_cd specCd,
+ s.spec_name specName,
+ v.value_name valueName,
+ 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'
where
1=1
<if test="statusCd != null and statusCd != ''">
@@ -131,6 +147,18 @@
</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
+ <foreach collection="communityIds" item="item" index="index" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="attrId != null and attrId != ''">
and sa.attr_id = #{attrId}
@@ -153,15 +181,12 @@
</if>
</select>
-
-
<!-- 淇敼灏忓尯淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateCommunityInfoInstance" parameterType="Map">
update s_community s set s.status_cd = #{statusCd}
<if test="newBId != null and newBId != ''">
,s.b_id = #{newBId}
</if>
-
<if test="name != null and name != ''">
,s.name = #{name}
</if>
@@ -182,6 +207,12 @@
</if>
<if test="state != null and state != ''">
,s.state = #{state}
+ </if>
+ <if test="tel != null and tel != ''">
+ ,s.tel = #{tel}
+ </if>
+ <if test="communityArea != null and communityArea != ''">
+ ,s.community_area = #{communityArea}
</if>
where 1=1
<if test="bId != null and bId !=''">
@@ -240,18 +271,19 @@
</if>
</update>
-
<!--灏忓尯鎴愬憳鍔犲叆 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})
+ insert into
+ 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
+ insert into
+ 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 != ''">
@@ -261,7 +293,8 @@
<!-- 鏌ヨ灏忓尯鎴愬憳 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
+ 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.start_time,ms.end_time
from business_community_member ms where 1 = 1
<if test="operate != null and operate != ''">
and ms.operate = #{operate}
@@ -277,9 +310,12 @@
<!-- 鏌ヨ灏忓尯鎴愬憳 add by wuxw 2018-07-03 -->
<select id="getCommunityMember" parameterType="Map" resultType="Map">
- select ms.community_member_id ,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
- 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,
+ select ms.community_member_id ,
+ ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
+ 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 '寰呭鏍�'
@@ -293,7 +329,8 @@
</if>
from s_community_member ms
<if test="needCommunityInfo == true">
- ,s_community sc
+ ,s_community sc,
+ s_community_member msc
</if>
where 1=1
<if test="needCommunityInfo == true">
@@ -311,8 +348,19 @@
<if test="communityMemberId != null and communityMemberId !=''">
and ms.community_member_id = #{communityMemberId}
</if>
- <if test="memberId != null and memberId != ''">
+ <if test="memberId != null and memberId != '' and needCommunityInfo == true">
+ AND ms.`community_id` = msc.`community_id`
+ and msc.member_id = #{memberId}
+ and msc.status_cd = '0'
+ </if>
+ <if test="memberId != null and memberId != '' and needCommunityInfo == false">
and ms.member_id = #{memberId}
+ </if>
+ <if test="subMemberId != null and subMemberId != ''">
+ and ms.member_id = #{subMemberId}
+ </if>
+ <if test="noAuditEnterCommunity == true">
+ and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
</if>
<if test="memberTypeCd != null and memberTypeCd != ''">
and ms.member_type_cd = #{memberTypeCd}
@@ -324,6 +372,13 @@
<if test="communityId != null and communityId != ''">
and ms.community_id = #{communityId}
</if>
+ <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>
+ order by ms.create_time desc
<if test="page != -1 and page != null">
limit #{page},#{row}
</if>
@@ -338,6 +393,12 @@
<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 !=''">
and ms.b_id = #{bId}
@@ -350,10 +411,11 @@
<!-- 鏌ヨ灏忓尯鎴愬憳 add by wuxw 2018-07-03 -->
<select id="getCommunityMemberCount" parameterType="Map" resultType="Map">
- select count(1) count
+ select ms.community_id,count(1) count
from s_community_member ms
<if test="needCommunityInfo == true">
- ,s_community sc
+ ,s_community sc,
+ s_community_member msc
</if>
where 1=1
<if test="needCommunityInfo == true">
@@ -371,9 +433,23 @@
<if test="communityMemberId != null and communityMemberId !=''">
and ms.community_member_id = #{communityMemberId}
</if>
- <if test="memberId != null and memberId != ''">
+ <if test="memberId != null and memberId != '' and needCommunityInfo == true">
+ AND ms.`community_id` = msc.`community_id`
+ and msc.member_id = #{memberId}
+ and msc.status_cd = '0'
+ </if>
+ <if test="memberId != null and memberId != '' and needCommunityInfo == false">
and ms.member_id = #{memberId}
</if>
+
+ <if test="subMemberId != null and subMemberId != ''">
+ and ms.member_id = #{subMemberId}
+ </if>
+
+ <if test="noAuditEnterCommunity == true">
+ and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
+ </if>
+
<if test="memberTypeCd != null and memberTypeCd != ''">
and ms.member_type_cd = #{memberTypeCd}
</if>
@@ -381,15 +457,28 @@
and ms.audit_status_cd = #{auditStatusCd}
</if>
+ <if test="auditStatusCds != null and auditStatusCds != null">
+ and ms.audit_status_cd in
+ <foreach collection="auditStatusCds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="communityId != null and communityId != ''">
and ms.community_id = #{communityId}
</if>
+ <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>
+
</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,
+ 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.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'
@@ -398,12 +487,16 @@
THEN '瀹℃牳瀹屾垚'
ELSE
'瀹℃牳鎷掔粷'
- END) stateName
- from s_community t
+ 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.pay_fee_month,t.pay_fee_month payFeeMonth,t.fee_price,t.fee_price feePrice
+ from s_community t,city_area ca
<if test="memberId !=null and memberId !=''">
,s_community_member cm
</if>
- where 1 =1
+ where t.status_cd = '0'
+ and t.city_code = ca.area_code
+ and ca.status_cd = '0'
<if test="address !=null and address != ''">
and t.address= #{address}
</if>
@@ -414,13 +507,22 @@
and t.city_code= #{cityCode}
</if>
<if test="name !=null and name != ''">
- and t.name= #{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}
</if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
+ </if>
+ <if test="communityIds !=null">
+ and t.community_id in
+ <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
@@ -439,6 +541,17 @@
and cm.member_id = #{memberId}
and cm.status_cd = '0'
</if>
+ <if test="memberId !=null and memberId !='' and auditStatusCd != null and auditStatusCd !=''">
+ and cm.audit_status_cd = #{auditStatusCd}
+ </if>
+ <if test="notInCommunityId != null ">
+ and t.community_id not in
+ <foreach collection="notInCommunityId" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
+ group by t.community_id
+ order by t.create_time ASC
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
@@ -446,15 +559,16 @@
</select>
-
<!-- 鏌ヨ灏忓尯鏁伴噺 add by wuxw 2018-07-03 -->
<select id="queryCommunitysCount" parameterType="Map" resultType="Map">
- select count(1) count
- from s_community t
+ select count(DISTINCT(t.community_id)) count
+ from s_community t,city_area ca
<if test="memberId !=null and memberId !=''">
,s_community_member cm
</if>
where 1 =1
+ and t.city_code = ca.area_code
+ and ca.status_cd = '0'
<if test="address !=null and address != ''">
and t.address= #{address}
</if>
@@ -465,13 +579,19 @@
and t.city_code= #{cityCode}
</if>
<if test="name !=null and name != ''">
- and t.name= #{name}
+ and t.name like concat('%',#{name},'%')
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
</if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
+ </if>
+ <if test="communityIds !=null">
+ and t.community_id in
+ <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
@@ -487,10 +607,62 @@
</if>
<if test="memberId !=null and memberId !=''">
and cm.community_id = t.community_id
- and cm.member_id = #{memberId}
- and cm.status_cd = '0'
+ and cm.member_id = #{memberId}
+ and cm.status_cd = '0'
+ </if>
+ <if test="memberId !=null and memberId !='' and auditStatusCd != null and auditStatusCd !=''">
+ and cm.audit_status_cd = #{auditStatusCd}
+ </if>
+ <if test="notInCommunityId != null ">
+ and t.community_id not in
+ <foreach collection="notInCommunityId" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
</select>
+ <!-- 鏌ヨ鍟嗘埛灏忓尯 -->
+ <select id="getStoreCommunitys" parameterType="Map" resultType="Map">
+ SELECT
+ sc.`community_id` communityId,
+ sc.`name`,
+ sc.`address`,
+ sc.`nearby_landmarks` nearbyLandmarks,
+ sc.`city_code` cityCode,
+ sc.`map_x` mapX,
+ sc.`map_y` mapY,
+ sc.tel,
+ scm.`community_member_id` communityMemberId,
+ scm.`member_id` memberId,
+ 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
+ FROM
+ s_community sc,
+ s_community_member scm,
+ city_area ca,
+ city_area ca1
+ WHERE
+ sc.`community_id` = scm.`community_id`
+ AND sc.`status_cd` = '0'
+ and sc.city_code = ca.area_code
+ and ca.parent_area_code = ca1.area_code
+ AND scm.`member_id` = #{memberId}
+ AND scm.`member_type_cd` = #{memberTypeCd}
+ AND scm.`status_cd` = '0'
+ <if test="auditStatusCd ==null or auditStatusCd ==''">
+ and scm.audit_status_cd in ('1000', '1100','1200')
+ </if>
+ <if test="auditStatusCd !=null and auditStatusCd !=''">
+ and scm.audit_status_cd = #{auditStatusCd}
+ </if>
+ group by sc.community_id
+ </select>
</mapper>
--
Gitblit v1.8.0