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

📄 bsmovieinfo.java

📁 一个网上购书系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	public void modifyLibrary(String id,
				String libraryName,
				String sort)throws SQLException,IOException
	{
		String sql = "";
		sql = "update movie_library_manager set libraryName = '"+libraryName+"'," +
			"librarySort='"+sort+"' where id='"+id+"' ";	
		dbconn.execute(sql);
	}
	/**
	 * 删除馆区信息
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void deleteLibrary(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from movie_library_manager where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 添加新影视
	 * @param userId
	 * @param classifyBigId
	 * @param classifySmallId
	 * @param produce
	 * @param tradeName
	 * @param player
	 * @param director
	 * @param author
	 * @param price
	 * @param isbn
	 * @param stockNumber
	 * @param produceDate
	 * @param musicLibraryId
	 * @param medium
	 * @param dishNumber
	 * @param issueAddress
	 * @param dub
	 * @param smallPicPath
	 * @param bigPicPath
	 * @param recommend
	 * @param catalogue
	 * @param contentSummary
	 * @param artistIntro
	 * @param comment
	 * @param type
	 * @throws SQLException
	 * @throws IOException
	 */
	public void addMovie(String userId,
							String classifyBigId,
							String classifySmallId,
							String produce,
							String tradeName,
							String player,
							String director,
							String author,
							String price,
							String isbn,
							String stockNumber,
							String produceDate,
							String movieLibraryId,
							String medium,
							String dishNumber,
							String issueAddress,
							String dub,
							String smallPicPath,
							String bigPicPath,
							String recommend,
							String catalogue,
							String contentSummary,
							String artistIntro,
							String comment,
							String type) throws SQLException,IOException
	{
		String sql = "";
		sql = "insert into movie_manager(userId,classifyBigId,classifySmallId,produce,tradeName,player," +
				"director,author,price,isbn,stockNumber,produceDate,movieLibraryId,medium,dishNumber," +
				"issueAddress,dub,smallPicPath,bigPicPath,recommend,catalogue,contentSummary,artistIntro," +
				"comment,type,createDate) " +
				"VALUES('"+userId+"','"+classifyBigId+"','"+classifySmallId+"','"+produce+"','"+tradeName+"'" +
				",'"+player+"','"+director+"','"+author+"','"+price+"'" +
				",'"+isbn+"','"+stockNumber+"','"+produceDate+"','"+movieLibraryId+"','"+medium+"'" +
						",'"+dishNumber+"','"+issueAddress+"','"+dub+"'" +
				",'"+smallPicPath+"','"+bigPicPath+"','"+recommend+"','"+catalogue+"','"+contentSummary+"'" +
						",'"+artistIntro+"','"+comment+"','"+type+"','"+StringUtil.genDateString()+"')";
		
		dbconn.execute(sql);
	}
	
	/**
	 * 根据不同条件查询影视列表信息
	 * @param userId
	 * @param selectkey
	 * @param selectm
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getMovieByCondition(String userId,
										String selectkey,
										String selectm)throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from movie_manager where userId='"+userId+"' ";
		if(selectm.equals("tradeName"))//影视名称
		sql = sql + " and tradeName='"+selectkey+"' ";
		if(selectm.equals("contentSummary")) //影视说明,内容提要
		sql = sql + " and contentSummary like '%"+selectkey+"%' ";
		if(selectm.equals("musicId")) //影视序号
		sql = sql + " and id='"+selectkey+"' ";
		
		if(selectm.equals("1"))
		sql = sql + " and type like '%1%'";
		if(selectm.equals("2"))
		sql = sql + " and type like '%2%'";
		if(selectm.equals("3"))
		sql = sql + " and type like '%3%'";
		
		sql = sql + "order by createDate ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	/**
	 * 删除影视
	 * @param id
	 * @throws SQLException
	 * @throws IOException
	 */
	public void deleteMovie(String id)throws SQLException,IOException
	{
		String sql = "";	
		sql = "delete from movie_manager where id = '"+id+"' ";		
		dbconn.execute(sql);
	}
	
	/**
	 * 找出ID相对应的影视对象
	 * @param id
	 * @return Vector
	 * @throws SQLException
	 * @throws IOException
	 */
	public Vector getMovieById(String id)throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		sql = "select * from movie_manager where id='"+id+"' ";
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	public Vector getMovieByCondition(
			String bigClassifyId,
			String classifySmallId,String musicName,
			String author,String isbn,String type,int begin,int end)throws SQLException,IOException
	{
		Vector v = null;
		String sql = "";	
		boolean isFirst = true;
		sql = "select * from movie_manager ";
		String condition = "";
		
		if(bigClassifyId!=null)
		{
			isFirst=false;
			condition +=" classifyBigId = "+bigClassifyId+" ";
		}
		
		if(classifySmallId!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" classifySmallId = "+classifySmallId+" ";
		}
		
		if(musicName!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" tradeName like '%"+musicName+"%' ";
		}
		
		if(author!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" author like '%"+author+"%' ";
		}
		
		if(isbn!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" isbn like '%"+isbn+"%' ";
		}
		
		if(type!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" type like '%"+type+"%' ";
		}
		if(!"".equals(condition))
		{
			sql += " where "+condition;
		}
		sql = sql + "order by createDate LIMIT "+begin+","+(end-begin);
		System.out.println("sql"+sql);
		v = dbconn.ListOfMapData(sql);
		return v;
	}
	
	public int getMovieCountByCondition(
			String bigClassifyId,
			String classifySmallId,String musicName,
			String author,String isbn,String type)throws SQLException,IOException
	{
		String sql = "";	
		boolean isFirst = true;
		sql = "select count(*) from movie_manager ";
		String condition = "";
		
		if(bigClassifyId!=null)
		{
			isFirst=false;
			condition +=" classifyBigId = "+bigClassifyId+" ";
		}
		
		if(classifySmallId!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" classifySmallId = "+classifySmallId+" ";
		}
		
		if(musicName!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" tradeName like '%"+musicName+"%' ";
		}
		
		if(author!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" author like '%"+author+"%' ";
		}
		
		if(isbn!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" isbn like '%"+isbn+"%' ";
		}
		
		if(type!=null)
		{
			if(!isFirst)
			{
				condition +=" and ";
			}
			isFirst=false;
			condition +=" type like '%"+type+"%' ";
		}
		if(!"".equals(condition))
		{
			sql += " where "+condition;
		}
		sql = sql + "order by createDate";
		ResultSet result = dbconn.executeQuery(sql);
		if(result.next())
			return result.getInt(1);
		return 0;
	}
	
	/**
	 * 根据馆名列出电影大类
	 * @return String
	 * @param name 馆名
	 * @throws SQLException
	 * @throws IOException
	 */
	public String getMovieClassifyBigByLibraryName(String name)throws SQLException,IOException
	{
		String sql = "";	
		sql = "select * from movie_classify_big where classifyName='"+name+"' order by classifySort ";
		ResultSet result = dbconn.executeQuery(sql);
		if(result.next())
			return result.getString(1);
		return null;
	}
}

⌨️ 快捷键说明

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