123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?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="com.huiju.estateagents.mapper.TaPreselectionRecordMapper">
-
- <select id="listPreselectionRecord" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
- SELECT
- t3.*,
- t4.building_name,
- t5.`status` saleBatchStatus
- FROM
- (
- SELECT
- t.preselection_record_id,
- t.person_id,
- t.org_id,
- t.house_id,
- t.`status`,
- t.create_date,
- t2.block_name,
- t2.unit_name,
- t2.floor_name,
- t2.room_name,
- t2.price,
- t2.apartment_id,
- t2.building_id buildingId,
- t2.`status` housingStatus,
- t2.sales_batch_id saleBatchId
- FROM
- ta_preselection_record t,
- ta_housing_resources t2
- WHERE
- t.person_id = #{personId}
- AND t.org_id = #{orgId}
- AND t.house_id = t2.house_id
- ORDER BY
- t.create_date DESC
- ) t3
- LEFT JOIN ta_building t4 ON t3.buildingId = t4.building_id
- LEFT JOIN ta_sales_batch t5 ON t3.saleBatchId = t5.sales_batch_id
- </select>
-
- <select id="getRecordByPersonIdAndHouseId" resultType="com.huiju.estateagents.entity.TaPreselectionRecord">
- SELECT
- t.*
- FROM
- ta_preselection_record t
- WHERE
- t.person_id = #{personId}
- AND t.house_id = #{houseId}
- </select>
-
- <select id="selectPreSelectRecordList" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
- select t.house_id,
- a.block_id as blockName,
- a.unit_id as unitName,
- a.floor_id as floorName,
- a.room_id as roomName,
- a.apartment_id,
- b.nickname as nameOrnick,
- b.`name`,
- b.avatarurl,
- b.phone,
- t.`status`,
- t.update_date,
- (select name from ta_person t where (t.user_id = t.update_user || t.person_id = t.update_user)) as updateName
- from ta_preselection_record t
- left join ta_housing_resources a on t.house_id = a.house_id
- left join ta_person b on t.person_id = b.person_id
- where b.org_id = #{orgId} and a.sales_batch_id = #{salesBatchId}
- <if test="houseId != null and houseId !=''">
- and t.house_id = #{houseId}
- </if>
- <if test="phone != null and phone != ''">
- and b.phone = #{phone}
- </if>
- <if test="apartmentId != null and apartmentId != ''">
- and a.apartment_id = #{apartmentId}
- </if>
- <if test="status != null">
- and t.status = #{status}
- </if>
- </select>
-
- </mapper>
|