btxtgxq-system-population/src/main/resources/mybatis/mapper/rental/rental-mapper.xml

497 lines
16 KiB
XML
Raw Normal View History

2023-10-31 12:20:45 +08:00
<?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.cm.population.dao.rental.IRentalDao">
<resultMap id="rentalDTO" type="com.cm.population.pojo.dtos.rental.RentalDTO">
<result column="rental_id" property="rentalId"/>
<result column="homeowner" property="homeowner"/>
<result column="phone" property="phone"/>
<result column="room_count" property="roomCount"/>
<result column="structure_id" property="structureId"/>
<result column="structure_name" property="structureName"/>
<result column="registration_date" property="registrationDate"/>
<result column="group_type_id" property="groupTypeId"/>
<result column="group_type_name" property="groupTypeName"/>
<result column="manage_level_id" property="manageLevelId"/>
<result column="manage_level_name" property="manageLevelName"/>
<result column="rental_area" property="rentalArea"/>
<result column="rental_date" property="rentalDate"/>
<result column="address" property="address"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="image" property="image"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
<result column="street" property="street"/>
<result column="street_mame" property="streetName"/>
</resultMap>
<resultMap id="rentalBO" type="com.cm.population.pojo.bos.rental.RentalBO">
<result column="rental_id" property="rentalId"/>
<result column="homeowner" property="homeowner"/>
<result column="phone" property="phone"/>
<result column="room_count" property="roomCount"/>
<result column="structure_id" property="structureId"/>
<result column="structure_name" property="structureName"/>
<result column="registration_date" property="registrationDate"/>
<result column="group_type_id" property="groupTypeId"/>
<result column="group_type_name" property="groupTypeName"/>
<result column="manage_level_id" property="manageLevelId"/>
<result column="manage_level_name" property="manageLevelName"/>
<result column="rental_area" property="rentalArea"/>
<result column="rental_date" property="rentalDate"/>
<result column="address" property="address"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="image" property="image"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
<result column="street" property="street"/>
<result column="street_mame" property="streetName"/>
</resultMap>
<resultMap id="rentalPO" type="com.cm.population.pojo.pos.rental.RentalPO">
<result column="rental_id" property="rentalId"/>
<result column="homeowner" property="homeowner"/>
<result column="phone" property="phone"/>
<result column="room_count" property="roomCount"/>
<result column="structure_id" property="structureId"/>
<result column="structure_name" property="structureName"/>
<result column="registration_date" property="registrationDate"/>
<result column="group_type_id" property="groupTypeId"/>
<result column="group_type_name" property="groupTypeName"/>
<result column="manage_level_id" property="manageLevelId"/>
<result column="manage_level_name" property="manageLevelName"/>
<result column="rental_area" property="rentalArea"/>
<result column="rental_date" property="rentalDate"/>
<result column="address" property="address"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="image" property="image"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
<result column="street" property="street"/>
<result column="street_mame" property="streetName"/>
</resultMap>
<!-- 新增出租房管理 -->
<insert id="save" parameterType="map">
INSERT INTO house_rental(
rental_id,
homeowner,
phone,
room_count,
structure_id,
structure_name,
registration_date,
group_type_id,
group_type_name,
manage_level_id,
manage_level_name,
rental_area,
rental_date,
address,
longitude,
latitude,
image,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{rentalId},
#{homeowner},
#{phone},
#{roomCount},
#{structureId},
#{structureName},
#{registrationDate},
#{groupTypeId},
#{groupTypeName},
#{manageLevelId},
#{manageLevelName},
#{rentalArea},
#{rentalDate},
#{address},
#{longitude},
#{latitude},
#{image},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除出租房管理 -->
<update id="remove" parameterType="map">
UPDATE
house_rental
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
rental_id IN
<foreach collection="rentalIds" index="index" open="(" separator="," close=")">
#{rentalIds[${index}]}
</foreach>
</update>
<!-- 删除出租房管理(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
house_rental
WHERE
rental_id IN
<foreach collection="rentalIds" index="index" open="(" separator="," close=")">
#{rentalIds[${index}]}
</foreach>
</update>
<!-- 修改出租房管理 -->
<update id="update" parameterType="map">
UPDATE
house_rental
SET
<if test="homeowner != null and homeowner != ''">
homeowner = #{homeowner},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="roomCount != null">
room_count = #{roomCount},
</if>
<if test="structureId != null and structureId != ''">
structure_id = #{structureId},
</if>
<if test="structureName != null and structureName != ''">
structure_name = #{structureName},
</if>
<if test="registrationDate != null and registrationDate != ''">
registration_date = #{registrationDate},
</if>
<if test="groupTypeId != null and groupTypeId != ''">
group_type_id = #{groupTypeId},
</if>
<if test="groupTypeName != null and groupTypeName != ''">
group_type_name = #{groupTypeName},
</if>
<if test="manageLevelId != null and manageLevelId != ''">
manage_level_id = #{manageLevelId},
</if>
<if test="manageLevelName != null and manageLevelName != ''">
manage_level_name = #{manageLevelName},
</if>
<if test="rentalArea != null and rentalArea != ''">
rental_area = #{rentalArea},
</if>
<if test="rentalDate != null and rentalDate != ''">
rental_date = #{rentalDate},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="longitude != null and longitude != ''">
longitude = #{longitude},
</if>
<if test="latitude != null and latitude != ''">
latitude = #{latitude},
</if>
<if test="image != null and image != ''">
image = #{image},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
rental_id = rental_id
WHERE
rental_id = #{rentalId}
</update>
<!-- 出租房管理详情 -->
<select id="get" parameterType="map" resultMap="rentalDTO">
SELECT
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.rental_id,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
2023-10-31 12:20:45 +08:00
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="rentalId != null and rentalId != ''">
AND
t1.rental_id = #{rentalId}
</if>
</select>
<!-- 出租房管理详情 -->
<select id="getBO" parameterType="map" resultMap="rentalBO">
SELECT
t1.rental_id,
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="rentalId != null and rentalId != ''">
AND
t1.rental_id = #{rentalId}
</if>
</select>
<!-- 出租房管理详情 -->
<select id="getPO" parameterType="map" resultMap="rentalPO">
SELECT
t1.rental_id,
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="rentalId != null and rentalId != ''">
AND
t1.rental_id = #{rentalId}
</if>
</select>
<!-- 出租房管理列表 -->
<select id="list" parameterType="map" resultMap="rentalDTO">
SELECT
t1.rental_id,
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
1
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="creator != null and creator != ''">
AND t1.creator = #{creator}
</if>
2023-10-31 12:20:45 +08:00
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="rentalIds != null and rentalIds.size > 0">
AND
t1.rental_id IN
<foreach collection="rentalIds" index="index" open="(" separator="," close=")">
#{rentalIds[${index}]}
</foreach>
</if>
</select>
<!-- 出租房管理列表 -->
<select id="listBO" parameterType="map" resultMap="rentalBO">
SELECT
t1.rental_id,
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="rentalIds != null and rentalIds.size > 0">
AND
t1.rental_id IN
<foreach collection="rentalIds" index="index" open="(" separator="," close=")">
#{rentalIds[${index}]}
</foreach>
</if>
</select>
<!-- 出租房管理列表 -->
<select id="listPO" parameterType="map" resultMap="rentalPO">
SELECT
t1.rental_id,
t1.homeowner,
t1.phone,
t1.room_count,
t1.structure_id,
t1.structure_name,
t1.registration_date,
t1.group_type_id,
t1.group_type_name,
t1.manage_level_id,
t1.manage_level_name,
t1.rental_area,
t1.rental_date,
t1.address,
t1.longitude,
t1.latitude,
t1.image,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
house_rental t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="rentalIds != null and rentalIds.size > 0">
AND
t1.rental_id IN
<foreach collection="rentalIds" index="index" open="(" separator="," close=")">
#{rentalIds[${index}]}
</foreach>
</if>
</select>
<!-- 出租房管理统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
house_rental t1
WHERE
t1.is_delete = 0
</select>
</mapper>