<?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="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,operate)
|
values(#{communityId},#{bId},#{name},#{address},#{cityCode},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{operate})
|
</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)
|
values(#{communityPhotoId},#{bId},#{communityId},#{communityPhotoTypeCd},#{photo},#{month},#{operate})
|
</insert>
|
|
|
<!-- 查询小区信息(Business) 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
|
from business_community s where 1 = 1
|
<if test="operate != null and operate != ''">
|
and s.operate = #{operate}
|
</if>
|
<if test="bId != null and bId !=''">
|
and s.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId != ''">
|
and s.community_id = #{communityId}
|
</if>
|
</select>
|
|
|
<!-- 查询小区属性信息(Business) add by wuxw 2018-07-03 -->
|
<select id="getBusinessCommunityAttrs" parameterType="Map" resultType="Map">
|
select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.operate
|
from business_community_attr sa where 1=1
|
<if test="operate != null and operate != ''">
|
and sa.operate = #{operate}
|
</if>
|
<if test="bId != null and bId !=''">
|
and sa.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId != ''">
|
and sa.community_id = #{communityId}
|
</if>
|
<if test="attrId != null and attrId != ''">
|
and sa.attr_id = #{attrId}
|
</if>
|
</select>
|
|
<!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
|
<select id="getBusinessCommunityPhoto" parameterType="Map" resultType="Map">
|
select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.operate
|
from business_community_photo sp where 1=1
|
<if test="bId != null and bId !=''">
|
and sp.b_id = #{bId}
|
</if>
|
<if test="operate != null and operate != ''">
|
and sp.operate = #{operate}
|
</if>
|
<if test="communityId != null and communityId != ''">
|
and sp.community_id = #{communityId}
|
</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)
|
select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,s.map_x,s.map_y,'0'
|
from business_community s where
|
s.operate = 'ADD' and s.b_id=#{bId}
|
</insert>
|
|
<!-- 保存小区属性信息到 instance add by wuxw 2018-07-03 -->
|
<insert id="saveCommunityAttrsInstance" parameterType="Map">
|
insert into s_community_attr(b_id,attr_id,community_id,spec_cd,value,status_cd)
|
select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,'0'
|
from business_community_attr sa
|
where sa.operate = 'ADD' and sa.b_id=#{bId}
|
</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}
|
</insert>
|
|
|
<!-- 查询小区信息 add by wuxw 2018-07-03 -->
|
<select id="getCommunityInfo" 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.status_cd
|
from s_community s
|
where 1=1
|
<if test="statusCd != null and statusCd != ''">
|
and s.status_cd = #{statusCd}
|
</if>
|
|
<if test="bId != null and bId !=''">
|
and s.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and s.community_id = #{communityId}
|
</if>
|
</select>
|
|
<!-- 查询小区属性信息 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
|
from s_community_attr sa
|
where
|
1=1
|
<if test="statusCd != null and statusCd != ''">
|
and sa.status_cd = #{statusCd}
|
</if>
|
<if test="bId != null and bId !=''">
|
and sa.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and sa.community_id = #{communityId}
|
</if>
|
<if test="attrId != null and attrId != ''">
|
and sa.attr_id = #{attrId}
|
</if>
|
</select>
|
|
<!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
|
<select id="getCommunityPhoto" parameterType="Map" resultType="Map">
|
select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.status_cd
|
from s_community_photo sp
|
where 1=1
|
<if test="statusCd != null and statusCd != ''">
|
and sp.status_cd = #{statusCd}
|
</if>
|
<if test="bId != null and bId !=''">
|
and sp.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and sp.community_id = #{communityId}
|
</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>
|
<if test="address != null and address != ''">
|
,s.address = #{address}
|
</if>
|
<if test="cityCode != null and cityCode != ''">
|
,s.city_code = #{cityCode}
|
</if>
|
<if test="nearbyLandmarks != null and nearbyLandmarks != ''">
|
,s.nearby_landmarks = #{nearbyLandmarks}
|
</if>
|
<if test="mapX != null and mapX != ''">
|
,s.map_x = #{mapX}
|
</if>
|
<if test="mapY != null and mapY != ''">
|
,s.map_y = #{mapY}
|
</if>
|
where 1=1
|
<if test="bId != null and bId !=''">
|
and s.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and s.community_id = #{communityId}
|
</if>
|
</update>
|
|
<!-- 修改小区属性信息 add by wuxw 2018-07-03 -->
|
<update id="updateCommunityAttrInstance" parameterType="Map">
|
update s_community_attr sa set sa.status_cd = #{statusCd}
|
<if test="newBId != null and newBId != ''">
|
,sa.b_id = #{newBId}
|
</if>
|
<if test="value != null and value != ''">
|
,sa.value = #{value}
|
</if>
|
where 1=1
|
<if test="bId != null and bId !=''">
|
and sa.b_id = #{bId}
|
</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="attrId != null and attrId !=''">
|
and sa.attr_id = #{attrId}
|
</if>
|
</update>
|
|
<!-- 修改小区照片信息 add by wuxw 2018-07-03 -->
|
<update id="updateCommunityPhotoInstance" parameterType="Map">
|
update s_community_photo sp set sp.status_cd = #{statusCd}
|
<if test="newBId != null and newBId != ''">
|
,sp.b_id = #{newBId}
|
</if>
|
<if test="communityPhotoTypeCd != null and communityPhotoTypeCd != ''">
|
,sp.community_photo_type_cd = #{communityPhotoTypeCd}
|
</if>
|
<if test="photo != null and photo != ''">
|
,sp.photo = #{photo}
|
</if>
|
where 1=1
|
<if test="bId != null and bId !=''">
|
and sp.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId !=''">
|
and sp.community_id = #{communityId}
|
</if>
|
<if test="communityPhotoId != null and communityPhotoId !=''">
|
and sp.community_photo_id = #{communityPhotoId}
|
</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>
|
|
<!-- 小区成员加入 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
|
from business_community_member ms where
|
ms.operate = 'ADD' and ms.b_id=#{bId}
|
</insert>
|
|
<!-- 查询小区成员 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
|
from business_community_member ms where 1 = 1
|
<if test="operate != null and operate != ''">
|
and ms.operate = #{operate}
|
</if>
|
<if test="bId != null and bId !=''">
|
and ms.b_id = #{bId}
|
</if>
|
<if test="communityId != null and communityId != ''">
|
and ms.community_id = #{communityId}
|
</if>
|
</select>
|
|
|
<!-- 查询小区成员 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,
|
ms.audit_status_cd auditStatusCd
|
from s_community_member ms
|
where 1=1
|
<if test="statusCd != null and statusCd != ''">
|
and ms.status_cd = #{statusCd}
|
</if>
|
|
<if test="bId != null and bId !=''">
|
and ms.b_id = #{bId}
|
</if>
|
<if test="communityMemberId != null and communityMemberId !=''">
|
and ms.community_member_id = #{communityMemberId}
|
</if>
|
<if test="memberId != null and memberId != ''">
|
and ms.member_id = #{memberId}
|
</if>
|
<if test="memberTypeCd != null and memberTypeCd != ''">
|
and ms.member_type_cd = #{memberTypeCd}
|
</if>
|
<if test="auditStatusCd != null and auditStatusCd != ''">
|
and ms.audit_status_cd = #{auditStatusCd}
|
</if>
|
|
<if test="communityId != null and communityId != ''">
|
and ms.community_id = #{communityId}
|
</if>
|
</select>
|
|
<!-- 修改小区成员 add by wuxw 2018-07-03 -->
|
<update id="updateCommunityMemberInstance" parameterType="Map">
|
update s_community_member ms set ms.status_cd = #{statusCd}
|
<if test="newBId != null and newBId != ''">
|
,ms.b_id = #{newBId}
|
</if>
|
<if test="auditStatusCd !=null and auditStatusCd !=''">
|
,ms.audit_status_cd = #{auditStatusCd}
|
</if>
|
where 1=1
|
<if test="bId != null and bId !=''">
|
and ms.b_id = #{bId}
|
</if>
|
<if test="communityMemberId != null and communityMemberId !=''">
|
and ms.community_member_id = #{communityMemberId}
|
</if>
|
</update>
|
|
|
<!-- 查询小区成员 add by wuxw 2018-07-03 -->
|
<select id="getCommunityMemberCount" parameterType="Map" resultType="Map">
|
select count(1) count
|
from s_community_member ms
|
where 1=1
|
<if test="statusCd != null and statusCd != ''">
|
and ms.status_cd = #{statusCd}
|
</if>
|
|
<if test="bId != null and bId !=''">
|
and ms.b_id = #{bId}
|
</if>
|
<if test="communityMemberId != null and communityMemberId !=''">
|
and ms.community_member_id = #{communityMemberId}
|
</if>
|
<if test="memberId != null and memberId != ''">
|
and ms.member_id = #{memberId}
|
</if>
|
<if test="memberTypeCd != null and memberTypeCd != ''">
|
and ms.member_type_cd = #{memberTypeCd}
|
</if>
|
<if test="auditStatusCd != null and auditStatusCd != ''">
|
and ms.audit_status_cd = #{auditStatusCd}
|
</if>
|
|
<if test="communityId != null and communityId != ''">
|
and ms.community_id = #{communityId}
|
</if>
|
</select>
|
|
</mapper>
|