一、系统介绍
1.开发环境
开发工具:IDEA2018.2
JDK版本:jdk1.8
2.技术选型
Java语言开发,使用ArrayList存储信息。
3.系统功能
1.实现系统登录
2.实现教材信息的增删改查
二、系统展示
1.登录系统
2.查询教材信息
3.增加教材信息
4.更新教材信息
5.删除教材信息
三、部分代码
BookService
package service; import common.Response; import entity.Book; import java.util.ArrayList; import java.util.List; public class BookService { private static List<Book> bookList = new ArrayList<>(); static { bookList.add(new Book("计算机组成原理","计算机","49.8")); bookList.add(new Book("数据结构","计算机","38.8")); bookList.add(new Book("操作系统","计算机","29.9")); } public Response query(String name){ if(name == null || "".equals(name)){ return new Response("error","教材名为空。"); } for(Book book : bookList){ if(name.equals(book.getName())){ return new Response("success","查询成功。", book); } } return new Response("error","未查询到此教材,请重新输入:"); } public Response add(Book book){ for(Book b : bookList){ if(b.getName().equals(book.getName())){ return new Response("error","该教材已存在。"); } } bookList.add(book); return new Response("success","教材添加成功。", book); } public Response checkProp(Book book, String prop, String value){ if(prop == null || "".equals(prop)){ return new Response("error","属性为空。"); } String[] props = {"name","code","author","publishTime","publisher","type","price"}; switch(prop){ case "name" : book.setName(value); break; case "code" : book.setCode(value); break; case "author" : book.setAuthor(value); break; case "publishTime" : book.setPublishTime(value); break; case "publisher" : book.setPublisher(value); break; case "type" : book.setType(value); break; case "price" : book.setPrice(value); break; default: return new Response("error","该属性不存在。"); } return new Response("success","编辑成功。"); } public Response delete(String name){ if(name == null || "".equals(name)){ return new Response("error","教材名为空。"); } for(Book b : bookList){ if(b.getName().equals(name)){ bookList.remove(b); return new Response("success","教材删除成功。"); } } return new Response("error","教材不存在。"); } }
LoginService
package service; import common.Account; import common.Response; import entity.User; import java.util.ArrayList; import java.util.List; public class LoginService { private static List<User> userList = new ArrayList(); static{ userList.add(new User(Account.ADMIN.getUsername(),Account.ADMIN.getPassword())); userList.add(new User(Account.USER1.getUsername(),Account.USER1.getPassword())); userList.add(new User(Account.USER2.getUsername(),Account.USER2.getPassword())); userList.add(new User(Account.USER3.getUsername(),Account.USER3.getPassword())); } public Response login(String username, String password){ if(username == null || "".equals(username)){ return new Response("error","用户名为空,请输入用户名。"); } if(password == null || "".equals(password)){ return new Response("error","密码为空,请输入密码。"); } for (User user : userList){ if(username.equals(user.getUsername()) && password.equals(user.getPassword())){ return new Response("success","登陆成功!"); } } return new Response("error","用户名或密码输入错误,请检查并重新输入。"); } }
四、其他
1.其他系统实现
IDEA+Java控制台实现医院管理系统
IDEA+Java控制台实现宠物管理系统
IDEA+Java控制台实现教材管理系统
IDEA+Java控制台实现商品管理系统
IDEA+Java控制台实现货物销售管理系统
IDEA+Java控制台实现学生信息管理系统
IDEA+Java控制台实现学生档案管理系统
IDEA+Java控制台实现公园售票管理系统
3.运行项目
直接导入项目,打开Main运行程序。
4.备注
如有侵权请联系我删除。
5.支持博主
如果您觉得此文对您有帮助,请点赞加关注加收藏。祝您生活愉快!