| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?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.HouseMapper">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.template.model.pojo.House" id="HouseTypeMapper">
- <result property="id" column="id"/>
- <result property="number" column="number"/>
- <result property="roomName" column="room_name"/>
- <result property="roomType" column="room_type"/>
- <result property="roomPrice" column="room_price"/>
- <result property="roomArea" column="room_area"/>
- <result property="roomLiveTime" column="room_live_time"/>
- <result property="receivingTime" column="receiving_time"/>
- <result property="visible" column="visible"/>
- <result property="roomConfiguration" column="room_configuration"/>
- <result property="roomPicture" column="room_picture"/>
- </resultMap>
- <select id="getPage" resultType="com.template.model.vo.HouseVo">
- SELECT
- *
- FROM
- (
- SELECT
- h.room_live_time AS time,
- h.room_name AS `name`,
- (SELECT GROUP_CONCAT( DISTINCT hn.room_number ) FROM house_number hn WHERE hn.house_id =h.id and hn.deleted=0) as roomId ,
- h.room_price AS price,
- h.visible AS visible,
- h.number AS count,
- h.room_type AS type,
- h.id as id
- FROM
- house h
- <where>
- h.deleted=0
- <if test="keyWord != null and keyWord != ''">
- AND h.room_type = #{type}
- </if>
- </where>
- ) h1
- <where>
- <if test="keyWord != null and keyWord != ''">
- and h1.roomId LIKE concat('%',#{keyWord},'%')
- </if>
- </where>
- </select>
- <select id="details" resultType="com.template.model.vo.HousedetailsVo">
- SELECT
- h.*,
- ( SELECT GROUP_CONCAT( DISTINCT hn.room_number ) FROM house_number hn WHERE hn.house_id = h.id and hn.deleted=0 ) AS roomIds
- FROM
- `house` h
- WHERE
- h.id = #{houseId} AND h.deleted=0
- </select>
- <select id="roomType" resultType="com.template.model.vo.RoomTypeVo">
- SELECT id,room_name,room_type,room_price FROM `house` GROUP BY room_name,room_type,room_price,id
- </select>
- </mapper>
|