我感觉应该是拼接if语句的时候出错了,麻烦各位帮忙解答一下,小弟不胜感激!
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
### The error may exist in file [E:\scgw\code\code\work\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\EVGlobeServer_SSM\WEB-INF\classes\com\evglobe\mapper\WireDistance.xml]
### The error may involve com.evglobe.mapper.WireDistanceMapper.getWireDistanceInfos-Inline
### The error occurred while setting parameters
### SQL: select t.ev_loopid loopid,t.ev_loopname loopname,t.ev_towername towername,t.ev_ssds ssds, t.ev_powerlevel powerlevel,t.ev_company company,t.ev_altitude altitude, w.ev_distance dis2ground,w.ev_wiredis wiredis from EV_SZJC_TOWERALTITUDE t,EV_COMMON_WIRETOGROUND w where t.ev_loopid=w.ev_loopid and t.ev_order=w.ev_order and t.ev_altitude>=? and t.ev_altitude<? and w.ev_distance>=? and w.ev_distance<? <if test="powerlevel!=null">and t.ev_powerlevel=?</if> <if test="ssds!=null">and t.ev_ssds=?</if> <if test="loopname!=null">and t.ev_loopname=?</if>
### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
### The error may exist in file [E:\scgw\code\code\work\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\EVGlobeServer_SSM\WEB-INF\classes\com\evglobe\mapper\WireDistance.xml]
### The error may involve com.evglobe.mapper.WireDistanceMapper.getWireDistanceInfos-Inline
### The error occurred while setting parameters
### SQL: select t.ev_loopid loopid,t.ev_loopname loopname,t.ev_towername towername,t.ev_ssds ssds, t.ev_powerlevel powerlevel,t.ev_company company,t.ev_altitude altitude, w.ev_distance dis2ground,w.ev_wiredis wiredis from EV_SZJC_TOWERALTITUDE t,EV_COMMON_WIRETOGROUND w where t.ev_loopid=w.ev_loopid and t.ev_order=w.ev_order and t.ev_altitude>=? and t.ev_altitude<? and w.ev_distance>=? and w.ev_distance<? <if test="powerlevel!=null">and t.ev_powerlevel=?</if> <if test="ssds!=null">and t.ev_ssds=?</if> <if test="loopname!=null">and t.ev_loopname=?</if>
### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
xml中是这样写的:
<![CDATA[
select t.ev_loopid loopid,t.ev_loopname loopname,t.ev_towername towername,t.ev_ssds ssds,
t.ev_powerlevel powerlevel,t.ev_company company,t.ev_altitude altitude,
w.ev_distance dis2ground,w.ev_wiredis wiredis
from EV_SZJC_TOWERALTITUDE t,EV_COMMON_WIRETOGROUND w
where t.ev_loopid=w.ev_loopid and t.ev_order=w.ev_order
and t.ev_altitude>=#{minalt} and t.ev_altitude<#{maxalt}
and w.ev_distance>=#{mindis2ground} and w.ev_distance<#{maxdis2ground}
and t.ev_powerlevel=#{powerlevel}
<if test="powerlevel!=null">and t.ev_powerlevel=#{powerlevel,jdbcType=VARCHAR}</if>
<if test="ssds!=null">and t.ev_ssds=#{ssds,jdbcType=VARCHAR}</if>
<if test="loopname!=null">and t.ev_loopname=#{loopname,jdbcType=VARCHAR}</if>
]]>
<if test="powerlevel!=null">and t.ev_powerlevel=?</if> <if test="ssds!=null">and t.ev_ssds=?</if> <if test="loopname!=null">and t.ev_loopname=?</if> 你这段代码是不是在拼接sql的时候写错了。。。
切换数据源时没有调用切换代码!!!