linwe
2023-12-23 55d677758efadb6d42e6d4e595cecc2c50c20d5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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 column="id" property="id"/>
        <result column="housing_rental_id" property="housingRentalId"/>
        <result column="name" property="name"/>
        <result column="phone" property="phone"/>
        <result column="id_card" property="idCard"/>
        <result column="domicile" property="domicile"/>
        <result column="work_unit" property="workUnit"/>
        <result column="remark" property="remark"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <sql id="selectHouseTenant">
        select
            id,
            housing_rental_id,
            name,
            phone,
            id_card,
            domicile,
            work_unit,
            remark,
            is_deleted
        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>
        </where>
    </select>
 
    <!--根据租房id删除租户信息-->
    <update id="removeByHousingRentalId">
        update jczz_house_tenant set is_deleted = 1 where housing_rental_id = #{housingRentalId}
    </update>
 
</mapper>