<?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.label.mapper.LabelMapper">
|
|
<!--自定义列表-->
|
<select id="selectLabelPage" resultType="org.springblade.modules.label.vo.LabelVO">
|
select * from jczz_label where 1=1
|
</select>
|
|
<!--标签查询,按父id查询下级-->
|
<select id="getLabelList" resultType="org.springblade.common.node.TreeIntegerNode">
|
SELECT
|
jl.id as id,jl.parent_id as parentId,jl.label_name as name
|
FROM
|
(
|
SELECT
|
@ids AS ids,
|
( SELECT @ids := GROUP_CONCAT( id ) FROM jczz_label WHERE FIND_IN_SET( parent_id, @ids ) ) AS cids
|
FROM
|
jczz_label
|
WHERE
|
@ids IS NOT NULL
|
AND @ids := #{label.parentId}
|
) id,
|
jczz_label jl
|
WHERE
|
FIND_IN_SET(jl.parent_id,ids)
|
</select>
|
|
|
<select id="getLabelTreeList" resultType="org.springblade.common.node.TreeIntegerNode">
|
select id as id,parent_id as parentId,label_name as name FROM jczz_label where is_deleted = 0
|
</select>
|
|
|
</mapper>
|