from erp_distribut_contract dc , erp_distribut_material dm , erp_purchase_material pm
where dc.id = dm.contract_id and dm.good_code = pm.good_code and pm.depart_id = #{param.departId} and pm.del_flag = 0 and dc.use_flag = '0'
where dc.id = dm.contract_id and dc.id = #{param.distributContractId } and dm.good_code = pm.good_code and pm.depart_id = #{param.departId} and pm.del_flag = 0 and dc.use_flag = '0'
<iftest="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<iftest="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<iftest="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%' #{param.sparepartName}'%'</if>