|
@@ -231,9 +231,13 @@
|
|
d.contract_id,
|
|
d.contract_id,
|
|
(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_archive_tree_contract WHERE parent_id = d.id and is_deleted = 0 and project_id = #{projectId})
|
|
(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_archive_tree_contract WHERE parent_id = d.id and is_deleted = 0 and project_id = #{projectId})
|
|
AS "has_children",
|
|
AS "has_children",
|
|
- (SELECT count(1) FROM m_archive_tree_contract WHERE is_deleted = 0 and project_id = #{projectId} and ancestors like CONCAT('%',d.id,'%')
|
|
|
|
|
|
+ (SELECT count(1) FROM m_archive_tree_contract a
|
|
|
|
+ inner join u_archive_file b on b.node_id = a.id and b.is_deleted = a.is_deleted and b.project_id = a.project_id and (b.is_auto_file is null or b.is_auto_file != 1)
|
|
|
|
+ WHERE a.is_deleted = 0
|
|
|
|
+ and a.project_id = #{projectId}
|
|
|
|
+ and a.ancestors like CONCAT('%',d.id,'%')
|
|
<if test="code!=null and code!=''">
|
|
<if test="code!=null and code!=''">
|
|
- AND (tree_code = #{code} or tree_code = #{contractId} or parent_id = 0)
|
|
|
|
|
|
+ AND (a.tree_code = #{code} or a.tree_code = #{contractId} or a.parent_id = 0)
|
|
</if>
|
|
</if>
|
|
) as tree_number
|
|
) as tree_number
|
|
FROM
|
|
FROM
|