|
@@ -88,7 +88,10 @@
|
|
|
else '已废除' end as approveStatusName,
|
|
|
(select period_number from s_contract_meter_period cmp where cmp.id = mma.contract_period_id) as periodNumber
|
|
|
FROM s_middle_meter_apply mma
|
|
|
- WHERE contract_id = #{apply.contractId} and is_deleted = 0 and contract_period_id = #{apply.contractPeriodId}
|
|
|
+ WHERE contract_id = #{apply.contractId} and is_deleted = 0
|
|
|
+ <if test="apply.contractPeriodId != -1">
|
|
|
+ and contract_period_id = #{apply.contractPeriodId}
|
|
|
+ </if>
|
|
|
and contract_unit_id in (SELECT id FROM s_meter_tree_contract mtc
|
|
|
WHERE contract_id = #{apply.contractId} and is_deleted = 0
|
|
|
and (mtc.id = #{apply.contractUnitId} or FIND_IN_SET(#{apply.contractUnitId}, ancestor))
|
|
@@ -101,7 +104,11 @@
|
|
|
else '已废除' end as approveStatusName,
|
|
|
(select period_number from s_contract_meter_period cmp where cmp.id = mma.contract_period_id) as periodNumber
|
|
|
FROM s_middle_meter_apply mma
|
|
|
- WHERE contract_id = #{apply.contractId} and is_deleted = 0 and contract_period_id = #{apply.contractPeriodId}
|
|
|
+ WHERE contract_id = #{apply.contractId} and is_deleted = 0
|
|
|
+ <if test="apply.contractPeriodId != -1">
|
|
|
+ and contract_period_id = #{apply.contractPeriodId}
|
|
|
+ </if>
|
|
|
+
|
|
|
and contract_unit_id in (
|
|
|
<foreach collection="ids" item="id" separator=",">
|
|
|
#{id}
|
|
@@ -111,7 +118,7 @@
|
|
|
<foreach collection="ids" item="id" separator=",">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
- )
|
|
|
+ ),create_time
|
|
|
|
|
|
</select>
|
|
|
<select id="meterPeriodAllForm" resultType="org.springblade.meter.vo.MeterInventoryDetailVO">
|
|
@@ -185,13 +192,15 @@
|
|
|
|
|
|
|
|
|
<select id="getLowestNodeBySort" resultType="org.springblade.meter.vo.NodeSortVO">
|
|
|
- SELECT id,parent_id
|
|
|
+ SELECT id,parent_id,
|
|
|
+ (select count(1) from s_middle_meter_apply mma
|
|
|
+ where mma.contract_id = #{contractId} and mma.is_deleted = 0 and mma.contract_unit_id = mtc.id
|
|
|
+ <if test="periodId != -1">
|
|
|
+ and mma.contract_period_id = #{periodId}
|
|
|
+ </if>
|
|
|
+ ) as LinkTotal
|
|
|
FROM s_meter_tree_contract mtc
|
|
|
- WHERE is_deleted = 0 and contract_id = #{contractId}
|
|
|
- and id in (SELECT id FROM s_meter_tree_contract mtc2
|
|
|
- WHERE mtc2.contract_id = #{contractId} and mtc2.is_deleted = 0
|
|
|
- and (mtc2.id = #{nodeId} or FIND_IN_SET(#{nodeId}, mtc2.ancestor))
|
|
|
- )
|
|
|
+ WHERE contract_id = #{contractId} and is_deleted = 0 and FIND_IN_SET(#{nodeId}, ancestor)
|
|
|
ORDER BY mtc.sort,mtc.create_time
|
|
|
|
|
|
|
|
@@ -382,6 +391,23 @@
|
|
|
from m_table_file where contract_id = #{contractId} and is_deleted = 0 and tab_id in
|
|
|
(select wbs_tree_id from s_meter_tree_link_wbs_tree where contract_id = #{contractId} and meter_tree_id = #{id})
|
|
|
</select>
|
|
|
+ <select id="getMeterById" resultType="org.springblade.meter.vo.NodeSortVO">
|
|
|
+ SELECT id,parent_id
|
|
|
+ FROM s_meter_tree_contract mtc
|
|
|
+ WHERE id = #{meterId}
|
|
|
+ </select>
|
|
|
+ <select id="getAllMeter" resultType="org.springblade.meter.vo.NodeSortVO">
|
|
|
+ SELECT id,parent_id,
|
|
|
+ (select count(1) from s_middle_meter_apply mma
|
|
|
+ where mma.contract_id = #{contractId} and mma.is_deleted = 0 and mma.contract_unit_id = mtc.id
|
|
|
+ <if test="periodId != -1">
|
|
|
+ and mma.contract_period_id = #{periodId}
|
|
|
+ </if>
|
|
|
+ ) as LinkTotal
|
|
|
+ FROM s_meter_tree_contract mtc
|
|
|
+ WHERE contract_id = #{contractId} and is_deleted = 0
|
|
|
+ ORDER BY -sort desc,create_time,node_name
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
</mapper>
|