DELETE
FROM
blade_common_group
WHERE
group_type = 'group_organization'
AND group_category =1
AND id IN
#{deptId}
DELETE
FROM blade_common_group
WHERE group_type = 'group_organization'
AND group_category = 1
DELETE
FROM blade_common_group_of_item
WHERE group_type = 'group_organization'
AND group_category = 1
SELECT
common_group.* ,
(
SELECT
CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
FROM
blade_common_group
WHERE
parent_id = common_group.id and is_deleted = 0
) AS "has_children"
FROM
blade_common_group common_group
WHERE common_group.is_deleted = 0
and common_group.tenant_id = #{tenantId}
and common_group.parent_id = #{parentId}
and common_group.group_type = #{groupType}
and common_group.group_category = #{groupCategory}
and common_group.name like concat(concat('%', #{p.name}),'%')
and common_group.full_name like concat(concat('%', #{p.fullName}),'%')
ORDER BY common_group.sort
select id, parent_id, name as title, id as "value", id as "key" from blade_common_group where is_deleted = 0
and tenant_id = #{tenantId}
and group_category = #{groupCategory}
and group_type = #{groupType}
ORDER BY sort
SELECT
common_group.id,
common_group.parent_id,
common_group.name AS title,
common_group.id AS "value",
common_group.id AS "key",
(
SELECT
CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
FROM
blade_common_group
WHERE
parent_id = common_group.id and is_deleted = 0
) AS "has_children"
FROM
blade_common_group common_group
WHERE
common_group.parent_id = #{parentId} AND common_group.is_deleted = 0
and common_group.tenant_id = #{tenantId}
ORDER BY common_group.sort
SELECT
name
FROM
blade_common_group
WHERE
id IN
#{ids}
and is_deleted = 0
select *
from blade_common_group bcg1
where code like concat((select bcg2.code
from blade_common_group bcg2
where bcg2.id = #{id}
and bcg2.is_deleted = 0), '%')
and bcg1.is_deleted = 0
and bcg1.group_type = #{groupType}
and bcg1.group_category = #{groupCategory}