用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

涛涛ii    -  云代码空间

——

图书管理系统1

2017-06-18|261阅||

摘要:package com.library.UI; import java.util.Scanner; import com.library.Dao.BookDao; import com.library.Dao.UserDao; import com.library.Data.da

package com.library.UI;




import java.util.Scanner;


import com.library.Dao.BookDao;
import com.library.Dao.UserDao;
import com.library.Data.date;
import com.library.Domain.Book;
import com.library.Domain.User;
import com.library.Srevic.BookService;


public class BookUI {
LoginUI loginui = new LoginUI();
BookService bookdao = new BookService();
//查询图书
void findBookUI() {
System.out.println("0.查找所有图书");
System.out.println("1.通过书名查找");
System.out.println("2.通过ID查找");
System.out.println("3.通过作者查找");
System.out.println("4.通过类别查找");
System.out.println("5.通过出版社查找");
System.out.println("6.返回主界面");
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
switch(x){
case 0:findBook();break;
case 1:findBookByName();break;
case 2:findBookByID();break;
case 3:findBookByAuthor();break;
case 4:findBookBySort();break;
case 5:findBookByPublish();break;

case 6:loginui.mainUI();break;

}
}


private void findBookByName() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要查询的书名");
System.out.println(bookdao.findBookByName(sc.nextLine()));
loginui.mainUI();

}
private void findBookByID() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要查询的书号");
System.out.println(bookdao.findBookByID(sc.nextLine()));
loginui.mainUI();

}
private void findBookByAuthor() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要查询的作者");
System.out.println(bookdao.findBookByAuthor(sc.nextLine()));


}
//查询所有图书
private void findBook(){
System.out.println(bookdao.findBook());
}

private void findBookBySort() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要查询的类别");
System.out.println(bookdao.findBookBySort(sc.nextLine()));
loginui.mainUI();
}
private void findBookByPublish() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要查询的出版社");
System.out.println(bookdao.findBookByPublish(sc.nextLine()));

}
//删除图书
void deleteBookUI() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入要删除的图书名");
System.out.println(bookdao.deleteBook(sc.nextLine()));
loginui.mainUI();

}
//添加图书
void addBookUI() {


Scanner sc = new Scanner(System.in);
System.out.println("请输入新图书");
System.out.println(bookdao.addBook(new Book(sc.nextLine(),sc.nextLine(),sc.nextLine(),sc.nextLine(), sc.nextLine(),sc.nextInt())));
System.out.println(date.bookList);
loginui.mainUI();

}
//修改图书--ID
void upDateBookUI(){
Scanner sc = new Scanner(System.in);
System.out.println("请依次输入图书ID,输入要修改后的书名,书号,出版社,作者,类别,价格");
bookdao.updateBook(sc.nextLine(),sc.nextLine(),sc.nextLine(),sc.nextLine(),sc.nextLine(), sc.nextLine(),sc.nextInt());
System.out.println(date.bookList);
loginui.mainUI();
}




}

顶 0踩 0收藏
分享到:
更多
文章评论
    发表评论

    个人资料

    • 昵称: 涛涛ii
    • 等级: 初级程序员
    • 积分: 30
    • 代码: 0 个
    • 文章: 1 篇
    • 随想: 0 条
    • 访问: 0 次
    • 关注

    人气文章

    人气代码

      标签

      最新提问

        站长推荐