<select id = "IbatisMposCompanyDAO.queryUsedMpos"
resultClass = "com.taobao.logistics.domain.result.MposManageResult"
parameterClass = "com.taobao.logistics.domain.query.MposQuery">
<![CDATA[
SELECT
t2.mpos_id as mposId,
t2.mpos_no as mposNo,
t2.sim_no as simNo,
t2.type as type,
t2.manufacturer as manufacturer,
t2.status as status,
t1.user_id as op_userId,
t1.company_id as companyId,
t1.station_no as stationNo,
t1.station as station
FROM lg_mpos_company t1, lg_mpos t2
WHERE
t1.status = 2
AND ti.status = t2.status
AND t1.mpos_id = t2.mpos_id
]]>
<dynamic prepend="">
<isNotNull prepend="AND" property="mposNo">
<![CDATA[ t2.mpos_no = #mposNo# ]]>
</isNotNull>
<isNotNull prepend="AND" property="manufacturer">
<![CDATA[ t2.manufacturer = #manufacturer# ]]>
</isNotNull>
<isNotNull prepend="AND" property="companyId">
<![CDATA[ t1.company_id = #companyId# ]]>
</isNotNull>
</dynamic>
<![CDATA[
Order By t2.gmt_modified Desc
]]>
</select>
大家帮我看下这个语句有什么问题没,为后面我运行老是不成功?
resultClass = "com.taobao.logistics.domain.result.MposManageResult"
parameterClass = "com.taobao.logistics.domain.query.MposQuery">
<![CDATA[
SELECT
t2.mpos_id as mposId,
t2.mpos_no as mposNo,
t2.sim_no as simNo,
t2.type as type,
t2.manufacturer as manufacturer,
t2.status as status,
t1.user_id as op_userId,
t1.company_id as companyId,
t1.station_no as stationNo,
t1.station as station
FROM lg_mpos_company t1, lg_mpos t2
WHERE
t1.status = 2
AND ti.status = t2.status
AND t1.mpos_id = t2.mpos_id
]]>
<dynamic prepend="">
<isNotNull prepend="AND" property="mposNo">
<![CDATA[ t2.mpos_no = #mposNo# ]]>
</isNotNull>
<isNotNull prepend="AND" property="manufacturer">
<![CDATA[ t2.manufacturer = #manufacturer# ]]>
</isNotNull>
<isNotNull prepend="AND" property="companyId">
<![CDATA[ t1.company_id = #companyId# ]]>
</isNotNull>
</dynamic>
<![CDATA[
Order By t2.gmt_modified Desc
]]>
</select>
大家帮我看下这个语句有什么问题没,为后面我运行老是不成功?
你的sql先在数据库中测试,好用了,再拿到ibatis中
在LOG4J的配置文件中新增以下信息,用于显示执行查询时的SQL语句及其参数,然后将SQL语句和参数在数据库中执行看结果
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG