From a3275155bf4286e555fc9d652a7b93696f800956 Mon Sep 17 00:00:00 2001 From: myh Date: Wed, 7 Jun 2023 19:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9B=AE=E5=BD=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src}/main/java/dao/abstractDAO.java | 0 .../src}/main/java/dao/indentAbstractDAO.java | 0 .../main/java/dao/indentItemAbstractDAO.java | 0 .../main/java/dao/merchantsAbstractDAO.java | 0 .../java/dao/specification/abstractDAO.java | 0 .../java/dao/specification/indentDAO.java | 0 .../java/dao/specification/indentItemDAO.java | 0 .../java/dao/specification/merchantsDAO.java | 0 .../main/java/dao/specification/userDAO.java | 0 .../src}/main/java/dao/userAbstractDAO.java | 0 .../src}/main/java/entities/Indent.java | 0 .../src}/main/java/entities/IndentItem.java | 0 .../src}/main/java/entities/Merchants.java | 0 .../src}/main/java/entities/Users.java | 0 .../src}/main/java/entities/dto/Login.java | 0 {src => JDBC/src}/main/java/example/App.java | 0 JDBC/src/main/java/test.java | 18 ++++++++ .../main/java/util/SQLDatabaseConnection.java | 0 {src => JDBC/src}/main/java/util/Toolset.java | 0 .../src}/main/java/view/CommonUse.java | 0 .../src}/main/java/view/IndentItemView.java | 44 +++++++++++++------ .../src}/main/java/view/IndentView.java | 0 .../src}/main/java/view/MerchantsView.java | 0 .../src}/main/java/view/UserView.java | 0 {src => JDBC/src}/main/java/view/shellUI.java | 0 .../src}/test/java/org/example/AppTest.java | 0 pom.xml | 29 ++++++++++-- 27 files changed, 74 insertions(+), 17 deletions(-) rename {src => JDBC/src}/main/java/dao/abstractDAO.java (100%) rename {src => JDBC/src}/main/java/dao/indentAbstractDAO.java (100%) rename {src => JDBC/src}/main/java/dao/indentItemAbstractDAO.java (100%) rename {src => JDBC/src}/main/java/dao/merchantsAbstractDAO.java (100%) rename {src => JDBC/src}/main/java/dao/specification/abstractDAO.java (100%) rename {src => JDBC/src}/main/java/dao/specification/indentDAO.java (100%) rename {src => JDBC/src}/main/java/dao/specification/indentItemDAO.java (100%) rename {src => JDBC/src}/main/java/dao/specification/merchantsDAO.java (100%) rename {src => JDBC/src}/main/java/dao/specification/userDAO.java (100%) rename {src => JDBC/src}/main/java/dao/userAbstractDAO.java (100%) rename {src => JDBC/src}/main/java/entities/Indent.java (100%) rename {src => JDBC/src}/main/java/entities/IndentItem.java (100%) rename {src => JDBC/src}/main/java/entities/Merchants.java (100%) rename {src => JDBC/src}/main/java/entities/Users.java (100%) rename {src => JDBC/src}/main/java/entities/dto/Login.java (100%) rename {src => JDBC/src}/main/java/example/App.java (100%) create mode 100644 JDBC/src/main/java/test.java rename {src => JDBC/src}/main/java/util/SQLDatabaseConnection.java (100%) rename {src => JDBC/src}/main/java/util/Toolset.java (100%) rename {src => JDBC/src}/main/java/view/CommonUse.java (100%) rename {src => JDBC/src}/main/java/view/IndentItemView.java (69%) rename {src => JDBC/src}/main/java/view/IndentView.java (100%) rename {src => JDBC/src}/main/java/view/MerchantsView.java (100%) rename {src => JDBC/src}/main/java/view/UserView.java (100%) rename {src => JDBC/src}/main/java/view/shellUI.java (100%) rename {src => JDBC/src}/test/java/org/example/AppTest.java (100%) diff --git a/src/main/java/dao/abstractDAO.java b/JDBC/src/main/java/dao/abstractDAO.java similarity index 100% rename from src/main/java/dao/abstractDAO.java rename to JDBC/src/main/java/dao/abstractDAO.java diff --git a/src/main/java/dao/indentAbstractDAO.java b/JDBC/src/main/java/dao/indentAbstractDAO.java similarity index 100% rename from src/main/java/dao/indentAbstractDAO.java rename to JDBC/src/main/java/dao/indentAbstractDAO.java diff --git a/src/main/java/dao/indentItemAbstractDAO.java b/JDBC/src/main/java/dao/indentItemAbstractDAO.java similarity index 100% rename from src/main/java/dao/indentItemAbstractDAO.java rename to JDBC/src/main/java/dao/indentItemAbstractDAO.java diff --git a/src/main/java/dao/merchantsAbstractDAO.java b/JDBC/src/main/java/dao/merchantsAbstractDAO.java similarity index 100% rename from src/main/java/dao/merchantsAbstractDAO.java rename to JDBC/src/main/java/dao/merchantsAbstractDAO.java diff --git a/src/main/java/dao/specification/abstractDAO.java b/JDBC/src/main/java/dao/specification/abstractDAO.java similarity index 100% rename from src/main/java/dao/specification/abstractDAO.java rename to JDBC/src/main/java/dao/specification/abstractDAO.java diff --git a/src/main/java/dao/specification/indentDAO.java b/JDBC/src/main/java/dao/specification/indentDAO.java similarity index 100% rename from src/main/java/dao/specification/indentDAO.java rename to JDBC/src/main/java/dao/specification/indentDAO.java diff --git a/src/main/java/dao/specification/indentItemDAO.java b/JDBC/src/main/java/dao/specification/indentItemDAO.java similarity index 100% rename from src/main/java/dao/specification/indentItemDAO.java rename to JDBC/src/main/java/dao/specification/indentItemDAO.java diff --git a/src/main/java/dao/specification/merchantsDAO.java b/JDBC/src/main/java/dao/specification/merchantsDAO.java similarity index 100% rename from src/main/java/dao/specification/merchantsDAO.java rename to JDBC/src/main/java/dao/specification/merchantsDAO.java diff --git a/src/main/java/dao/specification/userDAO.java b/JDBC/src/main/java/dao/specification/userDAO.java similarity index 100% rename from src/main/java/dao/specification/userDAO.java rename to JDBC/src/main/java/dao/specification/userDAO.java diff --git a/src/main/java/dao/userAbstractDAO.java b/JDBC/src/main/java/dao/userAbstractDAO.java similarity index 100% rename from src/main/java/dao/userAbstractDAO.java rename to JDBC/src/main/java/dao/userAbstractDAO.java diff --git a/src/main/java/entities/Indent.java b/JDBC/src/main/java/entities/Indent.java similarity index 100% rename from src/main/java/entities/Indent.java rename to JDBC/src/main/java/entities/Indent.java diff --git a/src/main/java/entities/IndentItem.java b/JDBC/src/main/java/entities/IndentItem.java similarity index 100% rename from src/main/java/entities/IndentItem.java rename to JDBC/src/main/java/entities/IndentItem.java diff --git a/src/main/java/entities/Merchants.java b/JDBC/src/main/java/entities/Merchants.java similarity index 100% rename from src/main/java/entities/Merchants.java rename to JDBC/src/main/java/entities/Merchants.java diff --git a/src/main/java/entities/Users.java b/JDBC/src/main/java/entities/Users.java similarity index 100% rename from src/main/java/entities/Users.java rename to JDBC/src/main/java/entities/Users.java diff --git a/src/main/java/entities/dto/Login.java b/JDBC/src/main/java/entities/dto/Login.java similarity index 100% rename from src/main/java/entities/dto/Login.java rename to JDBC/src/main/java/entities/dto/Login.java diff --git a/src/main/java/example/App.java b/JDBC/src/main/java/example/App.java similarity index 100% rename from src/main/java/example/App.java rename to JDBC/src/main/java/example/App.java diff --git a/JDBC/src/main/java/test.java b/JDBC/src/main/java/test.java new file mode 100644 index 0000000..48d7e4c --- /dev/null +++ b/JDBC/src/main/java/test.java @@ -0,0 +1,18 @@ +import javax.swing.plaf.basic.BasicInternalFrameTitlePane; +import java.util.Arrays; +import java.util.Scanner; + +public class test { + public static void main(String[] args) { + Scanner reader = new Scanner(System.in); + String s = ""; + while (!reader.hasNext("end")){ + s = reader.nextLine(); + } + String[] sn = s.split("\\s+"); + for (String item:sn) { + System.out.println(item); + } + System.out.println(Arrays.toString(sn)); + } +} diff --git a/src/main/java/util/SQLDatabaseConnection.java b/JDBC/src/main/java/util/SQLDatabaseConnection.java similarity index 100% rename from src/main/java/util/SQLDatabaseConnection.java rename to JDBC/src/main/java/util/SQLDatabaseConnection.java diff --git a/src/main/java/util/Toolset.java b/JDBC/src/main/java/util/Toolset.java similarity index 100% rename from src/main/java/util/Toolset.java rename to JDBC/src/main/java/util/Toolset.java diff --git a/src/main/java/view/CommonUse.java b/JDBC/src/main/java/view/CommonUse.java similarity index 100% rename from src/main/java/view/CommonUse.java rename to JDBC/src/main/java/view/CommonUse.java diff --git a/src/main/java/view/IndentItemView.java b/JDBC/src/main/java/view/IndentItemView.java similarity index 69% rename from src/main/java/view/IndentItemView.java rename to JDBC/src/main/java/view/IndentItemView.java index aa131f8..f95561c 100644 --- a/src/main/java/view/IndentItemView.java +++ b/JDBC/src/main/java/view/IndentItemView.java @@ -30,20 +30,38 @@ public class IndentItemView { int flag = 0; while (!reader.hasNext("end")) { IndentItem IItem = new IndentItem(); - //菜名 - IItem.setName(reader.next()); - //初始价格 - IItem.setInitialPrice(reader.nextFloat()); - //折扣 - if (reader.hasNextFloat()) { - IItem.setDiscount(reader.nextFloat()); - } else { - IItem.setDiscount(-1F); - } - //描述 - if (!reader.hasNext("end") && !Objects.equals(reader.nextLine(), " ")) { - IItem.setDescription(reader.nextLine()); + String s; + String[] sn; + while (!reader.hasNext("end")) { + s = reader.nextLine(); + sn = s.split("\\s+"); + //菜名 + IItem.setName(sn[0]); + //初始价格 + IItem.setInitialPrice(Float.valueOf(sn[1])); + //折扣 + if (sn[3] != null) { + IItem.setDiscount(Float.valueOf(sn[2])); + } else { + IItem.setDiscount(-1F); + } + //描述 + if (sn[3] != null) { + IItem.setDescription(sn[3]); + } } +// IItem.setName(reader.next()); +// IItem.setInitialPrice(reader.nextFloat()); + +// if (reader.hasNextFloat()) { +// IItem.setDiscount(reader.nextFloat()); +// } else { +// IItem.setDiscount(-1F); +// } + +// if (!reader.hasNext("end") && !Objects.equals(reader.nextLine(), " ")) { +// IItem.setDescription(reader.nextLine()); +// } //菜单ID indentDAO indent = new indentDAO(); IItem.setIndentID(indent.searchID(indentID)); diff --git a/src/main/java/view/IndentView.java b/JDBC/src/main/java/view/IndentView.java similarity index 100% rename from src/main/java/view/IndentView.java rename to JDBC/src/main/java/view/IndentView.java diff --git a/src/main/java/view/MerchantsView.java b/JDBC/src/main/java/view/MerchantsView.java similarity index 100% rename from src/main/java/view/MerchantsView.java rename to JDBC/src/main/java/view/MerchantsView.java diff --git a/src/main/java/view/UserView.java b/JDBC/src/main/java/view/UserView.java similarity index 100% rename from src/main/java/view/UserView.java rename to JDBC/src/main/java/view/UserView.java diff --git a/src/main/java/view/shellUI.java b/JDBC/src/main/java/view/shellUI.java similarity index 100% rename from src/main/java/view/shellUI.java rename to JDBC/src/main/java/view/shellUI.java diff --git a/src/test/java/org/example/AppTest.java b/JDBC/src/test/java/org/example/AppTest.java similarity index 100% rename from src/test/java/org/example/AppTest.java rename to JDBC/src/test/java/org/example/AppTest.java diff --git a/pom.xml b/pom.xml index ba0c763..f6e7154 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,14 @@ - - 4.0.0 + 4.0.0 org.example - JavaElm + Elm 1.0-SNAPSHOT jar - JavaEle + Elm https://maven.apache.org @@ -37,6 +38,7 @@ mssql-jdbc 12.2.0.jre11 + org.jetbrains annotations @@ -44,4 +46,23 @@ compile + + + JDBC/target + JDBC/src/main/java + JDBC/src/test/java + JDBC/target/classes + JDBC/target/test-classes + + + JDBC/src/main/resources + + + + + JDBC/src/test/resources + + + +