图书管理系统(使用IO流实现数据的读取和写入)--version4.0

news2025/2/26 15:14:15

 目录

一、项目要求:

二、项目环境

三、项目使用的知识点

四、项目代码

五、项目运行结果

六、项目难点分析


图书管理系统--versions1.0:

图书管理系统--versions1.0-CSDN博客文章浏览阅读981次,点赞29次,收藏17次。本文使用了变量,数据类型,顺序,选择,循环,数组实现了一个简单的小项目--图书管理系统,其中包括用户管理,图书管理,不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135583634?spm=1001.2014.3001.5501icon-default.png?t=N7T8https://blog.csdn.net/qq_53483101/article/details/135583634?spm=1001.2014.3001.5501

图书管理系统--versions2.0:

图书管理系统--versions2.0-CSDN博客文章浏览阅读1k次,点赞35次,收藏19次。本文使用了变量,数据类型,顺序,选择,循环,数组,对象及属性的封装实现了一个简单的小项目--图书管理系统,其中包括用户管理,图书管理,不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135728923?spm=1001.2014.3001.5501icon-default.png?t=N7T8https://blog.csdn.net/qq_53483101/article/details/135728923?spm=1001.2014.3001.5501

图书管理系统--versions3.0:

图书管理系统(ArrayList和LinkedList)--versions3.0-CSDN博客本文使用了变量,数据类型,顺序,选择,循环,对象及属性的封装,使用ArrayList和LinkedList集合,实现了一个简单的小项目--图书管理系统,其中包括用户管理,图书管理,不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135939196?spm=1001.2014.3001.5501icon-default.png?t=N7T8https://blog.csdn.net/qq_53483101/article/details/135939196?spm=1001.2014.3001.5501

 图书管理系统--versions4.0:图书管理系统(使用IO流实现数据的读取和写入)--version4.0-CSDN博客文章浏览阅读342次,点赞8次,收藏9次。使用io实现图书管理系统中管理员用户、普通用户、书籍信息的读取和写入。https://blog.csdn.net/qq_53483101/article/details/136306379?spm=1001.2014.3001.5501


一、项目要求:

1)通过账号控制图书管理系统,账号分为管理员账号和普通用户账号
    1. 管理员账号和普通用户账号都可以使用手机号码+密码、身份证号码+密码的形式登录,登录方式二选一

     2.管理员账号和普通账号除了手机号码、身份中号码、密码三个数据之外,还有姓名、性别、专业、住址信息

2)启动系统后,显示登录账号、注册账号、退出登录三个模块
        a)登录账号:
                1、显示管理员登录
                2、用户登录两个模块

        b)注册账号:
                1、显示注册管理员
                2、注册用户两个模块
        c)退出登录:

        结束程序运行

3)登录账号成功后,根据账号的性质来显示不同的模块:
        登录管理员账号成功后,显示如下模块:

                1、查看所有图书,图书显示哪些信息,这里设计的信息有书名,书的价格,书的数量

                2、添加图书

                3、修改图书 

                4、删除图书

                5、查看所有普通用户信息

                6、查看管理员账号信息

                7、修改管理员账号信息

                8、退出系统

        登录普通账号成功后,显示如下模块:

                1、查看所有图书,图书显示哪些信息,你自行设计

                2、借阅图书

                3、归还图书

                4、显示用户信息(只能查看自己的用户信息)

                5、修改用户信息(只能修改自己的用户信息)

                6、退出系统

4)使用对象对不同类及其各自属性进行封装与功能实现

5)使用IO流实现数据的读取和写入

二、项目环境

(1)开发工具:IDEA、JDK17
(2)开发语言:Java

三、项目使用的知识点

(1)理解程序基本概念——程序、变量、数据类型
(2)顺序、选择、循环、跳转语句

(3)使用对象的思想对图书管理系统--versions1.0进行改造

        这里使用了对象封装的思想,将其分为管理员用户类,普通用户,书类,工具类,系统主页面类,将各自的类的属性功能封装,在系统页面类里面调用这些属性方法实现各个功能的开发。

   (4)使用io流实现了数据的读取和写入。

四、项目代码

        这里说明一下,为了快速写出项目,前面的用户管理的八个属性均采用String类型存储,方便自己后续代码的编写及相关功能的实现,有不足或者想要自己实现的功能部分读者可以自行修改代码实现。

AdminUser类:
package com.iosystem;

import java.io.*;

import java.util.ArrayList;
import java.util.Scanner;

public class AdminUser {
    private String adminUser;  //0
    private String adminPhoneNumber;  // 1
    private String adminIdentityNumber;  //2
    private String adminPassword;  //3
    private String adminName;
    private String adminSex;
    private String adminCareer;
    private String adminAddress;


    public AdminUser() {
    }

    public AdminUser(String adminUser, String adminPhoneNumber, String adminIdentityNumber, String adminPassword, String adminName, String adminSex, String adminCareer, String adminAddress) {
        this.adminUser = adminUser;
        this.adminPhoneNumber = adminPhoneNumber;
        this.adminIdentityNumber = adminIdentityNumber;
        this.adminPassword = adminPassword;
        this.adminName = adminName;
        this.adminSex = adminSex;
        this.adminCareer = adminCareer;
        this.adminAddress = adminAddress;
    }

    public String getAdminUser() {
        return adminUser;
    }

    public void setAdminUser(String adminUser) {
        this.adminUser = adminUser;
    }

    public String getAdminPhoneNumber() {
        return adminPhoneNumber;
    }

    public void setAdminPhoneNumber(String adminPhoneNumber) {
        this.adminPhoneNumber = adminPhoneNumber;
    }

    public String getAdminIdentityNumber() {
        return adminIdentityNumber;
    }

    public void setAdminIdentityNumber(String adminIdentityNumber) {
        this.adminIdentityNumber = adminIdentityNumber;
    }

    public String getAdminPassword() {
        return adminPassword;
    }

