📄 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);
}
/**
* 根据不同条件查询音乐列表信息
* @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")) //音乐说明,内容提要
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")) //音乐说明,内容提要
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;
}
/**
* 根据不同条件查询音乐列表信息
* @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")) //音乐说明,内容提要
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相对应的音乐对象
* @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;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -