|
@@ -74,6 +74,9 @@
|
|
select count(u.id) from u_archive_file u
|
|
select count(u.id) from u_archive_file u
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
left join m_archive_tree_contract t on t.id = u.node_id
|
|
left join m_archive_tree_contract t on t.id = u.node_id
|
|
|
|
+ <if test="vo.extType != null">
|
|
|
|
+ LEFT JOIN m_archive_tree_contract m ON m.id = u.node_ext_id
|
|
|
|
+ </if>
|
|
</if>
|
|
</if>
|
|
where u.is_deleted = 0
|
|
where u.is_deleted = 0
|
|
<if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
|
|
<if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
|
|
@@ -119,25 +122,24 @@
|
|
<!-- </otherwise>-->
|
|
<!-- </otherwise>-->
|
|
<!-- </choose>-->
|
|
<!-- </choose>-->
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
- and
|
|
|
|
<choose>
|
|
<choose>
|
|
- <!-- 当存在扩展类型时,同时查 node_id 和 node_ext_id -->
|
|
|
|
<when test="vo.extType != null">
|
|
<when test="vo.extType != null">
|
|
- (u.node_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>
|
|
|
|
- OR u.node_ext_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>)
|
|
|
|
|
|
+ and (find_in_set( #{vo.nodeIds}, t.ancestors ) or t.id = #{vo.nodeIds} or find_in_set( #{vo.nodeIds}, m.ancestors ) or m.id = #{vo.nodeIds})
|
|
</when>
|
|
</when>
|
|
- <!-- 默认只查 node_id -->
|
|
|
|
<otherwise>
|
|
<otherwise>
|
|
- u.node_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ and (find_in_set( #{vo.nodeIds}, t.ancestors ) or t.id = #{vo.nodeIds})
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="vo.authCode !=null and vo.authCode !=''">
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="vo.extType != null">
|
|
|
|
+ AND (t.tree_code = #{authCode} or t.tree_code = #{contractId} or t.parent_id = 0
|
|
|
|
+ or m.tree_code = #{authCode} or m.tree_code = #{contractId} or m.parent_id = 0
|
|
|
|
+ )
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ AND (t.tree_code = #{authCode} or t.tree_code = #{contractId} or t.parent_id = 0)
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
@@ -157,6 +159,9 @@
|
|
select u.* from u_archive_file u
|
|
select u.* from u_archive_file u
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
left join m_archive_tree_contract t on t.id = u.node_id
|
|
left join m_archive_tree_contract t on t.id = u.node_id
|
|
|
|
+ <if test="vo.extType != null">
|
|
|
|
+ LEFT JOIN m_archive_tree_contract m ON m.id = u.node_ext_id
|
|
|
|
+ </if>
|
|
</if>
|
|
</if>
|
|
where u.is_deleted = 0
|
|
where u.is_deleted = 0
|
|
<if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
|
|
<if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
|
|
@@ -202,25 +207,24 @@
|
|
<!-- </otherwise>-->
|
|
<!-- </otherwise>-->
|
|
<!-- </choose>-->
|
|
<!-- </choose>-->
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
<if test="vo.nodeIds != null and vo.nodeIds != ''">
|
|
- and
|
|
|
|
<choose>
|
|
<choose>
|
|
- <!-- 当存在扩展类型时,同时查 node_id 和 node_ext_id -->
|
|
|
|
<when test="vo.extType != null">
|
|
<when test="vo.extType != null">
|
|
- (u.node_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>
|
|
|
|
- OR u.node_ext_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>)
|
|
|
|
|
|
+ and (find_in_set( #{vo.nodeIds}, t.ancestors ) or t.id = #{vo.nodeIds} or find_in_set( #{vo.nodeIds}, m.ancestors ) or m.id = #{vo.nodeIds})
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ and (find_in_set( #{vo.nodeIds}, t.ancestors ) or t.id = #{vo.nodeIds})
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="vo.authCode !=null and vo.authCode !=''">
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="vo.extType != null">
|
|
|
|
+ AND (t.tree_code = #{authCode} or t.tree_code = #{contractId} or t.parent_id = 0
|
|
|
|
+ or m.tree_code = #{authCode} or m.tree_code = #{contractId} or m.parent_id = 0
|
|
|
|
+ )
|
|
</when>
|
|
</when>
|
|
- <!-- 默认只查 node_id -->
|
|
|
|
<otherwise>
|
|
<otherwise>
|
|
- u.node_id in
|
|
|
|
- <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
|
|
|
|
- #{nodeId}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND (t.tree_code = #{authCode} or t.tree_code = #{contractId} or t.parent_id = 0)
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|