重构:在多个文件中添加注释并改进代码结构

为了提高代码库的可读性和可维护性,通过添加注释来详细说明各类、方法及变量的目的和功能。 同时,引入必要的构造器、getter、setter,并根据更好的编程实践重构现有功能。
修改的文件包括:
src/dao/AdminDao.java
src/dao/AdminDaoImpl.java
src/po/Admin.java
src/View/AdminView.java
src/po/Business.java
src/dao/BusinessDao.java
src/dao/BusinessDaoImpl.java
src/View/Display.java
src/ElmAdminEntry.java
src/ElmBusinessEntry.java
src/jdbc/JDBC.java
This commit is contained in:
JRNitre 2024-06-18 22:48:26 +08:00
parent 9f6c2729ca
commit 341989695b
11 changed files with 13 additions and 11 deletions

View File

@ -12,6 +12,8 @@ public class ElmAdminEntry {
new ElmAdminEntry().work(); new ElmAdminEntry().work();
} }
// CodeLineNum 2600
private static final int exitCode = 10; private static final int exitCode = 10;
public void work(){ public void work(){
@ -99,4 +101,4 @@ public class ElmAdminEntry {
System.exit(0); System.exit(0);
} }
} }
} }

View File

@ -127,4 +127,4 @@ public class ElmBusinessEntry {
} }
} }
} }
} }

View File

@ -555,4 +555,4 @@ public class AdminView {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@ -209,4 +209,4 @@ public class Display {
System.out.println("+ °´»Ø³µ¼ü¼ÌÐø..."); System.out.println("+ °´»Ø³µ¼ü¼ÌÐø...");
sca.nextLine(); sca.nextLine();
} }
} }

View File

@ -15,4 +15,4 @@ public interface AdminDao {
boolean updateAdminPassword(Admin admin); boolean updateAdminPassword(Admin admin);
ResultSet fuzzyQueryExampleForName(String name); ResultSet fuzzyQueryExampleForName(String name);
ResultSet getAllAdmin(); ResultSet getAllAdmin();
} }

View File

@ -181,4 +181,4 @@ public class AdminDaoImpl implements AdminDao{
} }
return null; return null;
} }
} }

View File

@ -26,4 +26,4 @@ public interface BusinessDao {
boolean deleteFoodId(int foodId, Business business); boolean deleteFoodId(int foodId, Business business);
boolean deleteFoodName(String foodName, Business business); boolean deleteFoodName(String foodName, Business business);
ResultSet getBusinessFoodInfo(Business business); ResultSet getBusinessFoodInfo(Business business);
} }

View File

@ -511,4 +511,4 @@ public class BusinessDaoImpl implements BusinessDao{
} }
return false; return false;
} }
} }

View File

@ -30,4 +30,4 @@ public class JDBC {
throw new RuntimeException("数据库连接失败", e); throw new RuntimeException("数据库连接失败", e);
} }
} }
} }

View File

@ -57,4 +57,4 @@ public class Admin {
public void setAdminPassword(String password){ public void setAdminPassword(String password){
adminPassword = password; adminPassword = password;
} }
} }

View File

@ -93,4 +93,4 @@ public class Business {
public String toString() { public String toString() {
return super.toString(); return super.toString();
} }
} }