linwe
2023-11-25 8400a67289b214b83a20484410fff96d236c6d49
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
64
65
66
67
<?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.property.mapper.PropertyCompanyMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="propertyCompanyResultMap" type="org.springblade.modules.property.entity.PropertyCompanyEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="address" property="address"/>
        <result column="social_credit_code" property="socialCreditCode"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="area" property="area"/>
        <result column="remark" property="remark"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectPropertyCompanyPage" resultType="org.springblade.modules.property.vo.PropertyCompanyVO">
        select * from jczz_property_company where is_deleted = 0
        <if test="propertyCompany.name!=null and propertyCompany.name!=''">
            and name like concat('%',#{propertyCompany.name},'%')
        </if>
    </select>
 
    <!--物业公司列表查询(不分页)-->
    <select id="getPropertyCompanyList" resultType="org.springblade.modules.property.vo.PropertyCompanyVO">
        select * from jczz_property_company where is_deleted = 0
        <if test="propertyCompany.name!=null and propertyCompany.name!=''">
            and name like concat('%',#{propertyCompany.name},'%')
        </if>
    </select>
 
    <!--物业公司列表查询(不分页)-->
    <select id="getUserByPropertyCompany" resultType="java.util.Map">
        select
            bu.id,bu.real_name as name
        from blade_user bu
        left join blade_dept bd on bd.id = bu.dept_id and bd.is_deleted = 0
        left join jczz_property_company jpc on jpc.dept_id = bd.id and jpc.is_deleted = 0
        where bu.is_deleted = 0 and bu.real_name is not null
        and jpc.id = #{propertyCompany.id}
    </select>
 
    <!--查询对应的机构id集合-->
    <select id="getDeptListByCompanyId" resultType="java.lang.Long">
        select dept_id from jczz_property_company
        jpc where is_deleted = 0
        <choose>
            <when test="list != null and list.size()>0">
                and id in
                <foreach collection="list" item="id" separator ="," open="("  close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and id in ('')
            </otherwise>
        </choose>
    </select>
 
 
</mapper>