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

📄 bsmovieinfo.java

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

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.util.Vector;
import java.util.Map;

/**
 * Created on 2006-5-18
 * @author zhangh
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class BsMovieInfo
{

	DBSource		dbconn	= null;

	public BsMovieInfo(String pool) throws SQLException, IOException
	{
		dbconn = new DBSource();
		dbconn.Init(pool);
		if(pool==null)
		    pool = BookStoreConst.BOOKSTORESPOOL;
	}
	
	/**
	 * 添加影视大类
	 * @param classifyName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addMovieClassifyBig(String classifyName,String sort)
	throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into movie_classify_big(classifyName,classifySort) " +
				"VALUES('"+classifyName+"','"+sort+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 列出所有的影视大类
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllMovieClassifyBig()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from movie_classify_big order by classifySort ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 根据ID找出相对应的影视大类名称
	 * @param bigId
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getNameByClassifyBigId(String bigId) throws SQLException,IOException
	{
		Vector v = null;
		String classifyName = "";
		String sql = "";	
		sql = "select classifyName from movie_classify_big where id = '"+bigId+"' ";		
		v = dbconn.ListOfMapData(sql);
		if(v.size()>0)
		{
			Map map = (Map)v.get(0);
			classifyName = (String)map.get("classifyName");
		}
		
		return classifyName;
	}
	
	/**
	 * 修改影视大类
	 * @param id
	 * @param classifyName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void modifyMovieClassifyBig(String id,
										String classifyName,
										String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update movie_classify_big set classifyName = '"+classifyName+"'," +
				"classifySort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}
	
	/**
	 * 删除影视大类
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void deleteMovieClassifyBig(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from movie_classify_big where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 取出影视大类的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxSortClassifyBig() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(classifySort) as classifySort from movie_classify_big ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("classifySort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 列出所有影视大类对应的小类
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getMovieClassifySmallByBigId(String classifyBigId)throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from movie_classify_small where classifyBigId='"+classifyBigId+"' " +
				"order by classifySort ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 根据ID找出相对应的影视小类
	 * @param smallId
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getNameByClassifySmallId(String smallId) throws SQLException,IOException
	{
		Vector v = null;
		String classifyName = "";
		String sql = "";	
		sql = "select classifyName from movie_classify_small where id = '"+smallId+"' ";		
		v = dbconn.ListOfMapData(sql);
		if(v.size()>0)
		{
			Map map = (Map)v.get(0);
			classifyName = (String)map.get("classifyName");
		}
		
		return classifyName;
	}
	
	/**
	 * 列出影视小类的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxSortClassifySmall() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(classifySort) as classifySort from movie_classify_small ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("classifySort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 添加影视小类
	 * @param classifyBigId
	 * @param classifyName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	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 modifyMovieClassifySmall(String id,
											String classifyName,
											String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update movie_classify_small set classifyName = '"+classifyName+"'," +
			"classifySort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}

	/**
	 * 删除影视小类
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void deleteMovieClassifySmall(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from movie_classify_small where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 添加馆区信息
	 * @param libraryName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addLibrary(String libraryName,
			String sort) throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into movie_library_manager(libraryName,librarySort) " +
		"VALUES('"+libraryName+"','"+sort+"')";
		dbconn.execute(sql);
	}
	
	/**
	 * 根据ID找到相对应的馆区名称
	 * @param id
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getNameByLibraryId(String id) throws SQLException,IOException
	{
		Vector v = null;
		String classifyName = "";
		String sql = "";	
		sql = "select libraryName from movie_library_manager where id = '"+id+"' ";		
		v = dbconn.ListOfMapData(sql);
		if(v.size()>0)
		{
			Map map = (Map)v.get(0);
			classifyName = (String)map.get("libraryName");
		}
		
		return classifyName;
	}
	
	
	/**
	 * 列出所有的馆区信息
	 * @return
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getAllLibrary()throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from movie_library_manager order by librarySort ";
		
		v = dbconn.ListOfMapData(sql);
	 
		return v;
	}
	
	/**
	 * 取出馆区信息的最大序号
	 * @return String
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMaxSortLibrary() throws SQLException,IOException
	{
		Vector v = null;
		String sort = "";
		String sql = "";	
		sql = "select max(librarySort) as classifySort from movie_library_manager ";
		v = dbconn.ListOfMapData(sql);
		Map map = (Map)v.get(0);
		sort = (String)map.get("classifySort");
		if(sort == null)sort="0";
		return sort;
	}
	
	/**
	 * 修改馆区信息
	 * @param id
	 * @param libraryName
	 * @param sort
	 * @throws SQLException
	 * @throws IOException
	 */

⌨️ 快捷键说明

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