CustfeeAction.java 内容
/**
* 查找用户缴费记录
*
* @return
*/
public String findAllCustfeeByCustomer() {
String strCustomerId = getRequest().getParameter("customerId");
Custfee custfee = new Custfee();
if (strCustomerId != null && !"".equals(strCustomerId)) {
custfee.setCustomerId(Integer.valueOf(strCustomerId));
}
page = new Page();
page.setObjCondition(custfee);
int start = Integer.valueOf(getRequest().getParameter("start"));
int limit = Integer.valueOf(getRequest().getParameter("limit"));
page.setStart(++start);
page.setLimit(limit = limit == 0 ? 10 : limit);
page = custfeeService.findByCustomer(page);
System.out.print(page);
return SUCCESS;
}
Custfee.xml
<sql id="findCustfeeByCustomerCondition">
<isNotNull property="objCondition">
<![CDATA[
customerId = #objCondition.customerId:NUMBER#
]]>
</isNotNull>
</sql>
<select id="findByCustomer" parameterClass="page" resultClass="custfee">
<![CDATA[
SELECT TOP $limit$ * FROM tbl_custfee
WHERE (custfeeId >= (SELECT MAX(custfeeId) FROM (SELECT TOP $start$ custfeeId FROM tbl_custfee
]]>
<dynamic prepend="WHERE">
<include refid="findCustfeeByCustomerCondition" />
</dynamic>
<![CDATA[
ORDER BY custfeeId ) AS T))
]]>
<dynamic prepend="AND">
<include refid="findCustfeeByCustomerCondition" />
</dynamic>
<![CDATA[
ORDER BY custfeeId
]]>
</select>
<select id="findCountByCustomer" parameterClass="page" resultClass="int">
<![CDATA[
SELECT COUNT(*) FROM tbl_custfee
]]>
<dynamic prepend="WHERE">
<include refid="findCustfeeByCustomerCondition" />
</dynamic>
</select>
CustfeeDao.java
/*
* 分页查找用户抄表信息记录总数
*/
@Override
public int findCountByCustomer(Page page) {
return (Integer) getSqlMapClientTemplate().queryForObject("Custfee.findCountByCustomer", page);
}
/*
* 分页查找用户抄表信息记录
*/
@Override
public List findByCustomer(Page page) {
return getSqlMapClientTemplate().queryForList("Custfee.findByCustomer",page);
}
蒸腾了半天才发现是service 的错误..
CustfeeDao.java
public Page findByCustomer(Page page) {
page.setRoot(custfeeDao.findByCustomer(page));
page.setTotalProperty(custfeeDao.findCountByCustomer(page));
return null;
}
ruturn null
应为ruturn page
万恶的COPY.