From b105299885923b6aedaa92ec19d732f193ab113d Mon Sep 17 00:00:00 2001 From: JRNitre Date: Sat, 22 Jun 2024 23:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=A1=B9=E7=9B=AE=200220240611=20?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/codeStyles/codeStyleConfig.xml | 5 +++++ .../CourseExperiment/src/ElmAdminEntry.java | 10 +++++----- .../CourseExperiment/src/ElmBusinessEntry.java | 18 +++++++++--------- .../src/View/BusinessView.java | 1 + .../src/dao/BusinessDaoImpl.java | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/.idea/codeStyles/codeStyleConfig.xml diff --git a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/.idea/codeStyles/codeStyleConfig.xml b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmAdminEntry.java b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmAdminEntry.java index f137490..bb9fd5e 100644 --- a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmAdminEntry.java +++ b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmAdminEntry.java @@ -20,13 +20,13 @@ public class ElmAdminEntry { Display dis = new Display('+', '-', 30); AdminView adv = new AdminView(); -// Admin admin = new Admin(); -// admin.setAdminName("jrnitre"); -// admin.setAdminId(1); -// admin.setAdminPassword("1234"); + Admin admin = new Admin(); + admin.setAdminName("jrnitre"); + admin.setAdminId(1); + admin.setAdminPassword("1234"); // 实例化管理员对象, 调用登录方法对其初始化 - Admin admin = new AdminView().login(); +// Admin admin = new AdminView().login(); if (admin != null){ int key; diff --git a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmBusinessEntry.java b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmBusinessEntry.java index 02a4f1a..9af08ca 100644 --- a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmBusinessEntry.java +++ b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/ElmBusinessEntry.java @@ -21,16 +21,16 @@ public class ElmBusinessEntry { BusinessView buv = new BusinessView(); // Login 方法登录系统 - Business business = new BusinessView().login(); +// Business business = new BusinessView().login(); -// Business business = new Business(); -// business.setBusinessPassword("1234"); -// business.setBusinessName("business"); -// business.setBusinessId(1); -// business.setBusinessAddress("null"); -// business.setBusinessExplain("null"); -// business.setBusinessStarPrice(5); -// business.setBusinessDeliveryPrice(1.5); + Business business = new Business(); + business.setBusinessPassword("1234"); + business.setBusinessName("business"); + business.setBusinessId(1); + business.setBusinessAddress("null"); + business.setBusinessExplain("null"); + business.setBusinessStarPrice(5); + business.setBusinessDeliveryPrice(1.5); if (business != null){ int key; diff --git a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/View/BusinessView.java b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/View/BusinessView.java index 8b44dfc..064938f 100644 --- a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/View/BusinessView.java +++ b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/View/BusinessView.java @@ -419,6 +419,7 @@ public class BusinessView { } // 同步 ID + food.setBusinessId(business.getBusinessId()); while ( true ) { diff --git a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/dao/BusinessDaoImpl.java b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/dao/BusinessDaoImpl.java index aafcc63..ae41ef6 100644 --- a/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/dao/BusinessDaoImpl.java +++ b/02_Intellij_Java_CourseExperiment_20240611/CourseExperiment/src/dao/BusinessDaoImpl.java @@ -334,7 +334,7 @@ public class BusinessDaoImpl implements BusinessDao{ pstmt.setString(2, food.getFoodName()); pstmt.setString(3, food.getFoodExplain()); pstmt.setDouble(4, food.getFoodPrice()); - pstmt.setDouble(5, food.getFoodId()); + pstmt.setInt(5, food.getBusinessId()); pstmt.executeUpdate(); pstmt.close();