使用iBatis 取得数据返回Page为空

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.

   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值