<!-- 普铁 --><select id="selectTrainSceneThrough" parameterType="HashMap" resultType="HashMap">select ROUND(("普铁用户专网总流量KB"+"普铁用户公网总流量KB")/1024/1024,3) as total_dataflow,"普铁用户数" as total_users from RPT_NETWORK_HOURwhere "日期"='#{kpi_time}'and "线路标识"=#{road_id}</select>
提示“无效的索引列”
而
<select id="selectCRHSceneThrough" parameterType="HashMap" resultType="HashMap">select *from RPT_NETWORK_HOURwhere report_id=#{road_id}</select>
运行正常
起初以为是#和$的问题,后来知道是中文引起的。
解决方法一:
文件头是 <?xml version="1.0" encoding="UTF-8" ?> 改成 <?xml version="1.0" encoding="GBK" ?>
该方法不一定有效时选择方法二
用${} 代替 #{}
<select id="selectCRHSceneThrough" parameterType="HashMap" resultType="HashMap">select ROUND(("高铁用户专网总流量KB"+"高铁用户公网总流量KB")/1024/1024,3) as total_dataflow,"高铁用户数" as total_users from RPT_NETWORK_HOURwhere "日期"='${kpi_time}'and "线路标识"=${road_id}</select>
只是会在日志里直接打印出完整的sql。完全降低了。
-------------
更多的Java,Angular,Android,大数据,J2EE,Python,数据库,Linux,Java架构师,:
http://www.cnblogs.com/zengmiaogen/p/7083694.html