This commit is contained in:
linfso 2024-05-15 09:44:19 +08:00
parent 976627e840
commit 696110dfda

View File

@ -107,18 +107,7 @@
<where>
del_flag='0'
<if test="ownerSite != null and ownerSite != ''">
<!-- 包含子网点 -->
AND owner_site in (
SELECT t3.site_code FROM(
SELECT t1.site_code,t1.parent_site_code,t1.site_name,
IF( FIND_IN_SET( parent_site_code, @parent_ids ) > 0, @parent_ids := CONCAT( @parent_ids, ',', site_code ), '0' ) AS cids
FROM ( SELECT * FROM emis_site AS t WHERE t.del_flag = '0' ORDER BY t.site_code ASC ) t1,
( SELECT @parent_ids := #{ownerSite} ) t2
) t3
WHERE cids != '0'
UNION
SELECT #{ownerSite} FROM dual
)
and owner_site=#{ownerSite}
</if>
<if test="id != null "> and id = #{id}</if>