123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <?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.TaBuildingMapper">
- <select id="buildingList" resultType="com.huiju.estateagents.entity.TaBuilding">
- SELECT * FROM ta_building
- <where>
- status > -1
- <if test="Name != null and Name != ''">
- and (ta_building.name like concat('%',#{Name,jdbcType=VARCHAR},'%') or ta_building.building_name like concat('%',#{Name,jdbcType=VARCHAR},'%'))
- </if>
- <if test="Code != null and Code != ''">
- and ta_building.code like concat('%',#{Code,jdbcType=VARCHAR},'%')
- </if>
- <if test="startDate != null">
- and TO_DAYS(ta_building.opening_date ) = TO_DAYS(#{startDate})
- </if>
- <if test="buildingStatus != null and buildingStatus != ''">
- and ta_building.building_status = #{buildingStatus}
- </if>
- <if test="marketStatus != null and marketStatus != ''">
- and ta_building.market_status =#{marketStatus}
- </if>
- <if test="cityId != null and cityId != ''">
- and ta_building.city_id =#{cityId}
- </if>
- <if test="isMain != null and isMain != ''">
- and ta_building.is_main = #{isMain}
- </if>
- <if test="orgId != null">
- and ta_building.org_id = #{orgId}
- </if>
- </where>
- ORDER BY create_date DESC
- </select>
-
- <select id="buildingListSelect" resultType="com.huiju.estateagents.entity.TaBuilding">
- SELECT * FROM ta_building
- <where>
- status =1
- <if test="Name != null and Name != ''">
- and (ta_building.name like concat('%',#{Name,jdbcType=VARCHAR},'%') or ta_building.building_name like concat('%',#{Name,jdbcType=VARCHAR},'%'))
- </if>
- <if test="Code != null and Code != ''">
- and ta_building.code like concat('%',#{Code,jdbcType=VARCHAR},'%')
- </if>
- <if test="startDate != null">
- and TO_DAYS(ta_building.opening_date ) = TO_DAYS(#{startDate})
- </if>
- <if test="marketStatus != null and marketStatus != ''">
- and ta_building.market_status =#{marketStatus}
- </if>
- <if test="cityId != null and cityId != ''">
- and ta_building.city_id =#{cityId}
- </if>
- <if test="isMain != null and isMain != ''">
- and ta_building.is_main = #{isMain}
- </if>
- <if test="orgId != null and orgId != ''">
- and ta_building.org_id = #{orgId}
- </if>
- </where>
- ORDER BY create_date DESC
- </select>
-
- <select id="buildingAll" resultType="com.huiju.estateagents.entity.TaBuilding">
- SELECT * FROM ta_building
- where status > -1
- and org_id = #{orgId}
- </select>
-
- <select id="selectBuilding" resultType="com.huiju.estateagents.entity.TaBuilding">
- SELECT * FROM ta_building
- where building_id = #{buildingId}
- </select>
-
- <select id="selectBuildingStatistical" resultType="map">
- select
- IFNULL(sum(pv_num), 0) as pvNum,
- <if test="saveOrShare == 'save'">
- IFNULL(sum(save_num),0) as saveNum
- </if>
- <if test="saveOrShare == 'share'">
- IFNULL(sum(share_num),0) as shareNum
- </if>
- from ta_building
- where org_id = ${orgId}
- </select>
-
- <select id="selectBuildingPage" resultType="com.huiju.estateagents.entity.TaBuilding">
- SELECT
- tb.*
- FROM
- (
- select * from ta_building
- WHERE
- `status` = 1
- and org_id = #{orgId}
- <if test="cityId != null">
- AND city_id = #{cityId}
- </if>
- <if test="targets != null and targets.size > 0">
- AND building_id IN
- <foreach collection="targets" item="buildingId" open="(" close=")" separator=",">
- #{buildingId}
- </foreach>
- </if>
- <if test="name != null and name !=''">
- AND `name` LIKE CONCAT('%',#{name},'%')
- OR `building_name` LIKE CONCAT('%',#{name},'%')
- </if>
- ) as tb
-
- <if test="(priceList != null and priceList.size > 0) or (buildingTypeList != null and buildingTypeList.length > 0)">
- INNER JOIN
- (
- SELECT * FROM ta_building_project_type
- <trim prefix="where" prefixOverrides="and | or">
-
- <if test="priceList != null">
- <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
- (
- <if test='priceArr[0] != null and priceArr[0] != ""'>
- <![CDATA[ price >= ${priceArr[0]} ]]>
- </if>
- <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
- AND
- </if>
- <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
- <![CDATA[ price <= ${priceArr[1]} ]]>
- </if>
- )
- </foreach>
- </if>
-
- <if test="buildingTypeList != null and buildingTypeList.length > 0">
- AND building_type_id in
- <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">
- #{buildingType}
- </foreach>
- </if>
- </trim>
- GROUP BY building_id
- )
- AS tbpt ON tb.building_id = tbpt.building_id
- </if>
-
- <if test="(areaList != null and areaList.size > 0) or (houseTypeList != null and houseTypeList.length > 0)">
- INNER JOIN
- (
- SELECT * FROM ta_building_apartment
- <trim prefix="where" prefixOverrides="and | or">
- <if test="areaList != null">
- <foreach collection="areaList" item="areaArr" open="(" close=")" separator=" OR ">
- (
- <if test='areaArr[0] != null and areaArr[0] != ""'>
- <![CDATA[ building_area >= ${areaArr[0]} ]]>
- </if>
- <if test='areaArr.length > 1 and areaArr[0] != null and areaArr[0] != ""'>
- AND
- </if>
- <if test='areaArr.length > 1 and areaArr[1] != null and areaArr[1] != ""'>
- <![CDATA[ building_area <= ${areaArr[1]} ]]>
- </if>
- )
- </foreach>
- </if>
-
- <if test="houseTypeList != null and houseTypeList.length > 0">
- AND house_type in
- <foreach collection="houseTypeList" item="houseType" open="(" close=")" separator=",">
- #{houseType}
- </foreach>
- </if>
- </trim>
- GROUP BY building_id
- ) as tba ON tb.building_id = tba.building_id
- </if>
-
- ORDER BY tb.order_no DESC
- </select>
-
- </mapper>
|