select a.* ,b.sc_namefrom tdepart_transfer_sj aleft join tbosc_sc_base b on a.CONTRACT_NO=b.sc_nowhere 1=1(case when '${hz}'=0 then out_depart_no in (select c_id from tm_tree where 1 = 1and c_type = '自主经营体'and ${rights("belong_amb_id",hierarchy,p_depart,departs_amb)})or in_depart_no in (select c_id from tm_tree where 1 = 1and c_type = '自主经营体'and ${rights("belong_amb_id",hierarchy,p_depart,departs_amb)})when '${hz}'=1 then out_depart_no in (select c_id from tm_tree where 1 = 1and c_type = '自主经营体'and ${rights("belong_amb_id",hierarchy,p_depart,departs_amb)})when '${hz}'=2 then in_depart_no in (select c_id from tm_tree where 1 = 1and c_type = '自主经营体'and ${rights("belong_amb_id",hierarchy,p_depart,departs_amb)}) else '' end )${if(years=0 || len(years)<1,""," and to_number(to_char(transfer_date,'yyyy'))="+years)}${if(months=0 || len(months)<1,""," and to_number(to_char(transfer_date,'mm'))="+months)}${if(len(replace(p_search_txt,"'",""))=0, "", " and (transfer_no like '%"+replace(p_search_txt,"'","")+"%' or contract_no like '%"+replace(p_search_txt,"'","")+"%') ")}where 后面添加了case when 导致错误了。我也不知道错在哪里啊 。