你直接在数据集增加参数不就可以按年查询了?
select * from 表名称
where
${if(len(年)=0,"","and 表中的字段 in('"+ 年 + "')")}
这种业务 你最好写个存储过程把你需要的数据处理好,帆软层面只做查询最简单。