222 lines
11 KiB
XML
222 lines
11 KiB
XML
<?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.eden.room.mapper.RoomMapper">
|
|
|
|
<resultMap type="Room" id="RoomResult">
|
|
<result property="id" column="id"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
<result property="projectId" column="project_id"/>
|
|
<result property="projectName" column="project_name"/>
|
|
<result property="buildingId" column="building_id"/>
|
|
<result property="buildingName" column="building_name"/>
|
|
<result property="floorId" column="floor_id"/>
|
|
<result property="floorName" column="floor_name"/>
|
|
<result property="roomNumber" column="room_number"/>
|
|
<result property="roomDigitalNumber" column="room_digital_number"/>
|
|
<result property="roomManageNumber" column="room_manage_number"/>
|
|
<result property="buildingArea" column="building_area"/>
|
|
<result property="rentalArea" column="rental_area"/>
|
|
<result property="billingArea" column="billing_area"/>
|
|
<result property="innerArea" column="inner_area"/>
|
|
<result property="isVirtual" column="is_virtual"/>
|
|
<result property="deliveryTime" column="delivery_time"/>
|
|
<result property="ownerId" column="owner_id"/>
|
|
<result property="propertyNature" column="property_nature"/>
|
|
<result property="height" column="height"/>
|
|
<result property="loadValue" column="load_value"/>
|
|
<result property="roomStatus" column="room_status"/>
|
|
<result property="roomType" column="room_type"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="lastModTime" column="last_mod_time"/>
|
|
<result property="createUserId" column="create_user_id"/>
|
|
<result property="lastModUserId" column="last_mod_user_id"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="projectName" column="project_name"/>
|
|
<result property="buildingName" column="building_name"/>
|
|
<result property="floorName" column="floor_name"/>
|
|
<result property="price" column="price"/>
|
|
<result property="rentalStatus" column="rental_status"/>
|
|
<result property="availableDate" column="available_date"/>
|
|
<result property="businessStatus" column="business_status"/>
|
|
<result property="decorationStatus" column="decoration_status"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectRoomVo">
|
|
select r.id, r.tenant_id, r.project_id, r.building_id, r.floor_id, r.room_number,
|
|
r.room_digital_number, r.room_manage_number, r.building_area, r.rental_area,
|
|
r.billing_area, r.inner_area, r.is_virtual, r.delivery_time, r.owner_id,
|
|
r.property_nature, r.height, r.load_value, r.room_status, r.room_type,
|
|
r.create_time, r.last_mod_time, r.create_user_id, r.last_mod_user_id,
|
|
r.del_flag, r.remark, b.project_name, c.building_name, d.floor_name,rb.price,rb.price_unit,
|
|
rb.rental_status,rb.available_date,rb.business_status,rb.decoration_status
|
|
from TB_ROOM r, TB_PROJECT b,TB_BUILDING c,TB_FLOOR d,TB_ROOM_BUSINESS_INFO rb, TB_ROOM_EXTEND_INFO re
|
|
where r.project_id=b.id and r.building_id=c.id and r.floor_id=d.id
|
|
and r.id = rb.room_id and r.id=re.room_id
|
|
</sql>
|
|
|
|
<select id="selectRoomList" parameterType="Room" resultMap="RoomResult">
|
|
<include refid="selectRoomVo"/>
|
|
<if test="tenantId != null and tenantId != ''">
|
|
AND r.tenant_id = #{tenantId}
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
AND r.project_id = #{projectId}
|
|
</if>
|
|
<if test="buildingId != null and buildingId != ''">
|
|
AND r.building_id = #{buildingId}
|
|
</if>
|
|
<if test="floorId != null and floorId != ''">
|
|
AND r.floor_id = #{floorId}
|
|
</if>
|
|
<if test="roomNumber != null and roomNumber != ''">
|
|
AND r.room_number like concat('%', #{roomNumber}, '%')
|
|
</if>
|
|
<if test="roomDigitalNumber != null and roomDigitalNumber != ''">
|
|
AND r.room_digital_number = #{roomDigitalNumber}
|
|
</if>
|
|
<if test="isVirtual != null and isVirtual != ''">
|
|
AND r.is_virtual = #{isVirtual}
|
|
</if>
|
|
<if test="roomStatus != null and roomStatus != ''">
|
|
AND r.room_status = #{roomStatus}
|
|
</if>
|
|
<if test="roomType != null and roomType != ''">
|
|
AND r.room_type = #{roomType}
|
|
</if>
|
|
<if test="businessStatus != null and businessStatus != ''">
|
|
AND rb.business_status = #{businessStatus}
|
|
</if>
|
|
AND r.del_flag = '0'
|
|
order by r.room_digital_number asc
|
|
</select>
|
|
|
|
<select id="selectRoomById" parameterType="String" resultMap="RoomResult">
|
|
<include refid="selectRoomVo"/>
|
|
and r.id = #{id} and r.del_flag = '0'
|
|
</select>
|
|
|
|
<insert id="insertRoom" parameterType="Room" useGeneratedKeys="true" keyProperty="id">
|
|
<selectKey keyProperty="id" resultType="String" order="BEFORE">
|
|
SELECT nextval('SEQ_ROOM_1')::VARCHAR as id
|
|
</selectKey>
|
|
insert into TB_ROOM
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
id,
|
|
<if test="tenantId != null">tenant_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="buildingId != null">building_id,</if>
|
|
<if test="floorId != null">floor_id,</if>
|
|
<if test="roomNumber != null">room_number,</if>
|
|
<if test="roomDigitalNumber != null">room_digital_number,</if>
|
|
<if test="roomManageNumber != null">room_manage_number,</if>
|
|
<if test="buildingArea != null">building_area,</if>
|
|
<if test="rentalArea != null">rental_area,</if>
|
|
<if test="billingArea != null">billing_area,</if>
|
|
<if test="innerArea != null">inner_area,</if>
|
|
<if test="isVirtual != null">is_virtual,</if>
|
|
<if test="deliveryTime != null">delivery_time,</if>
|
|
<if test="ownerId != null">owner_id,</if>
|
|
<if test="propertyNature != null">property_nature,</if>
|
|
<if test="height != null">height,</if>
|
|
<if test="loadValue != null">load_value,</if>
|
|
<if test="roomStatus != null">room_status,</if>
|
|
<if test="roomType != null">room_type,</if>
|
|
<if test="createUserId != null">create_user_id,</if>
|
|
<if test="lastModUserId != null">last_mod_user_id,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
<if test="remark != null">remark,</if>
|
|
create_time,
|
|
last_mod_time
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
#{id},
|
|
<if test="tenantId != null">#{tenantId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="buildingId != null">#{buildingId},</if>
|
|
<if test="floorId != null">#{floorId},</if>
|
|
<if test="roomNumber != null">#{roomNumber},</if>
|
|
<if test="roomDigitalNumber != null">#{roomDigitalNumber},</if>
|
|
<if test="roomManageNumber != null">#{roomManageNumber},</if>
|
|
<if test="buildingArea != null">#{buildingArea},</if>
|
|
<if test="rentalArea != null">#{rentalArea},</if>
|
|
<if test="billingArea != null">#{billingArea},</if>
|
|
<if test="innerArea != null">#{innerArea},</if>
|
|
<if test="isVirtual != null">#{isVirtual},</if>
|
|
<if test="deliveryTime != null">#{deliveryTime},</if>
|
|
<if test="ownerId != null">#{ownerId},</if>
|
|
<if test="propertyNature != null">#{propertyNature},</if>
|
|
<if test="height != null">#{height},</if>
|
|
<if test="loadValue != null">#{loadValue},</if>
|
|
<if test="roomStatus != null">#{roomStatus},</if>
|
|
<if test="roomType != null">#{roomType},</if>
|
|
<if test="createUserId != null">#{createUserId},</if>
|
|
<if test="lastModUserId != null">#{lastModUserId},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateRoom" parameterType="Room">
|
|
update TB_ROOM
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="roomNumber != null">room_number = #{roomNumber},</if>
|
|
<if test="roomDigitalNumber != null">room_digital_number = #{roomDigitalNumber},</if>
|
|
<if test="roomManageNumber != null">room_manage_number = #{roomManageNumber},</if>
|
|
<if test="buildingArea != null">building_area = #{buildingArea},</if>
|
|
<if test="rentalArea != null">rental_area = #{rentalArea},</if>
|
|
<if test="billingArea != null">billing_area = #{billingArea},</if>
|
|
<if test="innerArea != null">inner_area = #{innerArea},</if>
|
|
<if test="isVirtual != null">is_virtual = #{isVirtual},</if>
|
|
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
|
|
<if test="ownerId != null">owner_id = #{ownerId},</if>
|
|
<if test="propertyNature != null">property_nature = #{propertyNature},</if>
|
|
<if test="height != null">height = #{height},</if>
|
|
<if test="loadValue != null">load_value = #{loadValue},</if>
|
|
<if test="roomStatus != null">room_status = #{roomStatus},</if>
|
|
<if test="roomType != null">room_type = #{roomType},</if>
|
|
<if test="lastModUserId != null">last_mod_user_id = #{lastModUserId},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
last_mod_time = CURRENT_TIMESTAMP
|
|
</trim>
|
|
where id = #{id} and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="deleteRoomById" parameterType="String">
|
|
update TB_ROOM set del_flag = '1' where id = #{id} and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="deleteRoomByIds" parameterType="String">
|
|
update TB_ROOM set del_flag = '1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="selectRoomByIds" parameterType="java.util.List" resultMap="RoomResult">
|
|
<include refid="selectRoomVo"/>
|
|
AND r.id IN
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
AND r.del_flag = '0'
|
|
</select>
|
|
|
|
<select id="checkRoomNumberExists" parameterType="Room" resultType="Integer">
|
|
select count(*) from TB_ROOM
|
|
where room_number = #{roomNumber}
|
|
and floor_id = #{floorId}
|
|
and building_id = #{buildingId}
|
|
and project_id = #{projectId}
|
|
and tenant_id = #{tenantId}
|
|
and del_flag = '0'
|
|
<if test="id != null and id != ''">
|
|
and id != #{id}
|
|
</if>
|
|
</select>
|
|
</mapper> |