/** * WEBOPAC_读者空间_借阅管理_查看借阅信息_当前借阅信息 * @param readerId * @param lendStatus * @return */ public Page<WebOpacQueryVo> queryReaderLendRecordForTwo(Long readerId, Integer lendStatus,Pageable pageable) { StringBuilder sql=new StringBuilder(); MapSqlParameterSource paramSource = new MapSqlParameterSource(); StringBuilder countSql=new StringBuilder(); sql.append("select t.id,t.collection_id,c.status from READER_LEND_RECORD t , collection c where c.id = t.collection_id and t.reader_id =:readerId"); paramSource.addValue("readerId", readerId); sql.append(" and t.status =:lendStatus"); paramSource.addValue("lendStatus", lendStatus); System.out.println("WEBOPAC_读者空间_借阅管理_查看借阅信息_当前借阅信息 sql:" + sql); countSql.append("select count(*) from ("+ sql +")"); Page<WebOpacQueryVo> page = JdbcPaginationHelper.queryForPage(namedJdbcTemplate, pageable, sql.toString(), countSql.toString(), new RowMapper<WebOpacQueryVo>(){ public WebOpacQueryVo mapRow(ResultSet rs, int rowNum) throws SQLException { WebOpacQueryVo woqv = new WebOpacQueryVo(); woqv.setCollection(collectionDao.findOne(rs.getLong("collection_id"))); woqv.setCollectionStatus(sysDicDao.findByTypeAndKey(Constant.COLLECTION_STATUS, rs.getInt("status"))); woqv.setReaderLendRecord(readerLendRecordDao.findOne(rs.getLong("id"))); return woqv; }}); return page; } 打印出的sql WEBOPAC_读者空间_借阅管理_查看借阅信息_当前借阅信息 sql: select t.id,t.collection_id,c.status from READER_LEND_RECORD t , collection c where c.id = t.collection_id and t.reader_id =:readerId and t.status =:lendStatus readerId=921 和 lendStatus=2 debug的时候都不为空 看了半天看不出什么问题? |
|
20分 |
执行的时候paramSource参数没传进去
|