参数是一个 字符串(如:"2018"),返回所有 create_date <= '2018' 的元素的个数。
MyBatis:
<select id="getEndnumByYearAndType" resultType="java.lang.Integer">
select count(*) from (select * from
vcpe_version
where
to_char(create_date, 'yyyy') <= #{year} and r_type = #{rType})
</select>
但是启动 tomcat 时出现解析异常:
The content of elements must consist of well-formed character data or markup.
查询后发现,如果在 sql 语句中进行了 大于或者小于的比较,那么要用 :
<![CDATA[
]]>
标签来包裹,解析器会忽略标签内的内容。
============================
要做比较的话用预定义的实体引用:
< | < |
> | > |
& | & |
' | ' (单引号) |
" | " (双引号) |