达梦适配修改
This commit is contained in:
@@ -260,32 +260,40 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllOrganizationById" resultType="java.lang.Long" parameterType="java.lang.Long">
|
<select id="selectAllOrganizationById" resultType="java.lang.Long" parameterType="java.lang.Long">
|
||||||
SELECT
|
<!-- SELECT-->
|
||||||
organization_id
|
<!-- organization_id-->
|
||||||
FROM
|
<!-- FROM-->
|
||||||
(
|
<!-- (-->
|
||||||
SELECT
|
<!-- SELECT-->
|
||||||
|
<!-- t1.organization_id,-->
|
||||||
|
<!-- t1.organization_name,-->
|
||||||
|
<!-- t1.parent_organization_id,-->
|
||||||
|
<!-- IF-->
|
||||||
|
<!-- (-->
|
||||||
t1.organization_id,
|
<!-- find_in_set( parent_organization_id, @pids ) > 0,-->
|
||||||
t1.organization_name,
|
<!-- @pids := concat( @pids, ',', organization_id ),-->
|
||||||
t1.parent_organization_id,
|
<!-- IF-->
|
||||||
IF
|
<!-- ( t1.organization_id = #{organizationId}, #{organizationId}, - 1 )-->
|
||||||
(
|
<!-- ) AS ischild-->
|
||||||
find_in_set( parent_organization_id, @pids ) > 0,
|
<!-- FROM-->
|
||||||
@pids := concat( @pids, ',', organization_id ),
|
<!-- ( SELECT organization_id, parent_organization_id, organization_name FROM sys_organization t ) t1,-->
|
||||||
IF
|
<!-- ( SELECT @pids := #{organizationId} ) t2-->
|
||||||
( t1.organization_id = #{organizationId}, #{organizationId}, - 1 )
|
<!-- ) t3-->
|
||||||
) AS ischild
|
<!--WHERE-->
|
||||||
FROM
|
<!--ischild != - 1-->
|
||||||
( SELECT organization_id, parent_organization_id, organization_name FROM sys_organization t ) t1,
|
WITH RECURSIVE org_tree(org_id) AS (
|
||||||
( SELECT @pids := #{organizationId} ) t2
|
-- 初始查询:找到指定组织
|
||||||
) t3
|
SELECT organization_id
|
||||||
WHERE
|
FROM sys_organization
|
||||||
ischild != - 1
|
WHERE organization_id = #{organizationId}
|
||||||
|
UNION ALL
|
||||||
|
-- 递归查询:找到所有子组织
|
||||||
|
SELECT child.organization_id
|
||||||
|
FROM sys_organization child
|
||||||
|
INNER JOIN org_tree parent
|
||||||
|
ON child.parent_organization_id = parent.org_id
|
||||||
|
)
|
||||||
|
SELECT org_id AS organization_id FROM org_tree;
|
||||||
</select>
|
</select>
|
||||||
<select id="getAllOrganization"
|
<select id="getAllOrganization"
|
||||||
resultType="com.linke.product.domain.organization.repository.po.OrganizationPo">
|
resultType="com.linke.product.domain.organization.repository.po.OrganizationPo">
|
||||||
|
|||||||
Reference in New Issue
Block a user