分页查询

package com.huawei.store.ftp.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.huawei.store.ftp.dao.GoodsReportFormsDao;
import com.huawei.store.ftp.model.ApInfo;
import com.huawei.store.ftp.model.ApUserInfo;
import com.huawei.store.ftp.model.AppReportInfo;
import com.huawei.store.ftp.model.Packagemachinemap;

/**
* ClassName: GoodsReportFormsDaoImpl
* Description:天翼空间,应用信息(包括应用名称、机型、平台等)数据库查询
* Copyright © Huawei Technologies Co.,Ltd. 2010. All rights reserved. Company:Huawei Technologies Co.
* @author sunsh
* @version AppStoreV100R001CO2B05SP07
* @Date Jun 24, 2010
*/
public class GoodsReportFormsDaoImpl extends SqlMapClientDaoSupport implements GoodsReportFormsDao
{
/**
* Description:分页获取应用与平台映射信息
* @return 应用与平台映射信息
* @throws DataAccessException 数据库操作异常
* @author sun shihai
* @param packagemachinemap 分页查询数据的条件
* @date Aug 21, 2010
*/
@SuppressWarnings("unchecked")
public List<Packagemachinemap> queryGoodsType(Packagemachinemap packagemachinemap) throws DataAccessException
{
return this.getSqlMapClientTemplate().queryForList("ftp.queryPackagemachinemap", packagemachinemap);
}


/**
* Description:月消费统计批量入库
* @param apList 月消费统计批量入库数据
* @throws SQLException数据库操作异常
* @author sun shihai
* @date 2010-10-20
*/
public void saveApbalanceInfos(final List<ApBalance> apbalanceList, final int maxSize) throws SQLException
{
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException
{
executor.startBatch();
int count = 0;
for (ApBalance apBalance : apbalanceList)
{
executor.insert("ftp.saveApbalanceInfos", apBalance);
count++;
if (count == maxSize)
{
executor.executeBatch();
count = 0;
}
}
executor.executeBatch();

return null;
}
});
}


/**
* Description:月消费统计批量更改
* @param apBalanceListUpdate月消费统计批量更改数据
* @throws SQLException数据库操作异常
* @author sun shihai
* @date 2010-10-20
*/
public void updateApBalanceInfos(final List<ApBalance> apBalanceListUpdate, final int maxSize) throws SQLException
{
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException
{
executor.startBatch();
int count = 0;
for (ApBalance apBalance : apBalanceListUpdate)
{
executor.update("ftp.updateApBalanceInfos", apBalance);
count++;
if (count == maxSize)
{
executor.executeBatch();
count = 0;
}
}
executor.executeBatch();

return null;
}
});
}

}


ibaties.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="ftp">
<typeAlias type="com.huawei.store.ftp.model.PackageProductMapInfo" alias="packageProductMapInfo" />
<typeAlias type="com.huawei.store.ftp.model.UserInfo" alias="userInfo" />
<typeAlias type="com.huawei.store.ftp.model.OrderDetailModel" alias="orderDetail" />
<typeAlias type="com.huawei.store.ftp.model.StoreInfo" alias="storeInfo" />
<typeAlias type="com.huawei.store.ftp.model.RegisterUserInfo" alias="registerUserInfo" />
<typeAlias type="com.huawei.store.ftp.model.Packagemachinemap" alias="packagemachinemap" />

<!-- **********************************************************************************
模块: ftp
功能: 获取平台关联信息
REVISIONS: 1.3
Ver Date Author Description
********* *********** ********* *********************
D20 2010-08-21 sun shihai 1.获取所有软件包与机型映射信息
NOTES:
***********************************************************************************-->
<select id="queryPackagemachinemap" resultClass="packagemachinemap" parameterClass="packagemachinemap">
<![CDATA[
select package_id packageId,
machine_id machineId,
adapter_flag adapterFlag,
app_id appId,
os_id osId,
brand_id brandId,
screen_id screnId,
screensize_id screnSizeId
from (select rownum rn,
package_id,
machine_id,
adapter_flag,
app_id,
os_id,
brand_id,
screen_id,
screensize_id
from (select package_id,
machine_id,
adapter_flag,
app_id,
os_id,
brand_id,
screen_id,
screensize_id
from t_packagemachinemap
)
where rownum <= (#startIndex# + #maxIndex# - 1)
)
where rn between #startIndex#
and (#startIndex# + #maxIndex# - 1)
]]>
</select>


<!-- **********************************************************************************
模块: ftp
功能: 根据结算消费记录表生成月销售统计
REVISIONS: 1.3
Ver Date Author Description
********* *********** ********* *********************
D20 2010-08-21 wuyulin 根据结算消费记录表生成月销售统计
NOTES:
***********************************************************************************-->
<insert id="saveApbalanceInfos" parameterClass="apBalance">
insert into t_apbalance (bill_id,
org_id,
refer_id,
balance_date,
balance_period,
status,
sale_all_count,
sale_free_count,
sale_charge_count,
tax, bad_balance,
divide_percent,
sale_money_count,
devide_money,
real_dividemoney,
account_id,
account_name,
blank_name,
upbill_id)
values (#billId#,
#orgId#,
#referId#,
#balanceDate#,
#balancePeriod#,
#status#,
#saleAllCount#,
#saleFreeCount#,
#saleChargeCount#,
#tax#,
#badBalance#,
#dividePercent#,
#saleMoneyCount#,
#devideMoney#,
#realDivideMoney#,
#accountId#,
#accountName#,
#blankName#,
#upbillId#)
</insert>
</sqlMap>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值