    public void setAdminPassword(String adminPassword) {
        this.adminPassword = adminPassword;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminSex() {
        return adminSex;
    }

    public void setAdminSex(String adminSex) {
        this.adminSex = adminSex;
    }

    public String getAdminCareer() {
        return adminCareer;
    }

    public void setAdminCareer(String adminCareer) {
        this.adminCareer = adminCareer;
    }

    public String getAdminAddress() {
        return adminAddress;
    }

    public void setAdminAddress(String adminAddress) {
        this.adminAddress = adminAddress;
    }



    Scanner scan = new Scanner(System.in);
    //管理员用户登录验证
    public int loginCheck(File file) throws IOException {
        BufferedReader brd = new BufferedReader(new FileReader(file));

        System.out.print("请输入你要登录的形式(1.手机号码+密码 2.身份证号码+密码):");
        int verifyNum = scan.nextInt();  //verifyNum  验证方式数字
        //只能选择一种登录方式
        while (true) {
            if (verifyNum == 1 || verifyNum == 2) {
                break;
            } else {
                System.out.print("\n输入错误,请输入要选择要操作的序号(只能输入1,2):");
                verifyNum = scan.nextInt();
            }
        }
        //   1.手机号码+密码   2.身份证号码+密码
        System.out.print("请输入你要登录的管理员序号(0,1,2):");
        int adminId = scan.nextInt();  //  登录管理员账号序号
        ArrayList<String> lines = new ArrayList<>();

        String line;
        while((line=brd.readLine())!=null){
            lines.add(line);
        }

        int x = lines.size();
        while(true){
            if(adminId<=x-1){
                break;
            }else {
                System.out.print("你输入的管理员账户不存在,请重新输入你要登录的管理员序号(0,1,2):");
                adminId = scan.nextInt();  //  登录管理员账号序号
            }

        }

        String[] strings = lines.get(adminId).split(",");
        if (verifyNum == 1) {    // 管理员用户
            //  管理员登录验证     手机号码+密码
            System.out.println("\n---请输入你的验证信息---");
            System.out.print("\n请输入管理员账号(默认root):");
            String adminUser1 = scan.next();
            System.out.print("\n请输入手机号码");
            String adminPhoneNumber1 = scan.next();
            System.out.print("\n请输入密码:");
            String adminPassword1 = scan.next();

            while (true) {
                if (adminUser1.equals(strings[0]) && adminPhoneNumber1.equals(strings[1]) && adminPassword1.equals(strings[3])) {
                    break;
                } else {
                    System.out.println("输入信息错误,请重新输入信息!");
                    System.out.print("请输入管理员账号序号(默认root):");
                    adminUser1 = scan.next();
                    System.out.print("\n请输入手机号码:");
                    adminPhoneNumber1 = scan.next();
                    System.out.print("\n请输入密码:");
                    adminPassword1 = scan.next();
                }
            }
        } else if (verifyNum == 2) {   //  管理员登录验证     身份证号码+密码
            System.out.print("请输入账号(默认root):");
            String adminUser2 = scan.next();
            System.out.print("\n请输入身份证号码:");
            String adminIdentityNumber2 = scan.next();
            System.out.print("\n请输入密码:");
            String adminPassword2 = scan.next();
            while (true) {
                if (adminUser2.equals(strings[0]) && adminIdentityNumber2.equals(strings[2]) && adminPassword2.equals(strings[3])) {
                    break;
                } else {
                    System.out.println("输入信息错误,请重新输入信息!");
                    System.out.print("请输入账号(默认root):");
                    adminUser2 = scan.next();
                    System.out.print("\n请输入身份证号码:");
                    adminIdentityNumber2 = scan.next();
                    System.out.print("\n请输入密码:");
                    adminPassword2 = scan.next();
                }
            }
        }
        System.out.println("登录成功!");
        brd.close();
        return adminId;
    }
    // 注册管理员用户
    public void addAdminUser(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        ArrayList<String> lines = new ArrayList<String>();
        String line=null;
        while((line = bufferedReader.readLine())!=null){
            lines.add(line);
        }
        System.out.print("\n请输入新的管理员账户名:");
        String user = scan.next();
        System.out.print("\n请输入新的手机号码:");
        String phonenumber = scan.next();
        System.out.print("\n请输入新的身份证号码:");
        String identitynumber = scan.next();
        System.out.print("\n请输入新的密码:");
        String password = scan.next();
        System.out.print("\n请输入新的姓名:");
        String name = scan.next();
        System.out.print("\n请输入新的性别:");
        String sex= scan.next();
        System.out.print("\n请输入新的专业:");
        String career= scan.next();
        System.out.print("\n请输入新的住址信息:");
        String address = scan.next();
        line =user  +","+ phonenumber +","+ identitynumber+","
                    +password+"," +name+"," + sex+","
                    +career+"," + address;

        lines.add(line);
        BufferedWriter bf = new BufferedWriter(new FileWriter(file));

        for (String content :lines){
            bf.write(content);
            bf.newLine();
        }
        System.out.println("注册管理员用户成功!");
        bf.flush();
        bf.close();
        bufferedReader.close();
    }

    //查看管理员账号信息
    public void adminInfo(File file) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(file));

        System.out.println("序号\t\t\t"+"账户名\t\t\t"+"手机号\t\t\t"+"身份证号\t\t\t"+"密码\t\t\t"+"姓名\t\t\t"+"性别\t\t\t"+"专业\t\t\t"+"住址\t\t\t");
        String line;
        int count =0;
        while ((line=br.readLine())!=null){
            String[] strings = line.split(",");
            System.out.print(count++ +"\t\t\t");
            for(int i=0;i<strings.length;i++){
                System.out.print(strings[i]+"\t\t\t");
            }
            System.out.print("\n");
        }
        br.close();
    }
    //修改管理员账号信息
    // num 修改信息序号  id 登录的是第几个管理员
    public void adminAlter(int num, int id, File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<String>();
        String line =null;
        int count=0;
        while((line=bufferedReader.readLine())!=null){
            if(count==id){
                String[] strings = line.split(",");
                if (num == 1) {                  // 管理员账号名
                    System.out.print("\n请输入新的管理员账户名:");
                    String user = scan.next();
                    strings[0] = user;
                    line = String.join(",",strings);
                    strb.add(line);

                } else if (num == 2) {        // 手机号码
                    System.out.print("\n请输入新的手机号码:");
                    String phonenumber = scan.next();
                    strings[1] = phonenumber;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 3) {        // 身份证号码
                    System.out.print("\n请输入新的身份证号码:");
                    String identitynumber = scan.next();
                    strings[2] = identitynumber;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 4) {        // 密码
                    System.out.print("\n请输入新的密码:");
                    String password = scan.next();
                    strings[3] = password;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 5) {        // 姓名
                    System.out.print("\n请输入新的姓名:");
                    String name = scan.next();
                    strings[4] = name;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 6) {        // 性别
                    System.out.print("\n请输入新的性别:");
                    String sex = scan.next();
                    strings[5] = sex;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 7) {        // 专业
                    System.out.print("\n请输入新的专业:");
                    String career = scan.next();
                    strings[6] = career;
                    line = String.join(",",strings);
                    strb.add(line);
                } else if (num == 8) {        // 住址信息
                    System.out.print("\n请输入新的住址信息:");
                    String address = scan.next();
                    strings[7] = address;
                    line = String.join(",",strings);
                    strb.add(line);
                }
                System.out.println("修改成功!");
            }else {
                strb.add(line);
            }
            count++;
        }

        BufferedWriter bf = new BufferedWriter(new FileWriter(file));
        for(String info:strb){
            bf.write(info);
            bf.newLine();
        }
        bf.flush();
        bf.close();
        bufferedReader.close();
    }
}
NormalUser类:
package com.iosystem;

import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

public class NormalUser {
    private String normalUser;
    private String normalPhoneNumber;
    private String normalIdentityNumber;
    private String normalPassword;
    private String normalName;
    private String normalSex;
    private String normalCareer;
    private String normalAddress;

    Scanner scan = new Scanner(System.in);


    public NormalUser() {

    }

    public NormalUser(String normalUser, String normalPhoneNumber, String normalIdentityNumber, String normalPassword, String normalName, String normalSex, String normalCareer, String normalAddress) {
        this.normalUser = normalUser;
        this.normalPhoneNumber = normalPhoneNumber;
        this.normalIdentityNumber = normalIdentityNumber;
        this.normalPassword = normalPassword;
        this.normalName = normalName;
        this.normalSex = normalSex;
        this.normalCareer = normalCareer;
        this.normalAddress = normalAddress;
    }

    public String getNormalUser() {
        return normalUser;
    }

    public void setNormalUser(String normalUser) {
        this.normalUser = normalUser;
    }

    public String getNormalPhoneNumber() {
        return normalPhoneNumber;
    }

    public void setNormalPhoneNumber(String normalPhoneNumber) {
        this.normalPhoneNumber = normalPhoneNumber;
    }

    public String getNormalIdentityNumber() {
        return normalIdentityNumber;
    }

    public void setNormalIdentityNumber(String normalIdentityNumber) {
        this.normalIdentityNumber = normalIdentityNumber;
    }

    public String getNormalPassword() {
        return normalPassword;
    }

    public void setNormalPassword(String normalPassword) {
        this.normalPassword = normalPassword;
    }

    public String getNormalName() {
        return normalName;
    }

    public void setNormalName(String normalName) {
        this.normalName = normalName;
    }

    public String getNormalSex() {
        return normalSex;
    }

    public void setNormalSex(String normalSex) {
        this.normalSex = normalSex;
    }

    public String getNormalCareer() {
        return normalCareer;
    }

    public void setNormalCareer(String normalCareer) {
        this.normalCareer = normalCareer;
    }

    public String getNormalAddress() {
        return normalAddress;
    }

    public void setNormalAddress(String normalAddress) {
        this.normalAddress = normalAddress;
    }





    // 验证普通用户登录
    public int loginCheck(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        //  普通用户登录验证
        System.out.print("请输入你要登录的形式(1.手机号码+密码 2.身份证号码+密码):");
        int verifyNum = scan.nextInt();  //verifyNum  验证方式数字
        //只能选择一种登录方式
        while (true) {
            if (verifyNum == 1 || verifyNum == 2) {
                break;
            } else {
                System.out.print("\n输入错误,请重新输入要选择要操作的序号(只能输入1,2):");
                verifyNum = scan.nextInt();
            }
        }
        System.out.print("请输入你要登录的普通用户序号(0,1,2,3...):");
        int normalID = scan.nextInt();  //  登录普通用户账号序号
        ArrayList<String> lines = new ArrayList();

        String line ;
        while((line=bufferedReader.readLine())!=null){
            lines.add(line);
        }
        int x = lines.size();
        //   1.手机号码+密码   2.身份证号码+密码
        while(true){
            if(normalID<=x-1){
                break;
            }else {
                System.out.print("你输入的管理员账户不存在,请重新输入你要登录的普通用户序号(0,1,2,3...):");
                normalID = scan.nextInt();  //  登录管理员账号序号
            }

        }
        String[] strings = lines.get(normalID).split(",");
        if (verifyNum == 1) {    // 普通用户
            //  普通用户登录验证     手机号码+密码
            System.out.print("\n请输入管理员账号(默认normal):");
            String normalUser1 = scan.next();
            System.out.print("\n请输入手机号码");
            String normalPhoneNumber1 = scan.next();
            System.out.print("\n请输入密码:");
            String normalPassword1 = scan.next();
            while (true) {
                if (normalUser1.equals(strings[0]) && normalPhoneNumber1.equals(strings[1]) && normalPassword1.equals(strings[3])) {
                    break;
                } else {
                    System.out.println("输入信息错误,请重新输入!");
                    System.out.print("\n请输入管理员账号序号(默认normal):");
                    normalUser1 = scan.next();
                    System.out.print("\n请输入手机号码:");
                    normalPhoneNumber1 = scan.next();
                    System.out.print("\n请输入密码:");
                    normalPassword1 = scan.next();
                }
            }
        } else if (verifyNum == 2) {   //  普通用户登录验证     身份证号码+密码
            System.out.print("\n请输入账号(默认normal):");
            String normalUser2 = scan.next();
            System.out.print("\n请输入身份证号码:");
            String normalIdentityNumber2 = scan.next();
            System.out.print("\n请输入密码:");
            String normalPassword2 = scan.next();
            while (true) {
                if (normalUser2.equals(strings[0]) && normalIdentityNumber2.equals(strings[2]) && normalPassword2.equals(strings[3])) {
                    break;
                } else {
                    System.out.println("输入信息错误,请重新输入!");
                    System.out.print("\n请输入账号:");
                    normalUser2 = scan.next();
                    System.out.print("\n请输入身份证号码:");
                    normalIdentityNumber2 = scan.next();
                    System.out.print("\n请输入密码:");
                    normalPassword2 = scan.next();
                }
            }
        }
        System.out.println("登录成功!");
        bufferedReader.close();

        return normalID;
    }

