commit 6fd5fe8d0a08c2cbebfb9540f9bbb97bedabf1fb Author: lensferno Date: Sun Mar 13 17:48:38 2022 +0800 init project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e1b65d --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +out +files +caches +target +*.token +target +log +logs +.idea +process +pkg +*.exe +*.jar +*.log \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6adf1da --- /dev/null +++ b/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + org.example + StudentManagerS + 1.0-SNAPSHOT + + + 8 + 8 + + + + + + org.xerial + sqlite-jdbc + 3.36.0.3 + + + + + \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..db36119 --- /dev/null +++ b/readme.md @@ -0,0 +1,9 @@ +# StudentManager-S + +嗯,正如你所见,这项目叫做StudentManager-S + +“-S”不是指“Super”,而是"Simple" ( ̄﹏ ̄;) ( ̄﹃ ̄) + +就一小作业而已 + + diff --git a/src/main/java/me/lensfrex/manager/Main.java b/src/main/java/me/lensfrex/manager/Main.java new file mode 100644 index 0000000..2240080 --- /dev/null +++ b/src/main/java/me/lensfrex/manager/Main.java @@ -0,0 +1,45 @@ +package me.lensfrex.manager; + +import me.lensfrex.manager.utils.IOUtil; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +public class Main { + private static final String welcomeMessage = IOUtil.inputStreamToString(Main.class.getResourceAsStream("/me.lensfrex.manager/welcomeMessage.txt"), StandardCharsets.UTF_8); + + public static void main(String[] args) { + System.out.println(welcomeMessage); + new Main().run(); + } + + private void run() { + + } + + private String getUserCommand() { + BufferedReader command = new BufferedReader(new InputStreamReader(System.in)); + try { + return command.readLine(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + private void parseCommand(String command) { + switch (command) { + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + break; + } + } +} diff --git a/src/main/java/me/lensfrex/manager/utils/Console.java b/src/main/java/me/lensfrex/manager/utils/Console.java new file mode 100644 index 0000000..4db1283 --- /dev/null +++ b/src/main/java/me/lensfrex/manager/utils/Console.java @@ -0,0 +1,5 @@ +package me.lensfrex.manager.utils; + +public class Console { + +} diff --git a/src/main/java/me/lensfrex/manager/utils/IOUtil.java b/src/main/java/me/lensfrex/manager/utils/IOUtil.java new file mode 100644 index 0000000..d71dfcf --- /dev/null +++ b/src/main/java/me/lensfrex/manager/utils/IOUtil.java @@ -0,0 +1,47 @@ +package me.lensfrex.manager.utils; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.nio.charset.Charset; + +/* + 这些Utils是我从我之前的项目里边搬过来的 + https://github.com/lensferno/dogename/tree/main/Dogename/src/main/java/me/lensferno/dogename/utils + 写得很渣,别去看 + */ + +public class IOUtil { + public static String inputStreamToString(InputStream inputStream, Charset charSet) { + byte[] bytes = readDataFromInputStream(inputStream); + if (bytes != null) { + return new String(bytes, charSet); + } else { + return null; + } + } + + public static byte[] readDataFromInputStream(InputStream inputStream) { + return readDataFromInputStream(inputStream, 5);// read every 5kb in default + } + + public static byte[] readDataFromInputStream(InputStream inputStream, int byteAllocation) { + try { + ByteArrayOutputStream byteArrayInputStream = new ByteArrayOutputStream(); + byte[] bytes = new byte[1024 * byteAllocation]; + + for (int length; (length = inputStream.read(bytes)) != -1; ) { + byteArrayInputStream.write(bytes, 0, length); + } + + byteArrayInputStream.flush(); + + inputStream.close(); + byteArrayInputStream.close(); + + return byteArrayInputStream.toByteArray(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/src/main/resources/me.lensfrex.manager/welcomeMessage.txt b/src/main/resources/me.lensfrex.manager/welcomeMessage.txt new file mode 100644 index 0000000..7d08bb7 --- /dev/null +++ b/src/main/resources/me.lensfrex.manager/welcomeMessage.txt @@ -0,0 +1,17 @@ +**************************************************************** + Welcome to StudentManager-S +**************************************************************** +Do you want to: + 1. Input record + 2. Caculate total and average score of every course + 3. Caculate total and average score of every student + 4. Sort in decending order by total socre of every student + 5. Sort in ascending order by number + 6. Sort in ascending order by name + 7. Search by number + 8. Search by name + 9. Statistic analysis for every course + 10. List reocrd + 0. Exit +**************************************************************** + Please enter your choice: \ No newline at end of file