⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 merchantbizgroupmemberdao.java

📁 基于struts的网上商店源码
💻 JAVA
字号:
/*
 * 作者:刘云云
 * 时间:2007年11月21日
 * 功能:显示商圈的商家成员
 */
package com.mole.struts.dao;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Iterator;

import com.mole.struts.bean.MerchantBizGroupMemberBean;

public class MerchantBizGroupMemberDAO extends AbstractPageDAO {

	public MerchantBizGroupMemberDAO() {
	}

	public MerchantBizGroupMemberDAO(String column, String where, String id,
			String group, String order, int pageSize) {
		this.setColumnCondition(column);
		this.setWhereCondition(where);
		this.setIdCondition(id);
		this.setGroupCondition(group);
		this.setOrderCondition(order);
		this.setPageSize(pageSize);
	}

	// 获取商圈成员的记录集
	public MerchantBizGroupMemberBean[] getBizGroupMemberPage() {
		ArrayList<Object[]> arrayList = this.executeQuery(getSql());
		if (arrayList == null)
			return null;

		MerchantBizGroupMemberBean[] records = new MerchantBizGroupMemberBean[arrayList
				.size()];
		if (records.length == 0)
			return records;

		Iterator<Object[]> it = arrayList.iterator();
		int i = 0;
		while (it.hasNext()) {
			Object[] obj = it.next();
			MerchantBizGroupMemberBean record = new MerchantBizGroupMemberBean();
			record.setStoreId(obj[0].toString());
			record.setStoreName(obj[1].toString());
			record.setTelephone(obj[2].toString());
			record.setAddress(obj[3].toString());
			records[i++] = record;
		}
		return records;
	}

	// 获取商圈类型为积分互认的成员的记录集
	public MerchantBizGroupMemberBean[] getBizGroupScoreDiscountPage() {
		ArrayList<Object[]> arrayList = this.executeQuery(getSql());
		if (arrayList == null)
			return null;

		MerchantBizGroupMemberBean[] records = new MerchantBizGroupMemberBean[arrayList
				.size()];
		if (records.length == 0)
			return records;

		Iterator<Object[]> it = arrayList.iterator();
		int i = 0;
		while (it.hasNext()) {
			Object[] obj = it.next();
			MerchantBizGroupMemberBean record = new MerchantBizGroupMemberBean();
			record.setStoreId(obj[0].toString());
			record.setStoreName(obj[1].toString());
			record.setTelephone(obj[2].toString());
			record.setAddress(obj[3].toString());
			record.setDescription(obj[4].toString());
			record.setScoreA(obj[5].toString());
			record.setDiscountA(obj[6].toString());
			record.setScoreB(obj[7].toString());
			record.setDiscountB(obj[8].toString());
			records[i++] = record;
		}
		return records;
	}

	// 获取商圈类型为代发优惠券的成员的记录集
	public MerchantBizGroupMemberBean[] getBizGroupVoucherPage() {
		ArrayList<Object[]> arrayList = this.executeQuery(getSql());
		if (arrayList == null)
			return null;

		MerchantBizGroupMemberBean[] records = new MerchantBizGroupMemberBean[arrayList
				.size()];
		if (records.length == 0)
			return records;

		Iterator<Object[]> it = arrayList.iterator();
		int i = 0;
		while (it.hasNext()) {
			Object[] obj = it.next();
			MerchantBizGroupMemberBean record = new MerchantBizGroupMemberBean();
			record.setStoreId(obj[0].toString());
			record.setStoreName(obj[1].toString());
			record.setTelephone(obj[2].toString());
			record.setAddress(obj[3].toString());
			record.setDescription(obj[4].toString());
			record.setVoucherName(obj[5].toString());
			record.setVoucherAmount(obj[6].toString());
			records[i++] = record;
		}
		return records;
	}

	// 获取商圈类型为共同承诺折扣的成员的记录集
	public MerchantBizGroupMemberBean[] getBizGroupDiscountPage() {
		ArrayList<Object[]> arrayList = this.executeQuery(getSql());
		if (arrayList == null)
			return null;

		MerchantBizGroupMemberBean[] records = new MerchantBizGroupMemberBean[arrayList
				.size()];
		if (records.length == 0)
			return records;

		Iterator<Object[]> it = arrayList.iterator();
		int i = 0;
		while (it.hasNext()) {
			Object[] obj = it.next();
			MerchantBizGroupMemberBean record = new MerchantBizGroupMemberBean();
			record.setStoreId(obj[0].toString());
			record.setStoreName(obj[1].toString());
			record.setTelephone(obj[2].toString());
			record.setAddress(obj[3].toString());
			record.setDescription(obj[4].toString());
			record.setDiscount(obj[5].toString());
			records[i++] = record;
		}
		return records;
	}

	// 设置商圈类型为积分互认的成员的商圈活动
	public int executeScoreDiscountPro(String bizgroupId, String storeA,
			int scoreA, String discountA, String storeB, int scoreB,
			String discountB) throws Exception {
		CallableStatement stmt = null;
		Connection conn = getConn();
		try {
			conn.setAutoCommit(true);
			stmt = conn
					.prepareCall("{call sp_MerchantBGScoreDiscountPro(?,?,?,?,?,?,?)}");
			stmt.setString(1, bizgroupId);
			stmt.setString(2, storeA);
			stmt.setInt(3, scoreA);
			stmt.setString(4, discountA);
			stmt.setString(5, storeB);
			stmt.setInt(6, scoreB);
			stmt.setString(7, discountB);
			stmt.executeUpdate();
			return 1;
		} finally {
			if (stmt != null)
				stmt.close();
		}
	}

	// 设置商圈类型为代发优惠券的成员的商圈活动
	public int executeVoucherPro(String bizGroupId, String storeId,
			int voucherId, int amount) throws Exception {
		CallableStatement stmt = null;
		Connection conn = getConn();
		try {
			conn.setAutoCommit(true);
			stmt = conn.prepareCall("{call sp_MerchantBGVoucherPro(?,?,?,?)}");
			stmt.setString(1, bizGroupId);
			stmt.setString(2, storeId);
			stmt.setInt(3, voucherId);
			stmt.setInt(4, amount);
			stmt.executeUpdate();
			return 1;
		} finally {
			if (stmt != null)
				stmt.close();
		}
	}

	// 设置商圈类型为共同承诺折扣的成员的商圈活动
	public int executeDiscountPro(String bizGroupId, String storeId,
			String discount) throws Exception {
		CallableStatement stmt = null;
		Connection conn = getConn();
		try {
			conn.setAutoCommit(true);
			stmt = conn.prepareCall("{call sp_MerchantBGDiscountPro(?,?,?)}");
			stmt.setString(1, bizGroupId);
			stmt.setString(2, storeId);
			stmt.setString(3, discount);
			stmt.executeUpdate();
			return 1;
		} finally {
			if (stmt != null)
				stmt.close();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -