| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?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.inspur.source.mapper.SmsbVersionPackageMapper">
- <select id="selectVoPageWithTreeName" resultType="com.inspur.source.domain.vo.SmsbVersionPackageVo" parameterType="com.inspur.source.domain.bo.SmsbVersionPackageBo">
- WITH RECURSIVE category_path AS (
- SELECT
- id,
- NAME,
- parent_id,
- id AS leaf_id,
- 1 AS LEVEL
- FROM smsb_version_tree
- UNION ALL
- -- 向上递归
- SELECT
- t.id,
- t.NAME,
- t.parent_id,
- cp.leaf_id,
- cp.LEVEL + 1
- FROM smsb_version_tree t
- INNER JOIN category_path cp ON t.id = cp.parent_id
- )
- SELECT
- p.id AS id,
- p.version_name,
- p.version_code,
- p.file_size ,
- p.file_name,
- p.file_url,
- p.md5,
- p.tree_id,
- p.tree_ids,
- p.remark,
- p.create_time,
- p.create_by,
- p.update_time,
- GROUP_CONCAT(cp.name ORDER BY cp.level DESC SEPARATOR '/') AS tree_name
- FROM smsb_version_package p
- JOIN category_path cp
- ON p.tree_id = cp.leaf_id
- WHERE 1 = 1
- <if test="bo.versionName != null">
- AND p.version_name LIKE CONCAT('%', #{bo.versionName}, '%')
- </if>
- <if test="bo.versionCode != null">
- AND p.version_code LIKE CONCAT('%', #{bo.versionCode}, '%')
- </if>
- GROUP BY
- p.id
- order by p.id desc
- </select>
- </mapper>
|