init project

main
lensfrex 3 years ago
commit 6fd5fe8d0a
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 14
      .gitignore
  2. 26
      pom.xml
  3. 9
      readme.md
  4. 45
      src/main/java/me/lensfrex/manager/Main.java
  5. 5
      src/main/java/me/lensfrex/manager/utils/Console.java
  6. 47
      src/main/java/me/lensfrex/manager/utils/IOUtil.java
  7. 17
      src/main/resources/me.lensfrex.manager/welcomeMessage.txt

14
.gitignore vendored

@ -0,0 +1,14 @@
out
files
caches
target
*.token
target
log
logs
.idea
process
pkg
*.exe
*.jar
*.log

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>StudentManagerS</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
</dependency>
</dependencies>
</project>

@ -0,0 +1,9 @@
# StudentManager-S
嗯,正如你所见,这项目叫做StudentManager-S
“-S”不是指“Super”,而是"Simple" ( ̄﹏ ̄;) ( ̄﹃ ̄)
就一小作业而已

@ -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;
}
}
}

@ -0,0 +1,5 @@
package me.lensfrex.manager.utils;
public class Console {
}

@ -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;
}
}
}

@ -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:
Loading…
Cancel
Save