?? bsmusicinfo.java
字號:
*/
public void deleteLibrary(String id)throws SQLException,IOException
{
String sql = "";
sql = "delete from music_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 addMusic(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 musicLibraryId,
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 music_manager(userId,classifyBigId,classifySmallId,produce,tradeName,player," +
"director,author,price,isbn,stockNumber,produceDate,musicLibraryId,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+"','"+musicLibraryId+"','"+medium+"'" +
",'"+dishNumber+"','"+issueAddress+"','"+dub+"'" +
",'"+smallPicPath+"','"+bigPicPath+"','"+recommend+"','"+catalogue+"','"+contentSummary+"'" +
",'"+artistIntro+"','"+comment+"','"+type+"','"+StringUtil.genDateString()+"')";
dbconn.execute(sql);
}
/**
* 根據(jù)不同條件查詢音樂列表信息
* @param userId
* @param selectkey
* @param selectm
* @return Vector
* @throws SQLException
* @throws IOException
*/
public Vector getMusicByCondition(String userId,
String selectkey,
String selectm)throws SQLException,IOException
{
Vector v = null;
String sql = "";
sql = "select * from music_manager where userId='"+userId+"' ";
if(selectm.equals("tradeName"))//音樂名稱
sql = sql + " and tradeName='"+selectkey+"' ";
if(selectm.equals("contentSummary")) //音樂說明,內(nèi)容提要
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;
}
public int getBookCountByCondition(String userId,
String selectkey,
String selectm)throws SQLException,IOException
{
String sql = "";
sql = "select count(*) from music_manager where userId='"+userId+"' ";
if(selectm.equals("tradeName"))//音樂名稱
sql = sql + " and tradeName='"+selectkey+"' ";
if(selectm.equals("contentSummary")) //音樂說明,內(nèi)容提要
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 ";
ResultSet result = dbconn.executeQuery(sql);
if(result.next())
return result.getInt(1);
return 0;
}
public Vector getMusicByCondition(
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 music_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);
v = dbconn.ListOfMapData(sql);
return v;
}
public int getMusicCountByCondition(
String bigClassifyId,
String classifySmallId,String musicName,
String author,String isbn,String type)throws SQLException,IOException
{
String sql = "";
boolean isFirst = true;
sql = "select count(*) from music_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;
}
/**
* 根據(jù)不同條件查詢音樂列表信息
* @param userId
* @param selectkey
* @param selectm
* @return Vector
* @throws SQLException
* @throws IOException
*/
public Vector getMusicByCondition(String userId,
String selectkey,
String selectm,int begin,int end)throws SQLException,IOException
{
Vector v = null;
String sql = "";
sql = "select * from music_manager where userId='"+userId+"' ";
if(selectm.equals("tradeName"))//音樂名稱
sql = sql + " and tradeName='"+selectkey+"' ";
if(selectm.equals("contentSummary")) //音樂說明,內(nèi)容提要
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 limit "+begin+" , "+(end=begin);
v = dbconn.ListOfMapData(sql);
return v;
}
/**
* 刪除音樂
* @param id
* @throws SQLException
* @throws IOException
*/
public void deleteMusic(String id)throws SQLException,IOException
{
String sql = "";
sql = "delete from music_manager where id = '"+id+"' ";
dbconn.execute(sql);
}
/**
* 找出ID相對應(yīng)的音樂對象
* @param id
* @return Vector
* @throws SQLException
* @throws IOException
*/
public Vector getMusicById(String id)throws SQLException,IOException
{
Vector v = null;
String sql = "";
sql = "select * from music_manager where id='"+id+"' ";
v = dbconn.ListOfMapData(sql);
return v;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -