linwe
2024-05-29 c10d6358b9f014375a13821465bc978d0c0da22e
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
68
69
70
<?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.PropertyCompanyCommentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="propertyCompanyCommentResultMap" type="org.springblade.modules.property.vo.PropertyCompanyCommentVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="children" column="id"  javaType="java.util.List"
                    ofType="org.springblade.modules.property.vo.PropertyCompanyCommentVO"
                    autoMapping="true"
                    select="selectPropertyCompanyCommentByParentId">
        </collection>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectPropertyCompanyCommentPage" resultType="org.springblade.modules.property.vo.PropertyCompanyCommentVO">
        select
        jpcc.*,
        bu.real_name as realName,bu.avatar
        from jczz_property_company_comment jpcc
        left join blade_user bu on bu.id = jpcc.create_user
        where jpcc.is_deleted = 0
        and jpcc.parent_id = 0
        <if test="propertyCompanyComment.propertyCompanyId!=null">
            and jpcc.property_company_id = #{propertyCompanyComment.propertyCompanyId}
        </if>
        <if test="propertyCompanyComment.checkStatus!=null">
            and jpcc.check_status = #{propertyCompanyComment.checkStatus}
        </if>
 
        <if test="propertyCompanyComment.createUser!=null">
            and jpcc.create_user = #{propertyCompanyComment.createUser}
        </if>
    </select>
 
    <!--自定义分页查询(递归)-->
    <select id="selectPropertyCompanyCommentPageRec" parameterType="long"
            resultMap="propertyCompanyCommentResultMap">
        select
        jpcc.*,
        bu.real_name as realName,bu.avatar
        from jczz_property_company_comment jpcc
        left join blade_user bu on bu.id = jpcc.create_user
        where jpcc.is_deleted = 0
        and jpcc.parent_id = 0
        <if test="propertyCompanyComment.propertyCompanyId!=null">
            and jpcc.property_company_id = #{propertyCompanyComment.propertyCompanyId}
        </if>
        <if test="propertyCompanyComment.checkStatus!=null">
            and jpcc.check_status = #{propertyCompanyComment.checkStatus}
        </if>
 
        <if test="propertyCompanyComment.createUser!=null">
            and jpcc.create_user = #{propertyCompanyComment.createUser}
        </if>
    </select>
 
    <!--递归查询-->
    <select id="selectPropertyCompanyCommentByParentId"
            resultType="org.springblade.modules.property.vo.PropertyCompanyCommentVO">
        select
        jpcc.*,
        bu.real_name as realName,bu.avatar
        from jczz_property_company_comment jpcc
        left join blade_user bu on bu.id = jpcc.create_user
        where jpcc.is_deleted = 0
        and jpcc.parent_id = #{id}
    </select>
 
</mapper>