<?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="org.springblade.modules.property.mapper.PropertyCompanyMapper">
|
|
<!-- 通用查询映射结果 -->
|
<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">
|
select * from jczz_property_company where is_deleted = 0
|
<if test="propertyCompany.name!=null and propertyCompany.name!=''">
|
and name like concat('%',#{propertyCompany.name},'%')
|
</if>
|
</select>
|
|
<!--物业公司列表查询(不分页)-->
|
<select id="getPropertyCompanyList" resultType="org.springblade.modules.property.vo.PropertyCompanyVO">
|
select * from jczz_property_company where is_deleted = 0
|
<if test="propertyCompany.name!=null and propertyCompany.name!=''">
|
and name like concat('%',#{propertyCompany.name},'%')
|
</if>
|
</select>
|
|
<!--物业公司列表查询(不分页)-->
|
<select id="getUserByPropertyCompany" resultType="java.util.Map">
|
select
|
bu.id,bu.real_name as name
|
from blade_user bu
|
left join blade_dept bd on bd.id = bu.dept_id and bd.is_deleted = 0
|
left join jczz_property_company jpc on jpc.dept_id = bd.id and jpc.is_deleted = 0
|
where bu.is_deleted = 0 and bu.real_name is not null
|
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 bu.real_name is not null
|
and jpc.id = #{propertyCompany.id}
|
</select>
|
|
<select id="getDetailVO" resultType="org.springblade.modules.property.vo.PropertyCompanyDetailVO">
|
SELECT
|
jpc.*,
|
jpcd.principal,
|
jpcd.principal_phone AS principalPhone,
|
jpdu.id AS cid
|
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
|
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>
|