第一篇:高校圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)概念結(jié)構(gòu)和邏輯結(jié)構(gòu)設(shè)計(jì)
高校圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)概念結(jié)構(gòu)和邏輯結(jié)構(gòu)設(shè)計(jì)
一、概念結(jié)構(gòu)設(shè)計(jì)
1、分E-R圖設(shè)計(jì)
針對(duì)讀者注冊(cè)局部應(yīng)用,運(yùn)用分類和聚集的方法可得“讀者”和“讀者類別”實(shí)體集,其E-R圖如圖1所示。
圖1 “讀者”和“讀者類別” E-R圖
針對(duì)借書(shū)和還書(shū)局部應(yīng)用,運(yùn)用分類和聚集的方法可得“讀者”和“圖書(shū)”實(shí)體集,其E-R圖如圖2所示。
圖2 “讀者”和“圖書(shū)” E-R圖
2、總E-R圖設(shè)計(jì)
將圖1和圖2中的分E-R圖集成,可得總E-R圖,如圖3所示。
圖3 高校圖書(shū)管理系統(tǒng)總E-R圖
二、邏輯結(jié)構(gòu)設(shè)計(jì)
將高校圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)概念結(jié)構(gòu)轉(zhuǎn)換成關(guān)系模型,可得高校圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)邏輯結(jié)構(gòu),結(jié)果如下:
讀者類別(類別代碼,類別名稱,可借閱天數(shù),可借閱數(shù)量,超期罰款額)讀者(卡號(hào),姓名,性別,部門,辦卡日期,卡狀態(tài),類別代碼)圖書(shū)(書(shū)號(hào),書(shū)名,作者,出版社,價(jià)格,庫(kù)存數(shù)量)借還(卡號(hào),書(shū)號(hào),借書(shū)日期,還書(shū)日期)
第二篇:圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)設(shè)計(jì)
數(shù)據(jù)庫(kù)設(shè)計(jì).................................................................2 3.1 專門術(shù)語(yǔ)的定義...................................................2 3.1.1 系統(tǒng)中常用的術(shù)語(yǔ)(或使用頻率較高的術(shù)語(yǔ)).........................2 3.1.2 表格定義及規(guī)范.................................................2 3.1.2.1數(shù)據(jù)約定.....................................................2 3.1.2.2表和表字段命名規(guī)范:.........................................3 3.2 數(shù)據(jù)設(shè)計(jì).........................................................3 3.2.1 數(shù)據(jù)流程圖設(shè)計(jì).................................................3 3.2.2實(shí)體關(guān)系結(jié)構(gòu)設(shè)計(jì)...............................................4 3.3安全保密設(shè)計(jì).....................................................6 3.3.1 邏輯上的安全保密...............................................6 3.3.2 物理上的安全保密...............................................6 3.4 表格與功能模塊相關(guān)性分析.........................................7 3.5 表格定義.........................................................7 數(shù)據(jù)庫(kù)設(shè)計(jì)
3.1 專門術(shù)語(yǔ)的定義
暫無(wú)
3.1.1 系統(tǒng)中常用的術(shù)語(yǔ)(或使用頻率較高的術(shù)語(yǔ))暫無(wú)
3.1.2 表格定義及規(guī)范 3.1.2.1數(shù)據(jù)約定
所有數(shù)據(jù)項(xiàng)都用英文、漢語(yǔ)拼音或縮寫(xiě)表示,數(shù)據(jù)庫(kù)名稱除外。
所有字段在設(shè)計(jì)時(shí),除以下數(shù)據(jù)類型timestamp、image、datetime、smalldatetime、uniqueidentifier、binary、sql_variant、binary、varbinary外,必須有默認(rèn)值。字符型的默認(rèn)值為一個(gè)空字符值串;數(shù)值型的默認(rèn)值為數(shù)值0;邏輯型的默認(rèn)值為數(shù)值0;
其中:系統(tǒng)中所有邏輯型中數(shù)值0表示為“假”;數(shù)值1表示為“真”。datetime、smalldatetime類型的字段沒(méi)有默認(rèn)值,必須為NULL。當(dāng)字段定義為字符串形時(shí)建議使用varchar而不用nvarchar。建議在大多數(shù)表中(如報(bào)銷單,申請(qǐng)單),應(yīng)都有以下字段: 字段名說(shuō)明類型默認(rèn)值 CreatorID創(chuàng)建者int CreatedTime創(chuàng)建時(shí)間DatetimeNULL 字符集采用 UTF-8,請(qǐng)注意字符的轉(zhuǎn)換。
所有數(shù)據(jù)表第一個(gè)字段都是系統(tǒng)內(nèi)部使用自動(dòng)序列主鍵列,自增字段,不可空,名稱為:id,確保不把此字段暴露給最終用戶。
除特別說(shuō)明外,所有字符串字段都采用varchar(50)類型,(無(wú)論漢字還是英文,都算一個(gè)字符)。
除特別說(shuō)明外,所有小數(shù)的字段都采用 decimal(18,2)的形式表達(dá)。
除特別說(shuō)明外,所有日期格式都采用 datetime 格式(根據(jù)需要提取時(shí)間格式); 除特別說(shuō)明外,所有整形都采用 bigint 格式。除特別說(shuō)明外,所有字段默認(rèn)都設(shè)置為 null。3.1.2.2表和表字段命名規(guī)范:
命名規(guī)則約束的范圍包括:數(shù)據(jù)庫(kù)的命名、表的命名及字段的命名。數(shù)據(jù)庫(kù)相關(guān)的命名規(guī)則采用與通常的編程的變量命名規(guī)則原則一致,具體要求如下: 1)字段名及表名為典型的名詞結(jié)構(gòu); 2)中文名稱要求語(yǔ)言精練、文法嚴(yán)謹(jǐn);
3)望文知意、易懂易用,禁止采用如:A002這種命名;
4)主體采用拼音字母的首寫(xiě)字母拼寫(xiě)構(gòu)成,基于慣常法可適度采用無(wú)詞義歧義性的英文命名;
5)長(zhǎng)度不少于3個(gè)字母,不大于12個(gè)字母;
6)在對(duì)于拼音首字母類似的字段和表,為區(qū)別,添加下劃線和數(shù)字如男性人數(shù):NXRS,女性人數(shù):NXRS_2。
3.2 數(shù)據(jù)設(shè)計(jì)
繪制數(shù)據(jù)流程圖的目的是為了方便開(kāi)發(fā)人員與用戶的交流,以及為系統(tǒng)的設(shè)計(jì)提供依據(jù)。數(shù)據(jù)流程圖的繪制過(guò)程通常采用自頂向下,逐層分解,直到功能細(xì)化為止,形成若干層次的數(shù)據(jù)流程圖。3.2.1 數(shù)據(jù)流程圖設(shè)計(jì)
0層數(shù)據(jù)流圖
1層數(shù)據(jù)流圖
3.2.2實(shí)體關(guān)系結(jié)構(gòu)設(shè)計(jì)
圖書(shū)實(shí)體關(guān)系
讀者實(shí)體關(guān)系
圖書(shū)借閱關(guān)系實(shí)體
用戶實(shí)體關(guān)系
圖書(shū)類別實(shí)體關(guān)系
3.3安全保密設(shè)計(jì)
3.3.1 邏輯上的安全保密
1、系統(tǒng)對(duì)非法使用者的安全保密處理措施
2、系統(tǒng)對(duì)正常使用者的安全保密處理措施
3、系統(tǒng)對(duì)管理員的安全保密 3.3.2 物理上的安全保密
1、數(shù)據(jù)庫(kù)系統(tǒng)異常時(shí)的還原處理措施
2、設(shè)備遭異常毀壞時(shí)的安全防護(hù)措施
3、數(shù)據(jù)參數(shù)做到及時(shí)更新,保證系統(tǒng)正常運(yùn)行
3.4 表格與功能模塊相關(guān)性分析
3.5 表格定義
a.圖書(shū)信息表
b.讀者信息表
c.借閱表
d.管理員_書(shū)籍
e.管理員_學(xué)生
第三篇:圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)源代碼
圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù)源代碼
//創(chuàng)建工程及設(shè)計(jì)主界面
public class Main extends JFrame { private static final JDesktopPane {
DESKTOP_PANE=new JDesktopPane();
//桌面窗體
} public static void main(String[] args)
//入口方法
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());//設(shè)置系統(tǒng)界面外觀
new BookLogin();
//登錄窗口
}
catch(Exception ex)
{
ex.printStackTrace();
} } public static void addIFame(JInternalFrame iframe)
//添加子窗體的方法
{
DESKTOP_PANE.add(iframe);
//新增子窗體
} public Main(){
super();
//設(shè)置“關(guān)閉”按鈕處理事件
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
//創(chuàng)建工具欄
Toolkit tool=Toolkit,getDefaultToolkit();
//獲得屏幕大小
Dimension screenSize=tool.getScreenSize();
setSize(800,600);
//設(shè)置窗體大小
setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2;//設(shè)置窗體位置
setTitle(“圖書(shū)管理系統(tǒng)”);
//設(shè)置窗體標(biāo)題
JMenuBar menuBar=createMenu();
//創(chuàng)建菜單欄
setJMenuBar(menuBar);
//設(shè)置菜單欄
JToolBar toolBar=createToolBar();
//創(chuàng)建工具欄的方法
getContentPane(),add(toolBar,BorderLayout.NORTH);
//設(shè)置工具欄
final JLable lable=new JLable();
//創(chuàng)建一個(gè)標(biāo)簽,用來(lái)顯示圖片
lable.setBounds(0,0,0,0);
//設(shè)置窗體的大小和位置
lable.setIcon(null);
//窗體背景
DESKTOP_PANE.addComponentListener(new ComponentAdapter())
{
public void componentResized(final ComponentEvent e)
{
Dimension size=e.getComponent().getSize();
//獲得組建大小
lable.setSize(e.getComponent().getSize());
//設(shè)置標(biāo)簽大小
lable.setText(“”);
//設(shè)置標(biāo)簽文本,設(shè)置窗口背景
}
}
//將標(biāo)簽添加到桌面窗體
DESKTOP_PANE.add(lable,new Integer(Integer.MIN_VALUE));
getContentPane().add(DESKTOP_PANE);
//將桌面窗體添加到主窗體中
} } private JToolBar createToolBar()
//創(chuàng)建工具欄的方法 { JToolBar toolBar=new JToolBar();
//初始化工具欄
toolBar.setFloatable(false);
//設(shè)置是否可以移動(dòng)工具欄
toolBar.setBorder(new BevelBorder(BevelBorder.RAIZED));
//設(shè)置邊框
//圖書(shū)信息添加按鈕
JButton bookAddButton=new JButton(MenuActions.BOOK_ADD);ImageIcon icon=new ImageIcon(Main.class.getResource(“/bookAddtb.jpg”));//添加菜單欄圖標(biāo)
bookAddButton.setIcon(icon);
//設(shè)置按鈕圖標(biāo)
bookAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookAddButton);
//添加到工具欄中
JButton bookModiAndDelButton=new JButton(MenuActions.BOOK_MODIFY);
//圖書(shū)信息修改按鈕
ImageIcon bookmodiicon=Icon.add(“bookModiAndDeltb.jpg”);
//創(chuàng)建圖表方法
bookModiAndDelButton.setIcon(bookmodiicon);
//設(shè)置按鈕圖標(biāo)
bookModiAndDelButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookModiAndDelButton);
//添加到工具欄
JButton bookTypeAddButton=new JButton(MenuActions.BOOKTYPE_ADD);
//圖書(shū)類別添加按鈕
ImageIcon bookTypeAddicon=Icon.add(“bookTypeAddtb.jpg”);
//創(chuàng)建圖標(biāo)方法
bookTypeAddButton.setIcon(bookTypeAddicon);
//設(shè)置按鈕圖標(biāo)
bookTypeAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookTypeAddButton);
//添加到工具欄
JButton bookBorrowButton=new JButton(MenuActions.BORROW);
//圖書(shū)借閱按鈕
ImageIcon bookBorrowicon=Icon.add(“bookBorrowtb.jpg”);
//創(chuàng)建圖標(biāo)方法
bookBorrowButton.setIcon(bookBorrowicon);
//設(shè)置按鈕圖標(biāo)
bookBorrowButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookBorrowButton);
//添加到工具欄
JButton bookOrderButton=new JButton(MenuActions.NEWBOOK_ORDER);
//新書(shū)訂購(gòu)按鈕
ImageIcon bookOrdericon=Icon.add(“bookOrdertb.jpg”);
//創(chuàng)建圖標(biāo)方法
bookOrderButton.setIcon(bookOrdericon);
//設(shè)置按鈕圖標(biāo)
bookOrderButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookOrderButton);
//添加到工具欄
JButton bookCheckButton=new JButton(MenuActions.NEWBOOK_CHECK);
//驗(yàn)收新書(shū)按鈕
ImageIcon bookCheckicon=Icon.add(“newbookChecktb.jpg”);
//創(chuàng)建圖標(biāo)方法
bookCheckButton.setIcon(bookCheckicon);
//設(shè)置按鈕圖標(biāo)
bookCheckButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookCheckButton);
//添加到工具欄
JButton readerAddButton=new JButton(MenuActions.READER_ADD);
//讀者信息添加按鈕
ImageIcon readerAddicon=Icon.add(“readerAddtb.jpg”);
//創(chuàng)建圖標(biāo)方法
readerAddButton.setIcon(readerAddicon);
//設(shè)置按鈕圖標(biāo)
readerAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(readerAddButton);
//添加到工具欄
JButton readerModiAndDelButton=new JButton(MenuActions.READER_MODIFY);
//讀者信息修改按鈕
ImageIcon readerModiAndDelicon=Icon.add(“readerModiAndDeltb.jpg”);
//創(chuàng)建圖標(biāo)方法
readerModiAndDelButton.setIcon(readerModiAndDelicon);
//設(shè)置按鈕圖標(biāo)
readerModiAndDelButton.setHideActionText(true);
//顯示提示文本
toolBar.add(readerModiAndDelButton);
//添加到工具欄
JButton ExitButton=new JButton(MenuActions.EXIT);
//退出系統(tǒng)按鈕
ImageIcon Exiticon=Icon.add(“exittb.jpg”);
//創(chuàng)建圖標(biāo)方法
ExitButton.setIcon(Exiticon);
//設(shè)置按鈕圖標(biāo)
ExitButton.setHideActionText(true);
//顯示提示文本
toolBar.add(ExitButton);
//添加到工具欄
return toolBar;} public class Business { protected static String dbClassName=“com.mysql.jdbc.Driver”;
//數(shù)據(jù)庫(kù)驅(qū)動(dòng)類
protected static String dbUr1=“jdbc:mysql://localhost/ts”;
//連接URL protected static String dbUser=“root”;
//數(shù)據(jù)庫(kù)用戶名
protected static String dbpwd=“root”;
//數(shù)據(jù)庫(kù)密碼
private static Connection conn=null;
//數(shù)據(jù)庫(kù)連接對(duì)象,初值為null public Business(){
try
{
if(coon==null)
//連接對(duì)象為空
{
Class.forName(dbClassName);
//加載驅(qū)動(dòng)類信息
conn=DriverManager.getConnection(dbUr1,dbUser,dbPwd);
//建立連接對(duì)象
}
}
catch(Exception ee)
{
ee.printStackTrace();
} } public static ResultSet executeQuery(String sql)
//執(zhí)行查詢方法
{
try
{
//如果連接對(duì)象為空,則重新調(diào)用構(gòu)造方法
if(conn==null)
{
new Business();
return conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql);
//執(zhí)行查詢
}
}
catch(SQLException e)
{
e.printStackTrace();
return null;
//返回null值
}
finally
{} } public static int executeUpdata(String sql)
//更新方法
{
try
{
if(conn==null)
{
new Business();
//如果連接對(duì)象為空,則重新調(diào)用構(gòu)造方法
return conn.createStatement().executeUpdate(sql);//執(zhí)行更新
}
}
catch(SQLException e)
{
e.printStackTrace();
return-1;
}
finally
{} } public static void close()
//關(guān)閉方法 {
try
{
conn.close();
//關(guān)閉連接對(duì)象
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
conn=null;
//設(shè)置連接對(duì)象為null值
} } }
//為數(shù)據(jù)庫(kù)添加對(duì)應(yīng)的類 public class BookInfo { private String Book_id;
//圖書(shū)編號(hào)
private String typeid;
//類別編號(hào)
private String writer;
//作者
private String translator;//譯者
private String publisher;
//出版社
private Date date;
//出版日期
private Double price;
//圖書(shū)單價(jià)
private String getBookname;//圖書(shū)名稱
public String getBookname(){
return bookname;} public void setBookname(String bookname){
this.bookname=bookname;} public Date getDate(){
return date;} public void setDate(Date date){
this.date=date;} public string getBook_id()
{ return Book_id;} public void setBook_id(String Book_id){ this.Book_id=Book_id;} public Double getPrice(){ return price;} public void setprice(Double price){ this.price=price;} public String getPublisher(){ return Publisher;} public void setPublisher(String publisher){ this.Publisher=Publisher;} public String getTranslator(){ return translator;} public void setTranslator(String translator){ this.translator=translator;} public String getTypeid(){ return typeid;} public void setTypeid(String typeid){ this.typeid=typeid;} public String getWriter(){ return writer;} public void setWriter(String writer){
this.writer=writer;} } public class BookType
//圖書(shū)列表信息類 { private String id;
//圖書(shū)類別編號(hào)
private String typeName;
//圖書(shū)類別名稱
private String days;
//可解天數(shù)
private String fk;//每罰款金額
public String getFk(){
return fk;} public void setFk(String fk){
this.fk=fk;} public String getDays(){
return days;} public void setDays(String days){
this.days=days;} public string getId(){
return id;} public void setId(String id){
this.Bid=id;} public String getTypeName(){
return typeName;} public void setTypeName(String typeName){
this.typeName=typeName;} } public class Order
//圖書(shū)訂單信息類 {
private String Book_id;
//圖書(shū)編號(hào) private Date date;
//下單時(shí)間 private String number;
//圖書(shū)數(shù)量 private String operator;//操作員
private String checkAndAccept;
//是否收到貨 private String zk;
//圖書(shū)折扣 public String getcheckAndAccept(){ return checkAndAccept;} public void setcheckAndAccept(String checkAndAccept){ this.checkAndAccept=checkAndAccept;} public Date getDate(){ return date;} public void setDate(Date date){ this.date=date;} public string getBook_id(){ return book_id;} public void setBook_id(String book_id){ this.book_id=book_id;} public String getNumber(){ return number;} public void setNumber(String number){ this.number=number;} public String getOperator(){ return operator;} public void setOperator(String operator){
this.operatorr=operator;
} public String getZk(){
return zk;} public void setZk(String Zk){
this.zk=zk;} } public class Operater { private String id;
//操作員編號(hào)
private String name;
//操作員用戶名
private String grade;
//操作員等級(jí)
private String password;//操作員密碼
private String type;
//出版社
public String getType(){
return type;} public void setType(String type){
this.type=type;} public string getGrade(){
return grade;} public void setGrade(String grade){
this.grade=grade;} public String getId(){
return id;} public void setId(String id){
this.id=id;} public String getName(){
return name;} public void setName(String name){
this.name=name;} public String getPassword(){
return password;} public void setPassword(String password){
this.password=password;} } public class Borrow
//書(shū)籍借閱信息類 { private int id;
//借閱編號(hào)
private String book_id;
//圖書(shū)編號(hào)
private String reader_id;
//讀者編號(hào)
private String num;
//借書(shū)數(shù)量
private String borrowDate;
//借書(shū)日期
private String backDate;
//應(yīng)還日期
private String Bookname;//圖書(shū)名稱
public String getBookname(){
return bookname;} public void setBookname(String bookname){
this.bookname=bookname;} public string getBackDate(){
return backDate;} public void setBackDate(String backDate){
this.backDate=backDate;} public string getBorrowDate(){
return borrowDate;} public void setBorrowDate(String borrowDate){
this.borrowDate=borrowDate;} public String getNum(){
return num;} public void setNum(String num){
this.num=num;} public String getBook_id(){
return book_id;} public void setBook_id(String book_id){
this.book_id=book_id;} public String getReader_id(){
return reader_id;} public void setReader_id(String reader_id){
this.reader_id=reader_id;} public int getId(){
return id;} public void setId(Int id){
this.id=id;} } public class Back
//圖書(shū)歸還信息類 { private String book_id;
//圖書(shū)編號(hào)
private String bookname;
//圖書(shū)名稱
private String operatorId;
//操作員編號(hào)
private String borrowDate;//圖書(shū)借閱時(shí)間
private String backDate;
//圖書(shū)歸還時(shí)間 private String readerName;
//讀者姓名 private String reader_id;//讀者編號(hào) private int typeId;private int id; public int getId(){ return id;} public void setId(int id){ this.id=id;} public int getTypeId(){ return typeid;} public void setTypeId(int typeid){ this.typeId=typeId;} public string getBackDate(){ return backDate;} public void setBackDate(String backDate){ this.backDate=backDate;} public String getBookname(){ return bookname;} public void setBookname(String bookname){ this.bookname=bookname;} public string getBorrowDate(){ return borrowDate;} public void setBorrowDate(String borrowDate){ this.borrowDate=borrowDate;} public String getOperatorId(){
return operatorId;} public void setOperatorId(String operatorId){
this.operatorId=operatorId;} public String getBook_id(){
return book_id;} public void setBook_id(String book_id){
this.book_id=book_id;}
public String getReader_id(){
return reader_id;} public void setReader_id(String reader_id){
this.reader_id=reader_id;}
public String getReaderName(){
return readerName;} public void setReaderName(String readerName){
this.readerName=readerName;} }
//系統(tǒng)登錄模塊設(shè)計(jì)
public class BookLogin extends JFrame { private static final Operater Type=null;
//人員類型
private static Operater user;
//用戶名
private JPasswordField password;private JTextField username;private JButton login;private JButton reset;public BookLogin(){
super();
final BorderLayout borderLayout=new BorderLayout();
//創(chuàng)建布局管理器
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//設(shè)置“關(guān)閉”按鈕處理事件
borderLayout.setVgap(10);
//設(shè)置組件間的垂直關(guān)系
getContentPane().setLayout(borderLayout);
//使用布局管理器
setTitle(“圖書(shū)管理系統(tǒng)登錄”)
//設(shè)置窗體標(biāo)題
Toolkit tool=Toolkit.getDefaultToolkit();
//獲得默認(rèn)的工具箱
Dimension screenSize=tool.getScreenSize();//獲得屏幕的大小
setSize(285,194);
setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2);//設(shè)置窗體位置
final JPanel mainPanel=new JPanel();
//創(chuàng)建主面板
mainPanel.setLayout(new BorderLayout());
//設(shè)置邊框布局
mainPanel.setBorder(new EmptyBorder(0,0,0,0))
//設(shè)置邊框?yàn)?
getContentPane().add(mainPanel);
//在窗體中加入主面板
final JLabel imageLabel=new JLabel;
//創(chuàng)建一個(gè)標(biāo)簽,用來(lái)顯示圖片
ImageIcon loginIcon=Icon.add(“l(fā)ogin.jpg”);
//創(chuàng)建一個(gè)圖像圖標(biāo)
imagelabel.setIcon(loginIcon);
//設(shè)置圖片
imageLabel.setOpaque(true);
//設(shè)置繪制其邊界內(nèi)的所有像素
imageLabel.setBackground(Color.GREEN);
//設(shè)置背景顏色
imageLabel.setpreferredSize(new Dimension(260,60));//設(shè)置標(biāo)簽大小
mainPanel.add(imageLabel,BorderLayout.NORTH);
//添加標(biāo)簽到主面板
final JPanel centerPanel=new JPanel();
//添加一個(gè)中心面板
final GridLayout gridLayout=new GridLayout(2,2);//創(chuàng)建網(wǎng)絡(luò)布局管理器
gridLayout.setHgap(5);
//設(shè)置組件之間平行的距離
gridLayout.setVgap(20);
//設(shè)置組件之間垂直的距離
centerPanel.setLayout(gridLayout);
//使用布局管理器
mainPanel.add(centerPanel);
//添加到主桌面
final JLabel userNamelabel=new JLabel();
//創(chuàng)建一個(gè)標(biāo)簽
userNameLabel.setHorizontalAlignment(SwingConstants.CENTER);//設(shè)置對(duì)齊方式
userNameLabel.setPreferredSize(new Dimension(0,0));
//設(shè)置組件大小
userNameLabel.setMinimumSize(new Dimension(0,0));
//設(shè)置組件最小的大小
centerPanel.add(userNameLabel);
//添加到中心面板
userNameLabel.setText(“用
戶
名:”);
//設(shè)置標(biāo)簽文本
username=new JTextField(20);
//創(chuàng)建文本框
username.setPreferredSize(new Dimension(0,0));
//設(shè)置組件大小
centerPanel.add(username);
//添加到中心面板
final JLabel passwordLabel=new JLabel();
//創(chuàng)建一個(gè)標(biāo)簽
passwordLabel.setHorizontalAlignment(SwingConstants.CENTER);
//設(shè)置對(duì)齊方式
centerPanel.add(passwordLabel);
//添加到中心面板
passwordLabel.setText(“密
碼:”);
//設(shè)置標(biāo)簽文本
password=new JPasswordField(20);
//創(chuàng)建密碼框
password.setDocument(new Document(6));
//設(shè)置密碼長(zhǎng)度為6
password.addKeyListener(new KeyAdapter()
//監(jiān)聽(tīng)密碼框
{
public void keyPressed(final keyEvent e)
//監(jiān)聽(tīng)鍵盤(pán)案件事件
{
if(e.getKeyCode()==10)
//如果按了回車鍵
{
login.doClick();
//進(jìn)行登錄
}
}
})
centerPanel.add(password);
//添加到中心面板
final JPanel southPanel=new JPanel;//新增一個(gè)底部面板
mainPanel.add(southPanel,BorderLayout.SOUTH);
//添加到主面板中
login=new JButton();
//創(chuàng)建按鈕組件
login.addActionListener(new BookLoginAtion());
//添加監(jiān)聽(tīng)器
login.setText(“登錄”);
//設(shè)置按鈕文本
southPanel.add(login);
//把按鈕添加到底部面板
reset=new JButton();
//創(chuàng)建按鈕組件
reset.addActionListener(new BookResetAction());
//添加監(jiān)聽(tīng)器
reset.setText(“重置”);
//設(shè)置按鈕文本
southPanel.add(reset);
//把按鈕添加到底部面板
setVisible(true);
//設(shè)置創(chuàng)建可見(jiàn)
setResizable(false);
//設(shè)置窗體不可改變大小
} public static Operater getUser(){
return user;} public static Operater getType(){
return Type;} public static void setUser(Operater user){
BookLogin.user=user;} } private class BookResetAction implements ActionListener { public void actionPerformed(final ActionEvent e){
username.setText(“");//設(shè)置用戶名輸入框?yàn)榭?/p>
password.setText(”“);//設(shè)置密碼輸入框?yàn)榭?/p>
} } private class BookLoginAction implements ActionListener { public void actionPerformed(final ActionEvent e){
user=Business.check(username.getText(),new String(password.getPassword()));//調(diào)用business方法
if(user.getName()!=null)
//判斷用戶名是否為null
{
try
{
Main frame=new Main();
//創(chuàng)建一個(gè)主窗體
frame.setVisible(true);
//設(shè)置其可見(jiàn)
BookLogin.this.setVisible(false);
//設(shè)置登錄窗體為不顯示
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
else
{
JOptionPane.showMessageDialog(null,”請(qǐng)輸入正確的用戶名和密碼!“);//彈出提示框
username.setText(”“);
//設(shè)置用戶名輸入框?yàn)榭?/p>
password.setText(”“);
//設(shè)置密碼輸入框?yàn)榭?/p>
} } }
//基本信息管理模塊
public class ReaderAdd extends JInternalFrame
//添加讀者信息 { public ReaderAdd(){
super();
setTitle(”讀者相關(guān)信息添加“);
setIconifiable(true);
//設(shè)置窗體可最小化
setClosable(true);
//設(shè)置窗體可關(guān)閉
setBounds(100,100,500,350);
final JLabel logoLabel=new JLabel();
ImageIcon readerAddIcon=Icon.add(”readerAdd.jpg“);
logoLabel.setIcon(readerAddIcon);
logoLabel.setOpaque(true);
logoLabel.setBackground(Color.CYAN);
logoLabel.setPreferredSize(new Dimension(400,60));
getContentPane().add(logoLabel,BorderLayout.NORTH);
final JPanel panel=new JPanel();
panel.setLayout(new FlowLayout());
getContentPane().add(panel);
final JPanel panel_1=new JPanel();
final GridLayout gridLayout=new GridLayout(0,4);
gridLayout.setVgap(15);
gridLayout.setHgap(15);
panel_1.setLayout(gridLayout);
panel_1.setPreferredSize(new Dimension(450,200));
panel.add(panel_1);
final JLabel label_2=new JLabel();
label_2.setText(”姓名:“);
panel_1.add(label_2);
readername=new JTextField();
readername.setDocument(new Document(10));
panel_1.add(readername);
final JLabel label_3=new JLabel();
public void actionPerformed(final ActionEvent e)
{
Check validator=new Check();
//校驗(yàn)類
String zj=String.valueof(comboBox.getSelectedIndex());
String id=read_id.getText().trim();
Vector v1=new Vector();
v1.clear();
v1.add(”reader“);
//讀取配置文件中相應(yīng)的查詢語(yǔ)句
v1.add(id);
if(l==validator.Validate(V1))
//檢查是否存在該讀者
{
JOptionPane.showMessageDialog(null,”添加失敗,該讀者編號(hào)已存在!“);
}
else
{
Int i=Business.InsertReader(readername.getText().trim(),sex.trim(),age.getText().trim(),zjnumber.getText().trim(),Date.valueOf(date.getText().trim()),maxnumber.getText().trim().tel.getText().trim(),Double.valueof(keepmoney.getText().trim()),zj,zy.getText().trim(),Date.valueOf(bztime.getText().trim()),read_id.getText().trim());
if(i==1)
{
JOptionPane.showMessageDialog(null,”添加成功!“);
doDefaultCloseAction();
}
}
}
}
class TelListener extends KeyAdapter
{ public void keyTyped(KeyEvent e){
String numStr=”0123456789-“+(char)8;
//類型轉(zhuǎn)換
if(numStr.indexOf(e.getKeyChar())<0)
{
e.consume();
} }
}
//添加“關(guān)閉”按鈕的事件監(jiān)聽(tīng)器
class CloseActionListener implements ActionListener
{
public void actionPerformed(final ActionEvent e)
{
doDefaultCloseAction();
}
}
private String[] columnNames(”名稱“,”性別“,”年齡“,”證件號(hào)碼“,”借書(shū)證有效日期“,”借書(shū)量“,”電話“,”押金“,”證件“,”職業(yè)“,”讀者編號(hào)“,”辦證時(shí)間“);
private String[] array=new String[]{”身份證“,”軍人證“,”學(xué)生證“};
String id;
private Object[][] getFileStates(List list)
{
Object[][]results=new Object[list.size()][columnNames.length];
for(int i=0;i { Reader reader=(Reader)list.get(i); result[i][0]=reader.getName(); //定義二維數(shù)組 String sex; if(reader.getSex().equals(”1“)) { sex=”男“; } else { sex=”女“; } results[i][1]=sex; //讀取讀者歌屬性值 results[i][2]=reader.getAge(); results[i][3]=reader.getIdentityCard(); results[i][4]=reader.getDate(); results[i][5]=reader.getMaxNum(); results[i][6]=reader.getTel(); results[i][7]=reader.getKeepMoney(); results[i][8]=array[reader.getZj()]; results[i][9]=reader.getZy(); results[i][10]=reader.getBook_id(); results[i][11]=reader.getBZtime(); } return results; } //圖書(shū)類別管理 //添加圖書(shū)信息 utton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if(bookTypeName.getText().length()==0) { JOptionPane.showMMessageDialog(null,”圖書(shū)類別文本框不可為空“); return; } if(days.getText().length()==0) { JOptionPane.showMessageDialog(null,”可借天數(shù)文本框不可為空“); return; } if(!check.isNumeric(days.getText().trim())) { JOptionPane.showMessageDialog(null,”可借天數(shù)必須為數(shù)字“); return; } if(fakuan.getText().length()==0) { JOptionPane.showMessageDialog(null,”罰款文本框不可為空“); return; } if(!check.isNumeric(fakuan.getText().trim())) { JOptionPane.showMessageDialog(null,”罰款必須為數(shù)字“); return; } int i=Business.InsertBookType(bookTypeName.getText().trim(),days.getText().trim(),Double.valueof(fakuan.getText.trim())/10); if(i==1) { JOptionPane.showMessageDialog(null,”添加成功!“); doDefaultCloseAction(); } } }); panel_6.add(button); final JButton buttonDel=new JButton(); buttonDel.setText(”關(guān)閉“); buttonDel.addActionListener(new ActionListener(){ public void actionPerformed(final ActionEvent e){ doDefaultCloseAction(); } }); panel_6.add(buttonDel); setVisibel(true);} //修改圖書(shū)類 class ButtonAddListener implements ActionListener{ public void actionPerformed(ActionEvent e){ Object selectedItem=bookTypeModel.getSelectedItem(); int i=Business.UpdatebookType(BookTypeId.getText().trim(),selectedItem.toString(),days.getText().trim(),fk.getText().trim()); if(i==1) { JOptionPane.showMessageDialog(null,”修改成功"); object[][] results=getFileStates(Business.selectBookCategory()); model.setDataVector(results.columnNames); } } } table.setModel(model); 課 程 設(shè) 計(jì) 軟件工程與數(shù)據(jù)庫(kù) 課程設(shè)計(jì) 任務(wù)書(shū) 學(xué)院名稱: 數(shù)學(xué)與計(jì)算機(jī)學(xué)院 課程代碼:_6014419_ 專 業(yè): 年 級(jí): 一、設(shè)計(jì)題目 圖書(shū)管理系統(tǒng) 二、主要內(nèi)容 一個(gè)簡(jiǎn)單的圖書(shū)管理系統(tǒng)包括圖書(shū)館內(nèi)書(shū)籍的信息、學(xué)校在校學(xué)生的信息以及學(xué)生的借閱信息。此系統(tǒng)功能分為面向?qū)W生和面向管理員兩部分,其中學(xué)生可以進(jìn)行借閱、續(xù)借、歸還和查詢書(shū)籍等操作,管理員可以完成書(shū)籍和學(xué)生的增加,刪除和修改以及對(duì)學(xué)生,借閱、續(xù)借、歸還的確認(rèn)。如: 圖書(shū)室有各種圖書(shū)一萬(wàn)多冊(cè)。 每種圖書(shū)都有書(shū)名、書(shū)號(hào)(ISBN)、一名或多名作者(譯者)、出版社、定價(jià)和內(nèi)容簡(jiǎn)介。 借書(shū)證記錄有借閱者的姓名、所在單位、職業(yè)等。 憑借書(shū)證借書(shū),每次最多能借8本書(shū)。借書(shū)期限最長(zhǎng)為30天。實(shí)現(xiàn)新進(jìn)圖書(shū)的數(shù)據(jù)錄入。 實(shí)現(xiàn)對(duì)所有購(gòu)進(jìn)圖書(shū)的分類查詢和分類統(tǒng)計(jì)。能夠按書(shū)名、作者等分類查詢現(xiàn)有圖書(shū)的數(shù)量。 記錄借閱者的個(gè)人資料和所借圖書(shū)的書(shū)名、書(shū)號(hào)數(shù)據(jù)等。 三、具體要求 1、完成系統(tǒng)的需求分析 通過(guò)需求分析確定系統(tǒng)需要處理的數(shù)據(jù)的需求,要求使用數(shù)據(jù)庫(kù)的輔助設(shè)計(jì)工具(PowerDesigner等),建立業(yè)務(wù)處理模型。 課 程 設(shè) 計(jì) 2、完成系統(tǒng)概念結(jié)構(gòu)設(shè)計(jì) 概念數(shù)據(jù)模型(CDM)用于完成數(shù)據(jù)庫(kù)的設(shè)計(jì),與人和數(shù)據(jù)庫(kù)平臺(tái)和具體數(shù)據(jù)存儲(chǔ)結(jié)構(gòu)和工具無(wú)關(guān)。首先選擇局部應(yīng)用畫(huà)出分E-R圖,最終形成系統(tǒng)的E-R圖 3、完成系統(tǒng)邏輯結(jié)構(gòu)設(shè)計(jì) 按照E-R圖轉(zhuǎn)換成關(guān)系模式的規(guī)則,將CDM轉(zhuǎn)換成邏輯數(shù)據(jù)模型,并為每個(gè)關(guān)系模式設(shè)計(jì)主鍵、外鍵。分析關(guān)系模式中的依賴關(guān)系,對(duì)關(guān)系模式規(guī)范化處理 4、完成系統(tǒng)物理結(jié)構(gòu)設(shè)計(jì) 為每個(gè)關(guān)系分配存儲(chǔ)長(zhǎng)度,建立數(shù)據(jù)庫(kù)的索引和視圖,定義關(guān)系中的主碼和外碼,寫(xiě)出關(guān)系創(chuàng)建和查詢的SQL語(yǔ)句。 5、編碼 選擇你自己熟悉的開(kāi)發(fā)工具完成一個(gè)DBS系統(tǒng)的編碼工作。源代碼格式規(guī)范,注釋不少于三分之一 四、主要技術(shù)路線提示 1.仔細(xì)閱讀設(shè)計(jì)指導(dǎo)書(shū)內(nèi)容,認(rèn)真掌握任務(wù)要求?2.需求分析? 3.概念結(jié)構(gòu)設(shè)計(jì)? 4.邏輯結(jié)構(gòu)設(shè)計(jì)?5.物理結(jié)構(gòu)設(shè)計(jì)?6.編碼.2.后臺(tái)推薦采用SQL server或Oracle;前臺(tái)開(kāi)發(fā)環(huán)境不限制??刹捎肁DO,ODBC,OLE DB或JDBC連接數(shù)據(jù)庫(kù),并調(diào)用系統(tǒng)存儲(chǔ)過(guò)程、自定義存儲(chǔ)過(guò)程、函數(shù)等。 五、進(jìn)度安排 第1周: 數(shù)據(jù)庫(kù)系統(tǒng)概念模型、數(shù)據(jù)模型設(shè)計(jì),創(chuàng)建數(shù)據(jù)庫(kù)以及相關(guān)對(duì)象; 第2周: 前臺(tái)程序開(kāi)發(fā),撰寫(xiě)報(bào)告,接受檢查。 六、完成后應(yīng)上交的材料 1. 源程序一份(包含數(shù)據(jù)庫(kù)) 2. 課程設(shè)計(jì)報(bào)告一份 七、推薦參考資料 1.王珊.數(shù)據(jù)庫(kù)系統(tǒng)概論(第四版).高等教育出版社 2.閃四清.數(shù)據(jù)庫(kù)系統(tǒng)原理與應(yīng)用教程.清華大學(xué)出版社 課 程 設(shè) 計(jì) 3.周龍?bào)J.數(shù)據(jù)庫(kù)管理系統(tǒng)實(shí)現(xiàn)技術(shù).中國(guó)地質(zhì)大學(xué)出版社 4.張海藩.軟件工程概論.清華大學(xué)出版社 5.陳明 編著.實(shí)用軟件工程基礎(chǔ).清華大學(xué)出版社 6.成先海.數(shù)據(jù)庫(kù)基礎(chǔ)與應(yīng)用-SQL SERVER2000.機(jī)械工業(yè)出版社出版 指導(dǎo)教師 簽名日期 年 月 日 系 主 任 審核日期 年 月 日 請(qǐng)?jiān)O(shè)計(jì)圖書(shū)管理系統(tǒng)數(shù)據(jù)庫(kù),要求能滿足讀者的注冊(cè)、注銷、個(gè)人信息修改、圖書(shū)的入庫(kù)、圖書(shū)報(bào)廢、圖書(shū)的借閱、歸還、續(xù)約、滯納金賠償、損壞賠償功能 系統(tǒng)中至少包含如下信息: 讀者姓名、id、性別、學(xué)歷(初等、中等、高等)、年齡、職業(yè)類別、圖書(shū)id、圖書(shū)名稱、圖書(shū)類別(基礎(chǔ)類、科技類、文史類、社會(huì)科學(xué)、自然科學(xué))、圖書(shū)書(shū)齡、所屬出版社、圖書(shū)價(jià)格、圖書(shū)是否完好、圖書(shū)借閱人、借閱起始時(shí)間、圖書(shū)借閱時(shí)長(zhǎng)、圖書(shū)續(xù)約(最多可連續(xù)續(xù)約3次)、圖書(shū)是否已歸還、圖書(shū)是否已損壞,讀者注冊(cè)級(jí)別(分普通讀者和vip讀者,普通讀者同時(shí)可以借閱2本書(shū),vip讀者可以同時(shí)借閱5本書(shū))。 圖書(shū)系統(tǒng)中,相同的書(shū)籍可以不止一本,讀者可以同名。一次借閱期限一個(gè)月(30天),一次續(xù)約延長(zhǎng)一個(gè)月。過(guò)期后每超出一天須繳納滯納金一元。圖書(shū)損毀后就被報(bào)廢。 1、請(qǐng)用完整、連續(xù)的SQL語(yǔ)句設(shè)計(jì)數(shù)據(jù)庫(kù)和表,請(qǐng)根據(jù)情理和場(chǎng)景設(shè)計(jì)各類約束。 2、請(qǐng)查詢‘計(jì)算機(jī)導(dǎo)論’這本書(shū)籍的被借閱次數(shù)。 3、請(qǐng)查詢借書(shū)證號(hào)為11的讀者歷年來(lái)的借閱次數(shù)(不包括續(xù)約)。 4、請(qǐng)用一條或者多條語(yǔ)句查詢‘計(jì)算機(jī)導(dǎo)論’這本書(shū)籍當(dāng)前是否可以借閱。 5、請(qǐng)找出最熱門的書(shū)籍名稱(總共借閱次數(shù))。 6、請(qǐng)找出學(xué)歷中等或中等以上人員關(guān)注度比中等以下人員關(guān)注度高的書(shū)籍。 7、請(qǐng)查詢‘王小東’當(dāng)前可以借閱多少本書(shū)。 8、請(qǐng)查詢‘王小東’當(dāng)前共須繳納多少滯納金。 9、請(qǐng)統(tǒng)計(jì)各職業(yè)類別人員的借閱次數(shù)。 10、請(qǐng)查閱哪個(gè)出版社的書(shū)籍借閱頻率最高(可以考慮按進(jìn)行統(tǒng)計(jì))。 11、檢索學(xué)歷比‘王小東’高,年齡比‘王小東’大,而借閱次數(shù)比他少的讀者id。 12、請(qǐng)查詢至少關(guān)注過(guò)圖書(shū)類別中3個(gè)類別的讀者id。 13、請(qǐng)查詢‘計(jì)算機(jī)導(dǎo)論’書(shū)籍在各個(gè)學(xué)歷階層的借閱次數(shù)。 14、請(qǐng)將“根據(jù)借書(shū)證查詢所借閱書(shū)籍編號(hào)和名稱”這樣的行為以存儲(chǔ)過(guò)程加以實(shí)現(xiàn)。第四篇:數(shù)據(jù)庫(kù)課程設(shè)計(jì) 圖書(shū)管理系統(tǒng)(精選)
第五篇:數(shù)據(jù)庫(kù)圖書(shū)管理系統(tǒng)題目