|
@@ -180,5 +180,25 @@
|
|
|
from s_contract_inventory_form scif where contract_id = #{contractId} and is_deleted = 0
|
|
|
order by -sort desc,create_time
|
|
|
</select>
|
|
|
+ <select id="getChildNodeResolveForm" resultType="org.springblade.meter.vo.ContractFromVO">
|
|
|
+ select ifm.id, ifm.contract_form_id ,cif.form_number,cif.form_name,cif.current_price,cif.contract_total,cif.change_total,cif.is_supplement,ifm.up_pay_ratio as upPayRatio,
|
|
|
+ ifm.build_picture_total,ifm.change_build_picture_total,ifm.build_picture_money,ifm.change_build_picture_money,
|
|
|
+
|
|
|
+ if(ifm.build_picture_total=ifm.change_build_picture_total,if((select count(1) from s_inventory_form_apply
|
|
|
+ where contract_id = #{contractId} and is_deleted = 0 and contract_form_id = ifm.contract_form_id and contract_meter_id = ifm.contract_meter_id)=0,
|
|
|
+ if((select count(1) from s_change_token_inventory
|
|
|
+ where contract_id = #{contractId} and is_deleted = 0 and contract_form_id = ifm.contract_form_id and contract_meter_id = ifm.contract_meter_id)=0,0,1)
|
|
|
+ ,1),1) as citeStatus,
|
|
|
+
|
|
|
+ IFNULL((SELECT SUM(change_build_picture_total) from s_inventory_form_meter WHERE contract_id = #{contractId} and contract_form_id = cif.id
|
|
|
+ and is_deleted = 0 and contract_meter_id and contract_meter_id != #{meterId}),0) as otherPoseNum,
|
|
|
+ IFNULL((SELECT SUM(change_build_picture_total) from s_inventory_form_meter
|
|
|
+ WHERE contract_id = #{contractId} and is_deleted = 0 and contract_form_id = cif.id),0) as poseNum
|
|
|
+ from s_inventory_form_meter ifm left join s_contract_inventory_form cif on ifm.contract_form_id = cif.id
|
|
|
+ WHERE ifm.contract_id = #{contractId} and ifm.is_deleted = 0
|
|
|
+ and ifm.contract_meter_id in (
|
|
|
+ select id from s_meter_tree_contract where contract_id = #{contractId} and is_deleted = 0 and FIND_IN_SET(#{meterId},ancestor) > 0
|
|
|
+ )
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|