就是在mybatis中我想写一条sql查询两种列表 想通过参数控制,想问一下查询的字段可不可以通过前台传入的参数进行if标签判断如:
select
<if test="timeState !=null and timeState='month'">
to_char(trunc(co.CREATE_TIME),'yyyy-mm-dd') as createTime,
<if test="timeState !=null and timeState='year'">
to_char(trunc(co.CREATE_TIME),'yyyy-mm') as createTime,
</if>
这样行吗?我现在写他是报,每个查询块只允许有一个子句