From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml |  225 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 208 insertions(+), 17 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..46eced3 100644
--- a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
+++ b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
@@ -3,27 +3,97 @@
 <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.PropertyCompanyVO">
+        <result property="id"    column="id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="name"    column="name"    />
+        <result property="address"    column="address"    />
+        <result property="socialCreditCode"    column="social_credit_code"    />
+        <result property="province"    column="province"    />
+        <result property="city"    column="city"    />
+        <result property="area"    column="area"    />
+        <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"    />
+        <result property="baseInfoScore"    column="base_info_score"    />
+        <result property="operateinfoScore"    column="operateInfo_score"    />
+        <result property="taxInfoScore"    column="tax_info_score"    />
+        <result property="partyBuildingInfoScore"    column="party_building_info_score"    />
+        <result property="goodCorporateScore"    column="good_corporate_score"    />
+        <result property="goodProjectScore"    column="good_project_score"    />
+        <result property="lllegalAndIrregularScore"    column="lllegal_and_irregular_score"    />
+        <result property="evaluateScore"    column="evaluate_score"    />
+        <result property="streetScore"    column="street_score"    />
+        <result property="allScore"    column="all_score"    />
     </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">
-        select * from jczz_property_company where is_deleted = 0
+    <select id="selectPropertyCompanyPage" resultMap="propertyCompanyResultMap">
+        SELECT
+        jpc.id,
+        jpc.dept_id,
+        jpc.NAME,
+        jpc.address,
+        jpc.social_credit_code,
+        jpc.province,
+        jpc.city,
+        jpc.area,
+        jpc.remark,
+        jpc.create_user,
+        jpc.create_time,
+        jpc.update_user,
+        jpc.update_time,
+        jpc.is_deleted,
+        jpc.base_info_score,
+        jpc.operateInfo_score,
+        jpc.tax_info_score,
+        jpc.party_building_info_score,
+        jpc.good_corporate_score,
+        jpc.good_project_score,
+        jpc.lllegal_and_irregular_score,
+        jpc.evaluate_score,
+        jpc.street_score,
+        jpc.all_score,
+        (
+        SELECT
+        GROUP_CONCAT( jd.`name` )
+        FROM
+        jczz_property_company_district jpcd
+        LEFT JOIN jczz_district jd ON jpcd.district_id = jd.id
+        WHERE
+        jpcd.property_company_id = jpc.id
+        ) districtNames
+        FROM
+        jczz_property_company jpc
+        WHERE
+        jpc.is_deleted = 0
         <if test="propertyCompany.name!=null and propertyCompany.name!=''">
-            and name like concat('%',#{propertyCompany.name},'%')
+            and jpc.name like concat('%',#{propertyCompany.name},'%')
         </if>
     </select>
 
@@ -46,5 +116,126 @@
         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 DISTINCT jpc.*,
+                        jpcd.principal,
+                        jpcd.principal_phone AS principalPhone,
+                        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 bu.real_name is not null
+          and jpc.id = #{propertyCompany.id}
+    </select>
+
+    <select id="getDetailVO" resultType="org.springblade.modules.property.vo.PropertyCompanyDetailVO">
+        SELECT
+            jpc.*
+        FROM
+            jczz_property_company jpc
+        WHERE jpc.is_deleted = 0
+          and jpc.id = #{propertyCompany.id}
+    </select>
+
+    <select id="getPropertyDistrictInfo" resultType="org.springblade.modules.property.vo.PropertyDistrictInfo">
+
+    SELECT
+        house.house_code as houseId,
+        house.house_name as houseName,
+        house.area as houseArea,
+        district.name as districtName,
+        district.id as districtId,
+        company.id as id,
+        company.dept_id as deptId,
+        company.name as propertyCompanyName,
+        charge.unit_price as unitPrice,
+        charge.calculation_formula as payCalculationFormula,
+        bdb.dict_value as payCalculationFormulaName
+    FROM jczz_house house
+    LEFT JOIN jczz_district district ON district.aoi_code = house.district_code
+    LEFT JOIN jczz_property_charge charge ON charge.district_id = district.id
+    LEFT JOIN jczz_property_company company ON company.dept_id = charge.property_id
+    LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = charge.pay_type
+
+    WHERE house.is_deleted = 0 and bdb.code = 'payCalculationFormula'
+    <if test="info.houseId != null and info.houseId !=''">
+        AND house.house_code = #{info.houseId}
+    </if>
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3