| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?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.template.mapper.HousePriceMapper">
- <select id="alterPriceRecord" resultType="com.template.model.vo.AlterPriceRecordVo">
- SELECT t2.room_type as houseType,
- t2.room_name AS houseName,
- group_concat(REPLACE(t1.set_date, ',', ' 至 ')) AS setDate,
- t1.price AS alterPrice,
- t1.original_price AS originalPrice,
- a.name as `name`,
- t1.create_time as date
- FROM house_price t1
- LEFT JOIN house t2 ON t1.house_id = t2.id
- and t2.deleted = 0
- LEFT JOIN admin a on a.id = t1.create_user
- and a.deleted = 0
- <where>
- t1.deleted = 0
- <if test="type != null and type != ''">
- AND t2.room_type = #{type}
- </if>
- <if test="houseName != null and houseName != ''">
- AND t2.room_name = #{houseName}
- </if>
- <if test="operatingTime != null and operatingTime != ''">
- AND t1.create_time BETWEEN SUBSTRING_INDEX(#{operatingTime}, ',', 1) and
- SUBSTRING_INDEX(#{operatingTime}, ',', -1)
- </if>
- <if test="priceTime != null and priceTime != ''">
- AND (substring_index(t1.set_date, ',', 1) BETWEEN SUBSTRING_INDEX(#{priceTime}, ',', 1) and
- SUBSTRING_INDEX(#{priceTime}, ',', -1)
- or
- substring_index(t1.set_date, ',', -1) BETWEEN SUBSTRING_INDEX(#{priceTime}, ',', 1) and
- SUBSTRING_INDEX(#{priceTime}, ',', -1)
- )
- </if>
- <if test="operatingName != null and operatingName != ''">
- AND a.`name` LIKE '%' #{operatingName} '%'
- </if>
- </where>
- GROUP BY t1.id
- ORDER BY t1.create_time DESC
- </select>
- <select id="housePrice" resultType="com.template.model.pojo.HousePrice">
- SELECT *
- FROM `house_price`
- WHERE #{endLocalDate} >= substring_index(set_date, ',', 1)
- and substring_index(set_date, ',', -1) >= #{localDate}
- and FIND_IN_SET(house_id, #{ids})
- and deleted = 0
- </select>
- <select id="queryExport" resultType="com.template.model.vo.AlterPriceRecordVo">
- SELECT t2.room_type as houseType,
- t2.room_name AS houseName,
- group_concat(REPLACE(t1.set_date, ',', ' 至 ')) AS setDate,
- t1.price AS alterPrice,
- t1.original_price AS originalPrice,
- a.name as `name`,
- t1.create_time as date
- FROM house_price t1
- LEFT JOIN house t2 ON t1.house_id = t2.id
- and t2.deleted = 0
- LEFT JOIN admin a on a.id = t1.create_user
- and a.deleted = 0
- <where>
- t1.deleted = 0
- <if test="type != null and type != ''">
- AND t2.room_type = #{type}
- </if>
- <if test="houseName != null and houseName != ''">
- AND t2.room_name = #{houseName}
- </if>
- <if test="operatingTime != null and operatingTime != ''">
- AND t1.create_time BETWEEN SUBSTRING_INDEX(#{operatingTime}, ',', 1) and
- SUBSTRING_INDEX(#{operatingTime}, ',', -1)
- </if>
- <if test="priceTime != null and priceTime != ''">
- AND (substring_index(t1.set_date, ',', 1) BETWEEN SUBSTRING_INDEX(#{priceTime}, ',', 1) and
- SUBSTRING_INDEX(#{priceTime}, ',', -1)
- or
- substring_index(t1.set_date, ',', -1) BETWEEN SUBSTRING_INDEX(#{priceTime}, ',', 1) and
- SUBSTRING_INDEX(#{priceTime}, ',', -1)
- )
- </if>
- <if test="operatingName != null and operatingName != ''">
- AND a.`name` LIKE '%' #{operatingName} '%'
- </if>
- </where>
- GROUP BY t1.id
- ORDER BY t1.create_time DESC
- </select>
- </mapper>
|