lin
2024-03-20 d87fc2aa632ff4dedade3a18fa1a860554189042
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
55
56
57
58
59
60
61
62
63
<?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>
 
    <!--根据租房id删除租户信息-->
    <update id="removeByHousingRentalId">
        update jczz_house_tenant set is_deleted = 1 where housing_rental_id = #{housingRentalId}
    </update>
 
</mapper>