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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?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.category.mapper.CategoryMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="categoryResultMap" type="org.springblade.modules.category.entity.CategoryEntity">
        <result column="id" property="id"/>
        <result column="category_no" property="categoryNo"/>
        <result column="category_name" property="categoryName"/>
        <result column="parent_no" property="parentNo"/>
        <result column="importance" property="importance"/>
        <result column="remark" property="remark"/>
        <result column="level" property="level"/>
        <result column="description" property="description"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectCategoryPage" resultMap="categoryResultMap">
        select * from jczz_category where is_deleted = 0
    </select>
 
    <!--天地图poi 分类获取-->
    <select id="getCategory" resultType="org.springblade.modules.category.vo.CategoryVO">
        select * from jczz_category
        where is_deleted = 0
        <if test="category.level!=null">
            and level = #{category.level}
        </if>
        <if test="category.parentNo!=null and category.parentNo!=''">
            and parent_no = #{category.parentNo}
        </if>
        order by -sort desc
    </select>
 
    <select id="selectCategoryList" resultType="org.springblade.modules.category.dto.CategoryDTO">
        select
        jc.id,
        jc.category_no,
        jc.category_name,
        jc.parent_no,
        jc.remark
        from
        jczz_place_poi_label jppl LEFT JOIN jczz_category jc on jc.category_no=jppl.poi_code
        <where>
            <if test="category.id != null ">and jc.id = #{category.id}</if>
            <if test="category.placeId != null and category.placeId != '' ">and jppl.place_id = #{category.placeId}</if>
            <if test="category.categoryNo != null  and category.categoryNo != ''">and jc.category_no =
                #{category.categoryNo}
            </if>
            <if test="category.categoryName != null  and category.categoryName != ''">and jc.ategory_name =
                #{category.categoryName}
            </if>
            <if test="category.remark != null  and category.remark != ''">and jc.remark = #{category.remark}</if>
            and jppl.type = 3
            and jc.category_no is not null
        </where>
    </select>
 
 
    <select id="getTreeList" resultType="org.springblade.common.node.TreeIntegerNode">
        SELECT
            jc.category_no AS id,
            jc.id AS ids,
            jc.category_no,
            jc.parent_no AS parentId,
            jc.category_name AS name,
            jc.`level`,
            (
            SELECT
                count( 1 )
            FROM
                jczz_place jp
                LEFT JOIN jczz_place_poi_label jppl ON jp.id = jppl.place_id
            WHERE
                jc.category_no = jppl.poi_code
                AND jppl.type = 3
            ) count
        FROM
            jczz_category jc
        WHERE
            is_deleted = 0
    </select>
 
 
</mapper>