mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
71
72
73
74
75
76
77
<?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="com.panzhihua.service_community.dao.ComActColumnDao">
 
    <resultMap type="com.panzhihua.service_community.entity.ComActColumn" id="ComActColumnBaseResultMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="status" column="status"/>
        <result property="type" column="type"/>
        <result property="description" column="description"/>
    </resultMap>
    <select id="pageList" resultType="com.panzhihua.common.model.vos.community.ComActColumnVO">
        select * from com_act_column
        <where>
            1=1
            <if test="commonPage.type!=null">
                and type = #{commonPage.type}
            </if>
            <if test="commonPage.type != 1">
                <if test="commonPage.communityId!=null">
                    and community_id = ${commonPage.communityId}
                </if>
                <if test="commonPage.streetId!=null">
                    and street_id = #{commonPage.streetId}
                </if>
            </if>
            <if test="commonPage.status!=null">
                and status =#{commonPage.status}
            </if>
            <if test="commonPage.keyword!=null and commonPage.keyword!=''">
                and name like concat('%',#{commonPage.keyword},'%')
            </if>
            <if test="commonPage.name!=null and commonPage.name!=''">
                and name like concat('%',#{commonPage.name},'%')
            </if>
            <if test="commonPage.paramId !=null">
                and parent_id = #{commonPage.paramId}
            </if>
        </where>
        order by create_time desc
    </select>
 
    <resultMap id="levelMap" type="com.panzhihua.common.model.vos.community.ComActColumnLevelVO">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <collection property="comActColumnVOList" column="id=parent_id" ofType="com.panzhihua.common.model.vos.community.ComActColumnVO" javaType="java.util.ArrayList">
            <result property="id" column="sid"/>
            <result property="name" column="sname"/>
        </collection>
    </resultMap>
    <select id="queryLevel" resultMap="levelMap">
        select t.id,t.name,t1.id as sid,t1.name as sname from com_act_column t left join com_act_column t1 on t.id =t1.parent_id
        <where>
            1=1
            <if test="type !=null ">
                and t.type =#{type}
            </if>
            <if test="type != 4">
                <if test="communityId !=null ">
                    and t.community_id =#{communityId}
                </if>
                <if test="streetId !=null ">
                    and t.street_id =#{streetId}
                </if>
            </if>
            <if test="parentId !=null">
                and t.parent_id=#{parentId}
            </if>
        </where>
        order by t.create_time desc
    </select>
 
</mapper>