|
@@ -92,20 +92,29 @@
|
|
|
GROUP BY contract_form_id
|
|
|
</select>
|
|
|
<select id="getChangeNode" resultType="org.springblade.meter.vo.ChangeNodeVO">
|
|
|
- select id,node_name,change_picture as contractPicture,change_money,
|
|
|
+ select id,node_name,change_picture as contractPicture,0 as change_money,ifnull(is_supplement,0) as isSupplement,
|
|
|
if(is_supplement = 1,'是','否') as isSupplementName
|
|
|
from s_meter_tree_contract mtc
|
|
|
WHERE mtc.contract_id = #{contractId} and mtc.is_deleted = 0
|
|
|
and (select COUNT(1) from s_meter_tree_contract mtc2 WHERE contract_id = #{contractId} and mtc2.parent_id=mtc.id)=0
|
|
|
- and (mtc.id in
|
|
|
- <foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
+ and
|
|
|
+ <foreach collection="ids" item="id" open="(" separator= "or" close=")">
|
|
|
+ FIND_IN_SET(#{id} , mtc.ancestor)
|
|
|
+ </foreach>
|
|
|
+ union
|
|
|
+ select id,node_name,change_picture as contractPicture,0 as change_money,ifnull(is_supplement,0) as isSupplement,
|
|
|
+ if(is_supplement = 1,'是','否') as isSupplementName
|
|
|
+ from s_meter_tree_contract mtc
|
|
|
+ WHERE mtc.contract_id = #{contractId} and mtc.is_deleted = 0
|
|
|
+ and (select COUNT(1) from s_meter_tree_contract mtc2 WHERE contract_id = #{contractId} and mtc2.parent_id=mtc.id)=0
|
|
|
+ and id in
|
|
|
+ <foreach collection="ids" item="id" open="(" separator= "," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
- or FIND_IN_SET(mtc.parent_id , #{id}))
|
|
|
</select>
|
|
|
<select id="selectForm" resultType="org.springblade.meter.vo.ChangeFormVO2">
|
|
|
select id,form_number,form_name,current_price,
|
|
|
- IFNULL((select build_picture_total
|
|
|
+ IFNULL((select change_build_picture_total
|
|
|
from s_inventory_form_meter ifm
|
|
|
WHERE contract_id = #{contractId} and is_deleted = 0 and ifm.contract_form_id = cif.id and ifm.contract_meter_id = #{nodeId}),0) as contractTotal
|
|
|
from s_contract_inventory_form cif
|
|
@@ -131,11 +140,11 @@
|
|
|
AND ctm.change_token_id = #{id}
|
|
|
</select>
|
|
|
<select id="getFormList" resultType="org.springblade.meter.vo.ChangeFormVO2">
|
|
|
- select cif.id,cif.form_number,cif.form_name,cif.current_price,cti.contract_meter_id,
|
|
|
+ select cti.contract_form_id as id,cti.form_number,cti.form_name,cti.current_price,cti.contract_meter_id,
|
|
|
cti.change_before_total as contractTotal,cti.change_total as currentChangeTotal,
|
|
|
cti.change_after_total as changeTotal,cti.change_before_money as contractMoney,
|
|
|
cti.change_money as currentChangeMoney,cti.change_after_money as changeMoney
|
|
|
- from s_change_token_inventory cti left join s_contract_inventory_form cif on cti.contract_form_id = cif.id
|
|
|
+ from s_change_token_inventory cti
|
|
|
where cti.contract_id = #{contractId} and cti.is_deleted = 0
|
|
|
AND cti.change_token_id = #{id}
|
|
|
</select>
|