发现问题
最近发现在mybatis中如果使用的字段是Oracle的关键字,会出现错误,通过查找相关的资料终于解决了,下面来一起看看详细的解决方法:
解决方式
可以使用resultMap**
示例代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<!-- 预约日历用 -->
< resultMap id = "FullDateResultMap" type = "com.haier.hrssc.reserveschedual.dto.FullcalendaDTO" >
< id property = "id" column = "id" />
< result property = "title" column = "title" />
< result property = "start" column = "startTime" />
< result property = "end" column = "endTime" />
< result property = "allDay" column = "allDay" />
< result property = "color" column = "color" />
</ resultMap >
<!-- 获取主键 -->
<!-- 查询预约日历 -->
< select id = "getFullcalender" parameterType = "com.haier.hrssc.reserveschedual.dto.FullcalendaDTO" resultMap = "FullDateResultMap" >
<![CDATA[
SELECT
c.ID AS id,
c.TITLE AS title,
c.COLOR AS color,
DECODE (
c.ALLDAY,
0,
'false',
1,
'true',
'false'
) AS allDay,
c.STARTTIME AS startTime,
c.ENDTIME AS endTime
FROM
T_SSC_CALENDAR c
WHERE
((c.status = '1' or c.status = #{status,jdbcType=VARCHAR})
and
c.EMPSN = #{empSn,jdbcType=VARCHAR})
or
(c.EMPSN is Null and c.status = '1')
and to_date(c.STARTTIME,'yyyy-MM-dd') between to_date(#{start,jdbcType=VARCHAR},'yyyy-MM-dd') and to_date(#{end,jdbcType=VARCHAR},'yyyy-MM-dd')
]]>
</ select >
|
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对服务器之家的支持。
原文链接:http://blog.csdn.net/cc_yy_zh/article/details/72368494