From 55d677758efadb6d42e6d4e595cecc2c50c20d5a Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Sat, 23 Dec 2023 17:19:12 +0800
Subject: [PATCH] bug修复

---
 src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml |  136 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 122 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
index 4322bbf..a9a013b 100644
--- a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
+++ b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
@@ -3,21 +3,42 @@
 <mapper namespace="org.springblade.modules.property.mapper.PropertyCompanyMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="propertyCompanyResultMap" type="org.springblade.modules.property.entity.PropertyCompanyEntity">
-        <result column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="address" property="address"/>
-        <result column="social_credit_code" property="socialCreditCode"/>
-        <result column="province" property="province"/>
-        <result column="city" property="city"/>
-        <result column="area" property="area"/>
-        <result column="remark" property="remark"/>
-        <result column="create_user" property="createUser"/>
-        <result column="create_time" property="createTime"/>
-        <result column="update_user" property="updateUser"/>
-        <result column="update_time" property="updateTime"/>
-        <result column="is_deleted" property="isDeleted"/>
+    <resultMap id="propertyCompanyResultMap" type="org.springblade.modules.property.vo.PropertyCapitalApplyVO">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="address"    column="address"    />
+        <result property="socialCreditCode"    column="social_credit_code"    />
+        <result property="provinceCode"    column="province_code"    />
+        <result property="cityCode"    column="city_code"    />
+        <result property="countyCode"    column="county_code"    />
+        <result property="remark"    column="remark"    />
+        <result property="createUser"    column="create_user"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateUser"    column="update_user"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDeleted"    column="is_deleted"    />
     </resultMap>
+
+
+    <sql id="selectPropertyCompany">
+        select
+            id,
+            name,
+            address,
+            social_credit_code,
+            province_code,
+            city_code,
+            county_code,
+            remark,
+            create_user,
+            create_time,
+            update_user,
+            update_time,
+            is_deleted
+        from
+            jczz_property_company
+    </sql>
+
 
     <!--自定义分页查询-->
     <select id="selectPropertyCompanyPage" resultType="org.springblade.modules.property.vo.PropertyCompanyVO">
@@ -46,5 +67,92 @@
         and jpc.id = #{propertyCompany.id}
     </select>
 
+    <!--查询对应的机构id集合-->
+    <select id="getDeptListByCompanyId" resultType="java.lang.Long">
+        select dept_id from jczz_property_company
+        jpc where is_deleted = 0
+        <choose>
+            <when test="list != null and list.size()>0">
+                and id in
+                <foreach collection="list" item="id" separator ="," open="("  close=")">
+                    #{id}
+                </foreach>
+            </when>
+            <otherwise>
+                and id in ('')
+            </otherwise>
+        </choose>
+    </select>
+
+
+
+    <select id="getUserCompayDistrict" resultType="org.springblade.modules.property.vo.PropertyCompanyVO">
+
+        select
+        jpc.id,
+        jpc.name,
+        jpc.address,
+        jpc.social_credit_code,
+        jpc.province_code,
+        jpc.city_code,
+        jpc.county_code,
+        jpc.remark,
+        jpc.create_user,
+        jpc.create_time,
+        jpc.update_user,
+        jpc.update_time,
+        jpc.is_deleted,
+        jpcd.principal_phone,
+        jpcd.principal
+        from
+        jczz_property_company jpc LEFT JOIN jczz_property_company_district jpcd on jpc.id=jpcd.property_company_id
+        LEFT JOIN jczz_doorplate_address jda on jpcd.district_id=jda.aoi_code
+        where jda.address_code=#{houseCode}
+<!--        <where>-->
+<!--            <if test="id != null "> and id = #{id}</if>-->
+<!--            <if test="name != null  and name != ''"> and name = #{name}</if>-->
+<!--            <if test="address != null  and address != ''"> and address = #{address}</if>-->
+<!--            <if test="socialCreditCode != null  and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>-->
+<!--            <if test="provinceCode != null  and provinceCode != ''"> and province_code = #{provinceCode}</if>-->
+<!--            <if test="cityCode != null  and cityCode != ''"> and city_code = #{cityCode}</if>-->
+<!--            <if test="countyCode != null  and countyCode != ''"> and county_code = #{countyCode}</if>-->
+<!--            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>-->
+<!--            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>-->
+<!--            <if test="createTime != null "> and create_time = #{createTime}</if>-->
+<!--            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>-->
+<!--            <if test="updateTime != null "> and update_time = #{updateTime}</if>-->
+<!--            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>-->
+<!--        </where>-->
+    </select>
+
+    <!--物业公司详情map-->
+    <resultMap id="propertyCompanyDetailMap" type="org.springblade.modules.property.vo.PropertyCompanyDetailVO" autoMapping="true">
+        <id property="id" column="id"/>
+        <collection property="districtUserVOS"  javaType="java.util.List"
+                    ofType="org.springblade.modules.property.vo.PropertyDistrictUserVO" autoMapping="true">
+            <id property="id" column="cid"/>
+            <result property="name" column="real_name"/>
+            <result property="phone" column="companyPersonPhone"/>
+        </collection>
+    </resultMap>
+
+    <!--自定义详情查询-->
+    <select id="getDetail" resultMap="propertyCompanyDetailMap">
+        SELECT
+            jpc.*,
+            jpcd.principal,
+            jpcd.principal_phone AS principalPhone,
+            jpdu.id AS cid,
+            bu.real_name,
+            bu.phone AS companyPersonPhone
+        FROM
+            jczz_property_company jpc
+            LEFT JOIN jczz_property_company_district jpcd ON jpcd.property_company_id = jpc.id and jpcd.is_deleted = 0
+            LEFT JOIN jczz_property_district_user jpdu ON jpcd.id = jpdu.property_company_district_id
+            LEFT JOIN blade_user bu ON locate(jpdu.user_id,bu.id)>0 and bu.is_deleted = 0
+        WHERE jpc.is_deleted = 0
+        and jpc.id = #{propertyCompany.id}
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3