| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?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="type != null and type != ''">
- 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`
- where deleted = 0
- GROUP BY room_name, room_type, room_price, id
- </select>
- <select id="group" resultType="java.lang.String">
- select room_name from house group by room_name
- </select>
- </mapper>
|