1.在ibtais的映射文件中的sql语句:
<select id="hotWords.totalCount" resultClass="java.lang.Object">
select count(*) from SEARCH_HOTWORDS where TIMEGROUP = 'tot'
</select>
-----------------------------------
2.在dao接口中的方法:
List findTotalCount();
在dao实现类中的方法:
public List findTotalCount() {
return getSqlMapClientTemplate().queryForList("hotWords.totalCount");
}
3.在service接口中的方法:
int findTotalCount();
在service实现类中的方法:
public int findTotalCount() {
List list=new ArrayList();
list=searchHotWordsDao.findTotalCount();
return ((BigDecimal) list.get(0)).intValue(); //----------这句是重点
}
4.在action中
int count=searchHotWordsService.findTotalCount();
就可以得到查询结果的值