<?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="org.springblade.modules.house.mapper.HouseTenantMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="houseTenantResultMap" type="org.springblade.modules.house.entity.HouseTenantEntity">
|
<result property="id" column="id" />
|
<result property="housingRentalId" column="housing_rental_id" />
|
<result property="name" column="name" />
|
<result property="phone" column="phone" />
|
<result property="idCard" column="id_card" />
|
<result property="domicile" column="domicile" />
|
<result property="workUnit" column="work_unit" />
|
<result property="remark" column="remark" />
|
<result property="isDeleted" column="is_deleted" />
|
<result property="gender" column="gender" />
|
<result property="ethnicity" column="ethnicity" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<sql id="selectHouseTenant">
|
select
|
id,
|
housing_rental_id,
|
name,
|
phone,
|
id_card,
|
domicile,
|
work_unit,
|
remark,
|
is_deleted,
|
gender,
|
ethnicity,
|
create_time
|
from
|
jczz_house_tenant
|
</sql>
|
|
|
<select id="selectHouseTenantPage" resultMap="houseTenantResultMap">
|
<include refid="selectHouseTenant"/>
|
<where>
|
<if test="houseTenant.id != null "> and id = #{houseTenant.id}</if>
|
<if test="houseTenant.housingRentalId != null "> and housing_rental_id = #{houseTenant.housingRentalId}</if>
|
<if test="houseTenant.name != null and name != ''"> and name = #{houseTenant.name}</if>
|
<if test="houseTenant.phone != null and phone != ''"> and phone = #{houseTenant.phone}</if>
|
<if test="houseTenant.idCard != null and idCard != ''"> and id_card = #{houseTenant.idCard}</if>
|
<if test="houseTenant.domicile != null and domicile != ''"> and domicile = #{houseTenant.domicile}</if>
|
<if test="houseTenant.workUnit != null and workUnit != ''"> and work_unit = #{houseTenant.workUnit}</if>
|
<if test="houseTenant.remark != null and remark != ''"> and remark = #{houseTenant.remark}</if>
|
<if test="houseTenant.isDeleted != null "> and is_deleted = #{houseTenant.isDeleted}</if>
|
<if test="houseTenant.gender != null "> and gender = #{houseTenant.gender}</if>
|
<if test="houseTenant.ethnicity != null "> and ethnicity = #{houseTenant.ethnicity}</if>
|
<if test="houseTenant.createTime != null "> and create_time = #{houseTenant.createTime}</if>
|
</where>
|
</select>
|
|
|
<select id="export" resultType="org.springblade.modules.house.excel.ExportHouseTenantExcel">
|
SELECT
|
jhr.house_code,
|
jda.address_name,
|
jht.NAME,
|
jht.phone,
|
jht.id_card,
|
jht.domicile,
|
jht.work_unit,
|
jht.remark,
|
jht.gender,
|
jht.ethnicity,
|
jht.create_time
|
FROM
|
jczz_house_tenant jht
|
LEFT JOIN jczz_house_rental jhr ON jht.housing_rental_id = jhr.id
|
LEFT JOIN jczz_doorplate_address jda on jda.address_code=jhr.house_code
|
WHERE
|
jht.is_deleted = 0
|
|
</select>
|
|
<!--根据租房id删除租户信息-->
|
<update id="removeByHousingRentalId">
|
update jczz_house_tenant set is_deleted = 1 where housing_rental_id = #{housingRentalId}
|
</update>
|
|
</mapper>
|