    // 注册普通用户
    public void addNormalUser(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();
        String line=null;
        while((line = bufferedReader.readLine())!=null){
            strb.add(line);
        }
        System.out.print("\n请输入新的用户账户名:");
        String user = scan.next();

        System.out.print("\n请输入新的手机号码:");
        String phonenumber = scan.next();

        System.out.print("\n请输入新的身份证号码:");
        String identitynumber = scan.next();

        System.out.print("\n请输入新的密码:");
        String password = scan.next();

        System.out.print("\n请输入新的姓名:");
        String name = scan.next();

        System.out.print("\n请输入新的性别:");
        String sex= scan.next();

        System.out.print("\n请输入新的专业:");
        String career= scan.next();

        System.out.print("\n请输入新的住址信息:");
        String address = scan.next();

        String addString =user+","+phonenumber+","+identitynumber+","
                    +password+","+name+","+sex+","
                    +","+career+","+address;
        strb.add(addString);
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));

        for(String info:strb){
            bw.write(info);
            bw.newLine();
        }
        System.out.println("注册成功!");
        bw.flush();
        bw.close();
        bufferedReader.close();

    }

    // 查看所有普通用户信息

    public void allNormal(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        System.out.println("所有普通用户信息如下:");
        System.out.println("序号\t\t\t"+"账户名\t\t\t"+"手机号\t\t\t"+"身份证号\t\t\t"+"密码\t\t\t"+"姓名\t\t\t"+"性别\t\t\t"+"专业\t\t\t"+"住址\t\t\t");

        String line = null;
        String[] strings = null;  // 存储一条用户信息
       for(int i=0;(line=bufferedReader.readLine())!=null;i++){
            strings = line.split(",");
           if (line != "\n") {
               System.out.print(i +"\t\t\t");
           }
            for(int j=0;j<strings.length;j++){
                System.out.print(strings[j]+"\t\t\t");
            }
           System.out.print("\n");
        }
        bufferedReader.close();
    }
    // 修改用户信息
    // num 修改信息序号  id 登录的是第几个管理员
    public void normalAlter(int num,int normalid,File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        ArrayList<String> strb = new ArrayList<>();
        String line =null;
        int count=0;
        while((line=bufferedReader.readLine())!=null){
            if(count==normalid){
                String[] strings = line.split(",");
                if(num ==1){                  // 管理员账号名
                    System.out.print("\n请输入新的管理员账户名:");
                    String user = scan.next();
                    strings[0] = user;
                } else if (num ==2) {        // 手机号码
                    System.out.print("\n请输入新的手机号码:");
                    String phonenumber = scan.next();
                    strings[1]=phonenumber;
                } else if (num ==3) {        // 身份证号码
                    System.out.print("\n请输入新的身份证号码:");
                    String identitynumber = scan.next();
                    strings[2] = identitynumber;
                } else if (num ==4) {        // 密码
                    System.out.print("\n请输入新的密码:");
                    String password = scan.next();
                    strings[3] = password;
                } else if (num ==5) {        // 姓名
                    System.out.print("\n请输入新的姓名:");
                    String name = scan.next();
                    strings[4]=name;
                } else if (num ==6) {        // 性别
                    System.out.print("\n请输入新的性别:");
                    String sex= scan.next();
                    strings[5] = sex;
                } else if (num ==7) {        // 专业
                    System.out.print("\n请输入新的专业:");
                    String career= scan.next();
                    strings[6] = career;
                } else if (num ==8) {        // 住址信息
                    System.out.print("\n请输入新的住址信息:");
                    String address = scan.next();
                    strings[7] = address;
                }
                line = String.join(",", strings);
                strb.add(line);
                System.out.println("修改成功");
            }else {
                strb.add(line);
            }
            count++;
        }
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
        for(String info: strb){
            bw.write(info);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        bufferedReader.close();
    }
    // 显示用户信息(只能查看自己的用户信息)
    public void myInformation(int normalId,File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        String line=null;
        System.out.println("个人信息如下:");
        System.out.println("账户名\t\t\t"+"手机号\t\t\t"+"身份证号\t\t\t"+"密码\t\t\t"+"姓名\t\t\t"+"性别\t\t\t"+"专业\t\t\t"+"住址\t\t\t");
        int count=0;
        while((line = bufferedReader.readLine())!=null){
            if(count==normalId){
                String[] strings = line.split(",");
                for(int j=0;j<strings.length;j++){
                    System.out.print(strings[j]+"\t\t\t");
                }
                System.out.print("\n");
            }
            count++;
        }
        System.out.println("查看结束");
        bufferedReader.close();
    }


}
Book类:
package com.iosystem;

