mrzcc
2020-02-19 9efb739152062fed7a1b073cbb0034d519283f2d
java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
@@ -6,8 +6,8 @@
    
    <!-- 保存小区信息 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 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>
    <!-- 保存小区属性信息  add by wuxw 2018-07-03 -->
    <insert id="saveBusinessCommunityAttr" parameterType="Map">
@@ -23,7 +23,7 @@
    <!-- 查询小区信息(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
        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
        from business_community s where 1 = 1
        <if test="operate != null and operate != ''">
            and s.operate = #{operate}
@@ -73,8 +73,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)
        values(#{community_id},#{b_id},#{name},#{address},#{city_code},#{nearby_landmarks},#{map_x},#{map_y},'0')
        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>
    <!-- 保存小区属性信息到 instance add by wuxw 2018-07-03 -->
@@ -102,7 +102,7 @@
    <!-- 查询小区信息 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
        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,s.state
        from s_community s
        where 1=1
        <if test="statusCd != null and statusCd != ''">
@@ -179,6 +179,9 @@
        </if>
        <if test="mapY != null and mapY != ''">
            ,s.map_y = #{mapY}
        </if>
        <if test="state != null and state != ''">
            ,s.state = #{state}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
@@ -274,11 +277,31 @@
    <!-- 查询小区成员  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,
        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.audit_status_cd auditStatusCd,
        (CASE
        WHEN ms.audit_status_cd='1000'
        THEN '待审核'
        WHEN ms.audit_status_cd = '1100'
        THEN '审核完成'
        ELSE
        '审核拒绝'
        END) stateName
        <if test="needCommunityInfo == true">
            ,sc.name
        </if>
        from s_community_member ms
        <if test="needCommunityInfo == true">
            ,s_community sc,
            s_community_member msc
        </if>
        where 1=1
        <if test="needCommunityInfo == true">
            and sc.`community_id` = ms.`community_id`
            AND sc.`status_cd` = '0'
            and sc.state='1100'
        </if>
        <if test="statusCd != null and statusCd != ''">
            and ms.status_cd = #{statusCd}
        </if>
@@ -289,8 +312,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 = #{memberId}
        </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}
@@ -301,6 +335,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>
        order by ms.create_time desc
        <if test="page != -1 and page != null">
            limit #{page},#{row}
        </if>
    </select>
@@ -327,7 +368,16 @@
    <select id="getCommunityMemberCount" parameterType="Map" resultType="Map">
        select count(1) count
        from s_community_member ms
        <if test="needCommunityInfo == true">
            ,s_community sc,
            s_community_member msc
        </if>
        where 1=1
        <if test="needCommunityInfo == true">
            and sc.`community_id` = ms.`community_id`
            AND sc.`status_cd` = '0'
            and sc.state='1100'
        </if>
        <if test="statusCd != null and statusCd != ''">
            and ms.status_cd = #{statusCd}
        </if>
@@ -338,9 +388,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 = #{memberId}
        </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>
@@ -348,9 +412,155 @@
            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>
    </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.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'
        THEN '待审核'
        WHEN t.state = '1100'
        THEN '审核完成'
        ELSE
        '审核拒绝'
        END) stateName
        from s_community t
        <if test="memberId !=null and memberId !=''">
            ,s_community_member cm
        </if>
        where 1 =1
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
            and t.nearby_landmarks= #{nearbyLandmarks}
        </if>
        <if test="cityCode !=null and cityCode != ''">
            and t.city_code= #{cityCode}
        </if>
        <if test="name !=null and 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}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="memberId !=null and memberId !=''">
            and cm.community_id = t.community_id
            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>
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 查询小区数量 add by wuxw 2018-07-03 -->
    <select id="queryCommunitysCount" parameterType="Map" resultType="Map">
        select  count(1) count
        from s_community t
        <if test="memberId !=null and memberId !=''">
            ,s_community_member cm
        </if>
        where 1 =1
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
            and t.nearby_landmarks= #{nearbyLandmarks}
        </if>
        <if test="cityCode !=null and cityCode != ''">
            and t.city_code= #{cityCode}
        </if>
        <if test="name !=null and 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}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="memberId !=null and memberId !=''">
            and cm.community_id = t.community_id
            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>
</mapper>