mybatis List<Map> 格式传值对sql进行操作问题
SELECT"Cid","LineId","LineName","StationId","StationName","Position","Remark","Create...
SELECT
"Cid","LineId","LineName","StationId","StationName","Position","Remark",
"CreateTime","Creater","UpdateTime","Updater","TestFlag","Invalid"
FROM
"t"
WHERE "TestFlag" = 1
<if test="LineList != null">
<foreach collection="LineList" item="lineInfo">
and "LineId" = #{lineInfo.lineId,jdbcType=VARCHAR} and "StationId" = #{lineInfo.stationId,jdbcType=VARCHAR}
</foreach>
</if>
ORDER BY "UpdateTime" DESC
lineId和stationId为空,lineInfo里面有值 展开
"Cid","LineId","LineName","StationId","StationName","Position","Remark",
"CreateTime","Creater","UpdateTime","Updater","TestFlag","Invalid"
FROM
"t"
WHERE "TestFlag" = 1
<if test="LineList != null">
<foreach collection="LineList" item="lineInfo">
and "LineId" = #{lineInfo.lineId,jdbcType=VARCHAR} and "StationId" = #{lineInfo.stationId,jdbcType=VARCHAR}
</foreach>
</if>
ORDER BY "UpdateTime" DESC
lineId和stationId为空,lineInfo里面有值 展开
2015-06-30
展开全部
mybatis只管取值,根本就不会关心你的map里都有什么类型的数据。报错可能的情况是key对应的值与数据库的类型不匹配
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询