linwei
2024-02-22 7bcd0d2d7510cb2ba67099cd768e1b2b6d047dc2
src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
@@ -123,13 +123,71 @@
<!--            <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 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>