import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Book {
    private String bookName;
    private String bookPrice;
    private String bookNum;


    Scanner scan = new Scanner(System.in);


    public Book() {

    }

    public Book(String bookName, String bookPrice, String bookNum) {
        this.bookName = bookName;
        this.bookPrice = bookPrice;
        this.bookNum = bookNum;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getBookPrice() {
        return bookPrice;
    }

    public void setBookPrice(String bookPrice) {
        this.bookPrice = bookPrice;
    }

    public String getBookNum() {
        return bookNum;
    }

    public void setBookNum(String bookNum) {
        this.bookNum = bookNum;
    }



    //  查看所有图书
    public void viewAllBook(File file) throws IOException {
        System.out.println("序号\t\t\t书名\t\t\t价格\t\t\t数量");
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        String line = null;


        for(int i=0;(line=bufferedReader.readLine())!=null;i++){
            String[] strings = line.split(",");
            System.out.print(i +"\t\t\t");
            for(int j=0;j<strings.length;j++){
                System.out.print(strings[j]+"\t\t\t");
            }
            System.out.print("\n");
        }
        bufferedReader.close();
    }
    // 添加图书
    public void addBook(File file) throws IOException {
        BufferedReader bufferedReader =  new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();
        System.out.print("\n请输入图书名:");
        String name = scan.next();
        System.out.print("\n请输入图书价格:");
        String price = scan.next();
        System.out.print("\n请输入图书数量:");
        String num = scan.next();

        String addBook =name+","+price+","+num;
        String line =null;
        while((line = bufferedReader.readLine())!=null){
            strb.add(line);
        }
        strb.add(addBook);
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));;
        for(String info:strb){
            bw.write(info);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        bufferedReader.close();
        System.out.println("添加图书成功!");
    }
    // 修改图书
    public void alterBook(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();
        String line = null;
        int count=0;

        System.out.print("请输入修改图书序号:");
        int bookID=scan.nextInt();  //修改图书序号

        while((line = bufferedReader.readLine())!=null){
            if(count == bookID){
                String[] strings = line.split(",");
                System.out.print("\n请输入图书名:");
                String name = scan.next();
                strings[0] = name;

                System.out.print("\n请输入图书价格:");
                String price = scan.next();
                strings[1] = price;

                System.out.print("\n请输入图书数量:");
                String num = scan.next();
                strings[2] = num;

                line =String.join(",", strings);
                strb.add(line);
                System.out.println("修改图书成功!");
            }else {
                strb.add(line);
            }
            count++;
        }

        BufferedWriter bw = new BufferedWriter(new FileWriter(file));

        for(String info: strb){
            bw.write(info);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        bufferedReader.close();
    }
    // delete 删除图书
    public void deleteBook(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();
        System.out.println("请输入删除图书序号:");
        int bookID=scan.nextInt();  //修改图书序号
        String line = null;

        while((line = bufferedReader.readLine())!=null){
            strb.add(line);
        }
        int x = strb.size();
        while(true){
            if (bookID >= 0 &&bookID < x) {
                break;
            }else {
                System.out.println("输入错误,请重新输入删除图书序号:");
                bookID=scan.nextInt();  //修改图书序号
            }
        }
        // 集合中删除图书
        strb.remove(bookID);
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
        for(String info :strb){
            bw.write(info);
            bw.newLine();
        }
        System.out.println("删除图书成功!");
        bw.flush();
        bw.close();
        bufferedReader.close();
    }
    // 借阅图书
    public void borrowBook(File file) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();
        System.out.print("\n请输入你要借阅图书序号:");
        int numbook = scan.nextInt();
        String line =null;
        int count=0;
        while((line = bufferedReader.readLine())!=null){
            if(count ==numbook){
                String[] strings = line.split(",");
                System.out.print("\n该图书还有"+strings[2]+"本");
                System.out.print("\n请输入你要借的图书数量:");
                int nums = scan.nextInt();   //  借阅数量
                int bookNum =Integer.parseInt(strings[2]);
                if((bookNum-nums)>=0){
                    bookNum-=nums;
                    String strNum = String.valueOf(bookNum);
                    strings[2] = strNum;
                    line = String.join(",", strings);
                    strb.add(line);
                    System.out.print("\n恭喜你借阅成功,该图书还剩余"+bookNum+"本\n");
                }else{
                    System.out.print("\n很遗憾,该图书已经全被借阅!");
                }
            }else {
                strb.add(line);
            }
            count++;
        }

        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
        for(String info : strb){
            bw.write(info);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        bufferedReader.close();
    }
    // 归还图书
    public void giveBackBook(File file) throws IOException {

        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        ArrayList<String> strb = new ArrayList<>();

        System.out.print("\n请输入你要归还图书序号:");
        int bk = scan.nextInt();

        String line = null;
        int count=0;
        while((line = bufferedReader.readLine())!=null){
            if(count == bk){
                String[] strings = line.split(",");
                System.out.print("\n该图书目前剩余"+strings[2]+"本");
                System.out.print("\n请输入归还书本数目:");
                int givenum = scan.nextInt();
                int sum=Integer.parseInt(strings[2])+givenum;
                strings[2] = String.valueOf(sum);
                line = String.join(",",strings);
                strb.add(line);
                System.out.print("\n恭喜你归还成功,现剩余该图书"+sum+"本");
            }else {
                strb.add(line);
            }
            count++;
        }
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
        for (String info: strb){
            bw.write(info);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        bufferedReader.close();
    }

}
Tool类:
package com.iosystem;

public class Tool {
    public void page1(){
        System.out.println("----------------请选择登录方式----------------");
        System.out.println("             1、登录账号");
        System.out.println("             2、注册账号");
        System.out.println("             3、退出登录");
    }
    public void page2(){
        System.out.println("********欢迎进入登录账号页面********");
        System.out.println("1.管理员登录:");
        System.out.println("2.普通用户登录:");
    }
    public void page3(){
        System.out.println("\n-----------欢迎进入管理员账号页面-----------");
        System.out.println("1、查看所有图书");
        System.out.println("2、添加图书");
        System.out.println("3、修改图书");
        System.out.println("4、删除图书");
        System.out.println("5、查看所有普通用户信息");
        System.out.println("6、查看管理员账号信息");
        System.out.println("7、修改管理员账号信息");
        System.out.println("8、退出系统");
    }
    public void page4(){
        System.out.println("\n-----------普通用户登录成功-----------");
        System.out.println("1.查看所有图书");
        System.out.println("2.借阅图书");
        System.out.println("3.归还图书");
        System.out.println("4.显示用户信息(只能查看自己的用户信息)");
        System.out.println("5.修改用户信息(只能修改自己的用户信息)");
        System.out.println("6.退出系统");
    }
    public void page5(){
        System.out.println("********欢迎进入注册账号页面********");
        System.out.println("1.管理员注册:");
        System.out.println("2.普通用户注册:");
    }

}
 BooksManagementSystemThree类:
package com.iosystem;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class BooksManagementSystemNew {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Tool tool = new Tool();
        AdminUser adminUser= new AdminUser();
        Book book = new Book();
        NormalUser normalUser = new NormalUser();

        File adminUL = new File("E:\\Java Code base\\FoodOrderingSystem\\src\\com\\Admin.txt");
        File bookL = new File( "E:\\Java Code base\\FoodOrderingSystem\\src\\com\\Book.txt");
        File normalUL = new File("E:\\Java Code base\\FoodOrderingSystem\\src\\com\\Normal.txt");

        while(true){
            while(true) {
                tool.page1();
                System.out.print("请输入要选择要操作的序号(只能输入1,2,3):");
                int loginNum = scan.nextInt();
                //  校验输入的序号,只能是1到3
                while (true) {
                    if (loginNum == 1 || loginNum == 2 || loginNum == 3) {
                        break;
                    } else {
                        System.out.print("请输入要选择要操作的序号(只能输入1,2,3):");
                        loginNum = scan.nextInt();
                    }
                }
                switch(loginNum){
                    case 1:
                        tool.page2();
                        System.out.print("请输入要选择要操作的序号(只能输入1,2):");
                        int enterNum =scan.nextInt();  //enterNum登录数字  1.管理员  2.用户
                        while(true){
                            if(enterNum == 1||enterNum == 2 ){
                                break;
                            }else{
                                System.out.print("输入错误,请从从新输入要选择要操作的序号(只能输入1,2):");
                                enterNum =scan.nextInt();
                            }
                        }
                        if(enterNum==1){

                            int adminID = 0;
                            try {
                                adminID = adminUser.loginCheck(adminUL);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                            while(true) {
                                tool.page3();
                                System.out.print("请输入你选择的功能:");
                                int adminnum = scan.nextInt();  // adminnum  管理员账号页面功能查看
                                while(true){
                                    if(adminnum>=1&&adminnum<=8){
                                        break;
                                    }else{
                                        System.out.print("输入错误,请重新输入你选择的功能:");
                                        adminnum = scan.nextInt();
                                    }
                                }

                                if(adminnum ==1){               //1、查看所有图书
                                    try {
                                        book.viewAllBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (adminnum==2) {      //2、添加图书
                                    try {
                                        book.addBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;

                                } else if (adminnum==3) {    //3、修改图书      //这里设计的是符合图书序号的所有图书信息都可以修改
                                    try {
                                        book.alterBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;

                                } else if (adminnum==4) {    //4、删除图书
                                    try {
                                        book.deleteBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (adminnum==5) {    //5、查看所有普通用户信息
                                    try {
                                        normalUser.allNormal(normalUL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;

                                } else if (adminnum==6) {    //6、查看管理员账号信息
                                    try {
                                        adminUser.adminInfo(adminUL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (adminnum==7) {    //7、修改管理员账号信息
                                    System.out.println("请输入要修改管理员账号的的信息(1管理员账号名2手机号码3" +
                                            "身份证号码4密码5姓名6性别7专业8住址信息):");
                                    int adID =scan.nextInt();   // adID  修改序号
                                    try {
                                        adminUser.adminAlter(adID, adminID,adminUL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                }else if (adminnum==8){      //8、退出系统
                                    System.out.println("谢谢使用,欢迎下次光临!");
                                    System.exit(0);;
                                }
                            }

                        } else if (enterNum == 2) {

                            int normalID = 0;
                            try {
                                normalID = normalUser.loginCheck(normalUL);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                            while(true){
                                tool.page4();
                                System.out.print("请输入你需要操作功能的数字:");
                                int onetwo1 = scan.nextInt();   //  选择功能数字
                                if(onetwo1==1){                 //  1.查看所有图书
                                    try {
                                        book.viewAllBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (onetwo1==2) {        //  2.借阅图书
                                    try {
                                        book.borrowBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (onetwo1==3) {        //  3.归还图书
                                    try {
                                        book.giveBackBook(bookL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (onetwo1==4) {        //  4.显示用户信息(只能查看自己的用户信息)
                                    try {
                                        normalUser.myInformation(normalID,normalUL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (onetwo1==5) {        //  5.修改用户信息(只能修改自己的用户信息)
                                    System.out.print("\n请输入你要修改的信息的选项(1普通用户账号名2手机号码" +
                                            "3身份证号码4密码5姓名6性别7专业8住址信息):");
                                    int  num=scan.nextInt();   //  normalchange  修改序号
                                    try {
                                        normalUser.normalAlter( num, normalID,normalUL);
                                    } catch (IOException e) {
                                        throw new RuntimeException(e);
                                    }
                                    continue;
                                } else if (onetwo1==6) {        //  6.退出系统
                                    System.out.print("\n谢谢使用,欢迎下次光临!");
                                    System.exit(0);;
                                }
                            }
                        }
                    case 2:
                        tool.page5();
                        System.out.print("请输入要选择要操作的序号(只能输入1,2):");
                        int registernum   = scan.nextInt();               //注册管理员或者普通用户
                        while(true){
                            if(registernum>0||registernum<3){
                                break;
                            }else {
                                System.out.println("输入序号错误,请重新输入要操作的序号(只能输入1,2):");
                                registernum   = scan.nextInt();
                            }
                        }
                        if(registernum==1){
                            try {
                                adminUser.addAdminUser(adminUL);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                            continue;

                        } else if (registernum==2) {
                            try {
                                normalUser.addNormalUser(normalUL);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                            continue;
                        }
                    case 3:
                        System.out.println("谢谢使用,欢迎下次光临!");
                        System.exit(0);;
                }

            }
        }
    }

}

初始化相关txt文件:

Admin.txt

root,1111,2222,123456,lisi,男,计算机,安徽

Normal.txt

normal,1234,5678,654321,梦洛,女,艺术,北京

Book.txt

C语言,50.0,58
Python,50.0,50

五、项目运行结果

        说明一下:这里并没有校验输入数据限制,是没写,太麻烦了,读者想要校验输入格式可以自行实现。

        说明:这里进行了完成的功能展示。

普通用户注册:

查看Normal.txt文件

​普通用户登录功能查看:

功能1:查看所有图书

功能2:借阅图书

验证图书数目是否减少响应数目:

功能3:归还图书

验证图书归还后数目是否正确:

功能4:显示用户信息

功能5:修改用户信息

查看用户信息是否修改成功:

功能6:退出系统:

管理员账户注册:

注册是否成功,查看Admin.txt

管理员用户功能查看:

1查看所有图书:

2添加图书

3修改图书

4删除图书

5查看所有普通用户信息

6查看管理员账号信息

7修改管理员账号信息

8退出登录

六、项目难点分析

1、校验功能数字是自己规定的数字

        使用while(true){}循环实现,在循环体中设置只有输入规定数字才能跳出循环,执行后面的代码。

      System.out.print("请输入要选择要操作的序号(只能输入1,2):");
      int enterNum =scan.nextInt();  //enterNum登录数字  1.管理员  2.用户
      while(true){
            if(enterNum == 1||enterNum == 2 ){
                break;
            }else{
                System.out.print("输入错误,请从从新输入要选择要操作的序号(只能输入1,2):");
                enterNum =scan.nextInt();
             }
      }
2、明确变量的定义域

要清楚自己定义的变量作用的范围:

        在Java中,变量的作用域决定了变量在程序中可见的范围。如果一个变量被定义在一个代码块内部,那么它的作用域就被限制在该代码块内部。如果一个变量被定义在方法内部,那么它的作用域就被限制在该方法内部。如果一个变量被定义在类内部但方法之外,那么它的作用域就是整个类。

        这里要注意的是,作用范围大的变量,例如adminUser、bookName...等等,要定义在整个循环体的外面,若是定义在while(){}、for(;;){}、do{}while()三种循环和if(){}else{}、switch(){}选择语句中变量,作用域只能在循环体或者选择语句中,只用在循环体或者选择语句中使用,此范围之外,不能使用,或者可能出现操作该变量失效的现象。

3、将其划分为不同的类,在不同类里面进行不同类单独的属性方法的开发与封装。
4、文件的读取和写入

        这里必须完成数据的读取才能创建写入操作,若FileRead和FileWriter:

FileRead fileRead = new FileRead(file);
FileWriter fileWriter = new FileWriter(File);

        以上述方式同时创建,这两个线程同时创建,FileWriter会打开一个空文件,会把原本文件中的数据全部清空,这样FileReader对象读取时会读取一个空文件,不会返回任何内容,造成Bug,所以必须在读取文件所有内容和对内容的操作完成之后创建FileWriter对象。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1477438.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Encoding, Encryption, Tokenization 傻傻分不清楚

Encoding, Encryption, Tokenization 傻傻分不清楚 本文转自 公众号 ByteByteGo&#xff0c;如有侵权&#xff0c;请联系&#xff0c;立即删除 今天来聊聊编码 (Encoding), 加密 (Encryption) 和 令牌化 (Tokenization) 的区别。 编码、加密和标记化是三种不同的流程&#xff…

游泳耳机哪个牌子质量好?4大高口碑产品推荐入手

游泳耳机作为一种专业的水上音频装备&#xff0c;能够使游泳者在游泳过程中享受音乐的同时保持安全和舒适。随着科技的发展&#xff0c;市面上涌现出许多品牌和型号的游泳耳机&#xff0c;但是其中哪个牌子的质量更好呢&#xff1f;下面这篇文章将为大家介绍四大热门口碑产品&a…

项目流程图

实现便利店自助付款项目 服务器&#xff1a; 1、并发服务器&#xff08;多进程、多线程、IO多路复用&#xff09; 2、SQL数据库的创建和使用&#xff08;增删改查&#xff09; 3、以模块化编写项目代码&#xff0c;按照不同模块编写.h/.c文件 客户端&#xff1a; 1、QT客户端界…

dolphinscheduler伪集群部署教程

文章目录 前言一、配置免密登录1. 配置root用户免密登录2. 创建用户2.1 创建dolphinscheduler用户2.2 配置dolphinscheduler用户免密登录2.3 退出dolphinscheduler用户 二、安装准备1. 安装条件2. 安装jdk3. 安装MySQL4. 安装zookeeper4.1 zookeeper单机部署4.1.1 zookeeper3.1…

js 手写深拷贝方法

文章目录 一、深拷贝实现代码二、代码讲解2.1 obj.constructor(obj)2.2 防止循环引用 手写一个深拷贝是我们常见的面试题&#xff0c;在实现过程中我们需要考虑的类型很多&#xff0c;包括对象、数组、函数、日期等。以下就是深拷贝实现逻辑 一、深拷贝实现代码 const origin…

扫码看视频的效果怎么做?在电脑上制作视频活码只需3步

怎么做扫码看视频的效果呢&#xff1f;通过二维码来储存视频并用来做展示用途&#xff0c;是现在很常见的一种二维码应用类型&#xff0c;这种方式可以有效的提升内容的快速传播&#xff0c;而且用户体验也比较好。 那么如何通过视频二维码生成器的功能来制作自己的二维码图片…

提升媒体文字质量:常见错误及改进措施解析

在现代媒体出版中&#xff0c;文字质量直接影响着信息的传递效率和准确性。近期&#xff0c;中国产业报协会全国行业报质检办公室对中央及国家机关主管的84家行业报纸进行了质量检查&#xff0c;发现了一系列共性的文字使用错误。本文旨在深入探讨这些错误&#xff0c;并提出改…

Springboot中ApplicationContextInitializer的使用及源码分析

文章目录 一、认识ApplicationContextInitializer1、ApplicationContextInitializer的作用2、认识ApplicationContextInitializer接口3、ApplicationContextInitializer的常用用法&#xff08;1&#xff09;注册BeanFactoryPostProcessor&#xff08;2&#xff09;注册Applicat…

关于StartAI本地部署相关问题解答

很多小伙伴们都有接入自己本地SD的需求&#xff0c;对此小编整理了一些相关问题~ 一、本地部署相关条件 对于想要本地部署的小伙伴要了解&#xff0c;相对于使用StartAI试用引擎本地部署更加考验电脑硬件配置备噢~ 流畅使用要nvidia显卡&#xff0c;6g以上显存&#xff08;最…

Google发布Genie硬杠Sora:通过大量无监督视频训练最终生成可交互虚拟世界

前言 Sora 问世才不到两个星期&#xff0c;谷歌的世界模型也来了&#xff0c;能力看似更强大(嗯&#xff0c;看似)&#xff1a;它生成的虚拟世界自主可控 第一部分 首个基础世界模型Genie 1.1 Genie是什么 Genie是第一个以无监督方式从未标记的互联网视频中训练的生成式交互…

浅析前端的堆栈原理以及深浅拷贝原理

浅析前端的堆栈原理以及深浅拷贝原理 首先来看一个案例 const obj {name:hzw,age:18 } let objName2 obj objName2.age 12 console.log(obj,objName2) // {name: hzw, age: 12} {name: hzw, age: 12}这里是不是很奇怪&#xff0c;为什么&#xff0c;为什么我改变objName2的…

使用 Gradle 版本目录进行依赖管理 - Android

/ 前言 / 在软件开发中&#xff0c;依赖管理是一个至关重要的方面。合理的依赖版本控制有助于确保项目的稳定性、安全性和可维护性。 Gradle版本目录&#xff08;Version Catalogs&#xff09;是 Gradle 构建工具的一个强大功能&#xff0c;它为项目提供了一种集中管理依赖…

轻松玩转Git

轻松玩转Git 快速入门什么是Git为什么要做版本控制安装git Git实战单枪匹马开始干拓展新功能小结 紧急修复bug分支紧急修复bug方案命令总结工作流 上传GitHub第一天上班前在家上传代码初次在公司新电脑下载代码下班回到家继续写代码到公司继续开发在公司约妹子忘记提交代码回家…

算法——滑动窗口之最大连续1的个数、将x减到0的最小操作数、水果成篮

3.最大连续1的个数 题目:. - 力扣&#xff08;LeetCode&#xff09; 题目要求的是给定一个二进制数组 nums 和一个整数 k&#xff0c;如果可以翻转最多 k 个 0 &#xff0c;则返回 数组中连续 1 的最大个数 。 按照题目正面去做,还要替换0,很麻烦 反正我们最后要求的是最长…

算法C++

枚举 1.化段为点 前缀和 eg:给一个数列&#xff0c;算x到y个数的和 #include <iostream> #include <vector> using namespace std;int main() {int n;cin>>n;vector<int> a(n);vector<int> sum(n1,0);for(int i0;i<n;i){scanf…

三种食物轮流吃,睡眠时间又长又香!

睡眠质量一直是人们关注的焦点&#xff0c;而饮食则被认为是影响睡眠的重要因素之一。近年来&#xff0c;有一种食物搭配方法备受瞩目&#xff0c;据说可以让人们的睡眠时间又长又香。这种方法并不复杂&#xff0c;只需要轮流食用三种特定食物&#xff0c;就能有效改善睡眠质量…

好用的AI模型集合

AI-Chat 这个网站提供的AI-Chat 3.5和AI-Chat 4.0聊天机器人&#xff0c;每天都可以免费使用。 不管是学习、工作还是日常生活&#xff0c;都能给我们带来很大的帮助&#xff0c;效率真的可以说是翻倍了。我觉得&#xff0c;如果你想让自己的生活更加高效、更加有序&#xff0…

Groovy - 大数据共享搜索配置

数据共享搜索列中配置了搜索列&#xff0c;相应的数据共享接口中也需要支持根据配置的字段搜索&#xff0c;配置实体时&#xff0c;支持搜索的入参code必须是searchKeys&#xff0c;且接口应该是需要支持分页&#xff08;入参必须是 current、pageSize&#xff09;的。current …

如何利用IP代理高效采集产品数据,打造爆品?

文章目录 一、什么是网络爬虫&#xff1f;二、普通人如何通过网络爬虫赚钱&#xff1f;2.1、心得分享2.2、工具自动化收集信息 三、 动态IP代理3.1、覆盖范围3.2、性价比3.3、教程中心F&Q使用教程 3.4、在网络数据采集中的重要性 四、实战应用案例一&#xff1a;ebay电商【…

树莓派驱动编译

驱动编译前提&#xff1a;驱动代码的编译需要提前编译号的内核 驱动&#xff08;3种实现方法&#xff0c;2条路线&#xff09;_驱动编写三种方法-CSDN博客 驱动的编写_驱动编写-CSDN博客 一、概念 1.1、驱动认识 1、裸机程序中是直接操控硬件的&#xff0c;操作系统…