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

📄 bsotherinfo.java

📁 一个网上购书系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.bookstore.other;

import com.bookstore.db.DBSource;
import com.bookstore.BookStoreConst;
import com.bookstore.util.StringUtil;

import java.io.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import java.util.Map;

/**
 * Created on 2006-5-18
 * @author zhangh
 *
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class BsOtherInfo
{

	DBSource		dbconn	= null;

	public BsOtherInfo(String pool) throws SQLException, IOException
	{
		dbconn = new DBSource();
		dbconn.Init(pool);
		if(pool==null)
		    pool = BookStoreConst.BOOKSTORESPOOL;
	}
	
	/**
	 * 添加送货方式
	 * @param paymentName
	 * @param fee
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addPayment(String paymentName,String fee)
	throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into product_payment_type(paymentName,fee) " +
				"VALUES('"+paymentName+"','"+fee+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 列出所有的送货方式
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllPayment()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from product_payment_type ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 修改送货方式
	 * @param id
	 * @param paymentName
	 * @param fee
	 * @throws SQLException
	 * @throws IOException
	 */
	public void modifyPayment(String id,
								String paymentName,
								String fee,String keepPrice,String time,String description)throws SQLException,IOException
	{
		String sql = "";
		sql = "update product_payment_type set paymentName = '"+paymentName+"'," +
				"fee='"+fee+"',keepPrice='"+keepPrice+"',time='"+time
				+"',description='"+description+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}
	
	/**
	 * 删除送货方式
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void deletePayment(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from product_payment_type where id = '"+id+"' ";		
		dbconn.execute(sql);
	}

	
	public void addMovieClassifySmall(String classifyBigId,String classifyName,String sort)
		throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into movie_classify_small(classifyBigId,classifyName,classifySort) " +
				"VALUES('"+classifyBigId+"','"+classifyName+"','"+sort+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 修改支付方式
	 * @param id
	 * @param classifyName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void modifyPaymentType(String id,
									String paymentName,String time,
									String description,String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update payment_type set paymentName = '"+paymentName+"',time='"+time+"'," +
				"description='"+description+"',sort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}

	/**
	 * 删除支付方式
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void delPaymentType(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from payment_type where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 添加支付方式
	 * @param paymentName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addPaymentType(String paymentName,String time,
								String description,String sort) throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into payment_type(paymentName,time,description,sort) " +
				"VALUES('"+paymentName+"','"+time+"','"+description+"','"+sort+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 列出所有的支付方式
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllPaymentType()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from payment_type order by sort ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 取出支付方式的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxSortPaymentType() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(sort) as sort from payment_type ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("sort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 取出省的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxProvince() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(sort) as sort from province ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("sort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 列出所有的省
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllProvince()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from province order by sort ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 添加省信息
	 * @param shengname
	 * @param shengno
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addProvince(String shengname,
							String shengno,
							String sort) throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into province(provinceName,provinceNumber,sort,createDate) " +
		"VALUES('"+shengname+"','"+shengno+"','"+sort+"','"+StringUtil.genDateTimeString()+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 修改省信息
	 * @param id
	 * @param shengname
	 * @param shengno
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void modifyProvince(String id,
								String shengname,
								String shengno,
								String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update province set provinceName = '"+shengname+"',provinceNumber='"+shengno+"'," +
				"sort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}
	
	/**
	 * 删除省信息
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void delProvince(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from province where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 取出合作伙伴的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxSortCollaborate() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(sort) as sort from collaborate ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("sort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 列出所有的合作伙伴
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllCollaborate()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from collaborate order by sort ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 添加合作伙伴
	 * @param netName
	 * @param netAddress
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addCollaborate(String netName,
								String netAddress,
								String sort) throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into collaborate(netName,netAddress,sort,createDate) " +
			"VALUES('"+netName+"','"+netAddress+"','"+sort+"','"+StringUtil.genDateTimeString()+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 修改合作伙伴
	 * @param id
	 * @param netName
	 * @param netAddress
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void modifyCollaborate(String id,
									String netName,
									String netAddress,
									String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update collaborate set netName = '"+netName+"',netAddress='"+netAddress+"'," +
			"sort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}
	
	/**
	 * 删除合作伙伴
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void delCollaborate(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from collaborate where id = '"+id+"' ";		
		dbconn.execute(sql);

⌨️ 快捷键说明

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