1.select '${tjny}'期间, 日期, 公司简称, col_name 会计名称, 年初余额, 同期余额, 期末余额 from fr_iufo_zcfzb where 日期 = to_char(last_day(to_date('${tjny}','yyyy-mm')),'yyyy-mm-dd') and col_name is not null ${if(len(gs)<=2,""," and 公司简称 in ("+gs+")")} group by 日期,公司简称,col_name, 年初余额,同期余额,期末余额2.select '${tjny}'期间, 公司简称, col_name 会计名称, 期末余额 前年期末 from fr_iufo_zcfzb where 日期 =to_char(last_day(add_months(to_date('${tjny}','yyyy-mm'),-1*24)),'yyyy-mm-dd') and col_name is not null ${if(len(gs)<=2,""," and 公司简称 in ("+gs+")")} group by 公司简称,col_name, 年初余额,同期余额,期末余额