123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?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.TaHousingResourcesMapper">
-
- <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
- SELECT
- *
- FROM
- (
- SELECT
- t.house_id,
- t.building_id,
- t.block_id,
- t.block_name,
- t.sales_batch_id,
- t.unit_id,
- t.unit_name,
- t.floor_id,
- t.floor_name,
- t.room_id,
- t.room_name,
- t.price,
- t.heat,
- t.real_heat,
- t.apartment_id,
- t.`status`,
- t.org_id,
- t2.inside_area,
- t2.building_area,
- t2.apartment_name,
- t3.term_id,
- t4.term_name termName
- FROM
- ta_housing_resources t
- LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
- LEFT JOIN ta_building_block t3 ON t.block_id = t3.block_id
- LEFT JOIN ta_building_term t4 ON t3.term_id = t4.term_id
- WHERE
- t.sales_batch_id = #{salesBatchId}
- <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
- AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
- </if>
- <if test="apartmentId != null and apartmentId != ''">
- AND t.apartment_id = #{apartmentId}
- </if>
- AND t.org_id = #{orgId}
- AND t.`status` > -1
- ) t5
- ORDER BY
- t5.termName,
- t5.block_name,
- t5.unit_name,
- t5.floor_name DESC,
- t5.room_name
- </select>
-
- <select id="listBuildApartmentBySalesBatchId" resultType="com.huiju.estateagents.entity.TaBuildingApartment">
- SELECT
- t3.apartment_id,
- t3.apartment_name,
- t3.apartment_type,
- t3.inside_area,
- t3.building_area
- FROM
- ( SELECT t.sales_batch_id, t.apartment_id FROM ta_housing_resources t WHERE t.sales_batch_id = #{salesBatchId} GROUP BY t.apartment_id ) t2
- LEFT JOIN ta_building_apartment t3 ON t2.apartment_id = t3.apartment_id
- ORDER BY
- t3.apartment_name
- </select>
-
- <update id="updateForAddHeat" parameterType="java.lang.String">
- UPDATE ta_housing_resources t
- SET t.real_heat = t.real_heat + 1
- WHERE
- t.house_id = #{houseId}
- AND t.real_heat >= 0
- </update>
-
- <update id="updateForSubtractHeat" parameterType="java.lang.String">
- UPDATE ta_housing_resources t
- SET t.real_heat = t.real_heat - 1
- WHERE
- t.house_id = #{houseId}
- AND t.real_heat > 0
- </update>
-
- <select id="getHousingDetailById" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
- SELECT
- t.house_id,
- t.building_id,
- t.block_id,
- t.block_name,
- t.sales_batch_id,
- t.unit_id,
- t.unit_name,
- t.floor_id,
- t.floor_name,
- t.room_id,
- t.room_name,
- t.price,
- t.heat,
- t.real_heat,
- t.apartment_id,
- t.`status`,
- t.org_id,
- t2.apartment_name,
- t2.inside_area,
- t2.building_area,
- t3.preselection_start_time,
- t3.preselection_end_time,
- t3.`status` saleBatchStatus,
- t4.building_name buildingName
- FROM
- ta_housing_resources t
- LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
- LEFT JOIN ta_sales_batch t3 ON t.sales_batch_id = t3.sales_batch_id
- LEFT JOIN ta_building t4 ON t.building_id = t4.building_id
- WHERE
- t.house_id = #{houseId}
- <if test="type != null and type == '1' ">
- AND t.`status` = 1
- AND t3.`status` = 1
- </if>
- </select>
-
- <select id="getHouseResourceList" resultType="com.huiju.estateagents.entity.TaHousingResources">
- SELECT
- t.* ,
- a.apartment_name,
- u.user_name
- FROM
- ta_housing_resources t
- LEFT JOIN ta_building_apartment a ON t.apartment_id = a.apartment_id
- LEFT JOIN ta_user u on t.update_user = u.user_id
- WHERE t.`status` > -1
- AND t.org_id = #{orgId}
- and t.building_id = #{buildingId}
- and t.sales_batch_id = #{salesBatchId}
- <if test="apartmentId != null and apartmentId != ''">
- AND t.apartment_id = #{apartmentId}
- </if>
- <if test="status != null and status != ''">
- AND t.status = #{status}
- </if>
- <if test="houseId != null and houseId != ''">
- AND t.house_id like CONCAT('%',#{houseId}, '%')
- </if>
- <if test="termName != null and termName != ''">
- AND t.term_name like CONCAT('%',#{termName}, '%')
- </if>
- <if test="blockName != null and blockName != ''">
- AND t.block_name like CONCAT('%',#{blockName}, '%')
- </if>
- <if test="unitName != null and unitName != ''">
- AND t.unit_name like CONCAT('%',#{unitName}, '%')
- </if>
- <if test="floorName != null and floorName != ''">
- AND t.floor_name like CONCAT('%',#{floorName}, '%')
- </if>
- <if test="roomName != null and roomName != ''">
- AND t.room_name like CONCAT('%',#{roomName}, '%')
- </if>
- </select>
-
- </mapper>
|