diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml index fcbfa38..72b6bc8 100644 --- a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml @@ -5,9 +5,27 @@ lower/lower InnoDB InnoDB - |root||root|localhost|ALTER|G + |root||root|localhost|ALLOW_NONEXISTENT_DEFINER|G +|root||root|localhost|ALTER|G |root||root|localhost|ALTER ROUTINE|G +|root||root|localhost|APPLICATION_PASSWORD_ADMIN|G +|root||mysql.infoschema|localhost|AUDIT_ABORT_EXEMPT|G +|root||mysql.session|localhost|AUDIT_ABORT_EXEMPT|G +|root||mysql.sys|localhost|AUDIT_ABORT_EXEMPT|G +|root||root|localhost|AUDIT_ABORT_EXEMPT|G +|root||root|localhost|AUDIT_ADMIN|G +|root||mysql.session|localhost|AUTHENTICATION_POLICY_ADMIN|G +|root||root|localhost|AUTHENTICATION_POLICY_ADMIN|G +|root||mysql.session|localhost|BACKUP_ADMIN|G +|root||root|localhost|BACKUP_ADMIN|G +|root||root|localhost|BINLOG_ADMIN|G +|root||root|localhost|BINLOG_ENCRYPTION_ADMIN|G +|root||mysql.session|localhost|CLONE_ADMIN|G +|root||root|localhost|CLONE_ADMIN|G +|root||mysql.session|localhost|CONNECTION_ADMIN|G +|root||root|localhost|CONNECTION_ADMIN|G |root||root|localhost|CREATE|G +|root||root|localhost|CREATE ROLE|G |root||root|localhost|CREATE ROUTINE|G |root||root|localhost|CREATE TABLESPACE|G |root||root|localhost|CREATE TEMPORARY TABLES|G @@ -15,1380 +33,1660 @@ |root||root|localhost|CREATE VIEW|G |root||root|localhost|DELETE|G |root||root|localhost|DROP|G +|root||root|localhost|DROP ROLE|G +|root||root|localhost|ENCRYPTION_KEY_ADMIN|G |root||root|localhost|EVENT|G |root||root|localhost|EXECUTE|G |root||root|localhost|FILE|G +|root||mysql.infoschema|localhost|FIREWALL_EXEMPT|G +|root||mysql.session|localhost|FIREWALL_EXEMPT|G +|root||mysql.sys|localhost|FIREWALL_EXEMPT|G +|root||root|localhost|FIREWALL_EXEMPT|G +|root||root|localhost|FLUSH_OPTIMIZER_COSTS|G +|root||root|localhost|FLUSH_PRIVILEGES|G +|root||root|localhost|FLUSH_STATUS|G +|root||root|localhost|FLUSH_TABLES|G +|root||root|localhost|FLUSH_USER_RESOURCES|G +|root||root|localhost|GROUP_REPLICATION_ADMIN|G +|root||root|localhost|GROUP_REPLICATION_STREAM|G |root||root|localhost|INDEX|G +|root||root|localhost|INNODB_REDO_LOG_ARCHIVE|G +|root||root|localhost|INNODB_REDO_LOG_ENABLE|G |root||root|localhost|INSERT|G |root||root|localhost|LOCK TABLES|G +|root||root|localhost|OPTIMIZE_LOCAL_TABLE|G +|root||root|localhost|PASSWORDLESS_USER_ADMIN|G +|root||mysql.session|localhost|PERSIST_RO_VARIABLES_ADMIN|G +|root||root|localhost|PERSIST_RO_VARIABLES_ADMIN|G |root||root|localhost|PROCESS|G |root||root|localhost|REFERENCES|G |root||root|localhost|RELOAD|G |root||root|localhost|REPLICATION CLIENT|G |root||root|localhost|REPLICATION SLAVE|G +|root||root|localhost|REPLICATION_APPLIER|G +|root||root|localhost|REPLICATION_SLAVE_ADMIN|G +|root||root|localhost|RESOURCE_GROUP_ADMIN|G +|root||root|localhost|RESOURCE_GROUP_USER|G +|root||root|localhost|ROLE_ADMIN|G +|root||mysql.infoschema|localhost|SELECT|G |root||root|localhost|SELECT|G +|root||root|localhost|SENSITIVE_VARIABLES_OBSERVER|G +|root||root|localhost|SERVICE_CONNECTION_ADMIN|G +|root||mysql.session|localhost|SESSION_VARIABLES_ADMIN|G +|root||root|localhost|SESSION_VARIABLES_ADMIN|G +|root||root|localhost|SET_ANY_DEFINER|G |root||root|localhost|SHOW DATABASES|G |root||root|localhost|SHOW VIEW|G +|root||root|localhost|SHOW_ROUTINE|G +|root||mysql.session|localhost|SHUTDOWN|G |root||root|localhost|SHUTDOWN|G |root||mysql.session|localhost|SUPER|G |root||root|localhost|SUPER|G +|root||mysql.infoschema|localhost|SYSTEM_USER|G +|root||mysql.session|localhost|SYSTEM_USER|G +|root||mysql.sys|localhost|SYSTEM_USER|G +|root||root|localhost|SYSTEM_USER|G +|root||mysql.session|localhost|SYSTEM_VARIABLES_ADMIN|G +|root||root|localhost|SYSTEM_VARIABLES_ADMIN|G +|root||root|localhost|TABLE_ENCRYPTION_ADMIN|G +|root||root|localhost|TELEMETRY_LOG_ADMIN|G +|root||root|localhost|TRANSACTION_GTID_TAG|G |root||root|localhost|TRIGGER|G |root||root|localhost|UPDATE|G +|root||root|localhost|XA_RECOVER_ADMIN|G |root||root|localhost|grant option|G performance_schema|schema||mysql.session|localhost|SELECT|G sys|schema||mysql.sys|localhost|TRIGGER|G 8.4.0 - - big5 - 1 - - - big5 + + armscii8 - - dec8 + + armscii8 1 - - dec8 + + ascii - - cp850 + + ascii 1 - - cp850 + + big5 - - hp8 + + big5 1 - - hp8 - - - koi8r + + binary 1 - - koi8r + + cp1250 - - latin1 + + cp1250 - - latin1 + + cp1250 + + + cp1250 1 - - latin1 + + cp1250 - - latin1 + + cp1251 - - latin1 + + cp1251 - - latin1 + + cp1251 + 1 - - latin1 + + cp1251 - - latin1 + + cp1251 - - latin2 + + cp1256 - - latin2 + + cp1256 1 - - latin2 + + cp1257 - - latin2 + + cp1257 + 1 - - latin2 + + cp1257 - - swe7 + + cp850 + + + cp850 1 - - swe7 + + cp852 - - ascii + + cp852 1 - - ascii + + cp866 - - ujis + + cp866 1 - - ujis + + cp932 - - sjis + + cp932 1 - - sjis + + dec8 - - hebrew + + dec8 1 - - hebrew + + eucjpms - - tis620 + + eucjpms 1 - - tis620 + + euckr euckr 1 - - euckr + + gb18030 - - koi8u + + gb18030 1 - - koi8u + + gb18030 - + gb2312 - 1 - + gb2312 + 1 - - greek + + gbk + + + gbk 1 - - greek + + geostd8 - - cp1250 + + geostd8 1 - - cp1250 + + greek - - cp1250 + + greek + 1 - - cp1250 + + hebrew - - cp1250 + + hebrew + 1 - - gbk + + hp8 + + + hp8 1 - - gbk + + keybcs2 - - latin5 + + keybcs2 1 - - latin5 + + koi8r - - armscii8 + + koi8r 1 - - armscii8 + + koi8u - - utf8 + + koi8u 1 - - utf8 + + latin1 + + + latin1 + + + latin1 + + + latin1 - - utf8 + + latin1 - - utf8 + + latin1 - - utf8 + + latin1 - - utf8 + + latin1 + 1 - - utf8 + + latin2 - - utf8 + + latin2 - - utf8 + + latin2 - - utf8 + + latin2 + 1 - - utf8 + + latin2 - - utf8 + + latin5 - - utf8 + + latin5 + 1 - - utf8 + + latin7 - - utf8 + + latin7 - - utf8 + + latin7 + 1 - - utf8 + + latin7 - - utf8 + + macce - - utf8 + + macce + 1 - - utf8 + + macroman - - utf8 + + macroman + 1 - - utf8 + + sjis - - utf8 + + sjis + 1 - - utf8 + + swe7 - - utf8 + + swe7 + 1 - - utf8 + + tis620 - - utf8 + + tis620 + 1 - + ucs2 - 1 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 + 1 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - + ucs2 - - cp866 + + ujis + + + ujis 1 - - cp866 + + utf16 - - keybcs2 - 1 + + utf16 - - keybcs2 + + utf16 - - macce + + utf16 + + + utf16 + + + utf16 + + + utf16 1 - - macce + + utf16 - - macroman + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16 + + + utf16le + + + utf16le 1 - - macroman + + utf32 - - cp852 + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 1 - - cp852 + + utf32 - - latin7 + + utf32 - - latin7 + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf32 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 1 - - latin7 + + utf8mb3 - - latin7 + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 - + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + + utf8mb3 + + utf8mb4 1 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - + utf8mb4 - - cp1251 - - - cp1251 - - - cp1251 - - - cp1251 - 1 - - - cp1251 - - - utf16 - 1 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16 + + utf8mb4 - - utf16le - 1 + + utf8mb4 - - utf16le + + utf8mb4 - - cp1256 - 1 + + utf8mb4 - - cp1256 + + utf8mb4 - - cp1257 + + utf8mb4 - - cp1257 + + utf8mb4 - - cp1257 - 1 + + utf8mb4 - - utf32 - 1 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - utf32 + + utf8mb4 - - binary - 1 + + utf8mb4 - - geostd8 - 1 + + utf8mb4 - - geostd8 + + utf8mb4 - - cp932 - 1 + + utf8mb4 - - cp932 + + utf8mb4 - - eucjpms - 1 + + utf8mb4 - - eucjpms + + utf8mb4 - - gb18030 - 1 + + utf8mb4 - - gb18030 + + utf8mb4 - - gb18030 + + utf8mb4 - - utf8_general_ci + + utf8mb4_0900_ai_ci - - latin1_swedish_ci + + utf8mb4_0900_ai_ci - - utf8_general_ci + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb3_general_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci - - latin1_swedish_ci + + utf8mb4_0900_ai_ci - - utf8_general_ci + + utf8mb4_0900_ai_ci - - utf8mb4_general_ci + + utf8mb4_0900_ai_ci - - utf8mb4_unicode_ci + + utf8mb4_0900_ai_ci - + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + utf8mb4_0900_ai_ci + + + 0 + localhost + caching_sha2_password + + + 0 localhost + caching_sha2_password - + + 0 localhost + caching_sha2_password - + localhost + caching_sha2_password - + root@localhost procedure 320 - + root@localhost procedure 196 - + root@localhost procedure 199 - + root@localhost procedure 184 - +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- +
InnoDButf8mb4_0900_ai_ci
- + varchar(30)|0s 1 - + timestamp|0s 2 - + varchar(20)|0s 3 - + int|0s 4 - + float|0s 5 - + varchar(10)|0s 1 - + int|0s 2 - + varchar(10)|0s 1 - + int|0s 2 - + varchar(30)|0s 1 - + timestamp|0s 2 - + varchar(20)|0s 3 - + int|0s 4 - + float|0s 5 - + varchar(20)|0s 1 1 - + varchar(20)|0s 2 - + float|0s 3 - + float|0s 4 - + int|0s 5 - + int|0s 6 - + int|0s 7 - + varchar(20)|0s 8 - + varchar(20)|0s 9 - + float|0s 10 - + int|0s 0 11 - + supplyId id supplierinf - + id2 id prodcatalog - + id btree 1 - + name btree 1 - + supplyId btree - + id2 btree - + 1 1 PRIMARY - + name - + varchar(30)|0s 1 1 - + float|0s 2 - + timestamp|0s 3 - + varchar(15)|0s 4 - + int|0s 2 5 - + int|0s 1 6 - + iNumber btree 1 - + 1 1 PRIMARY - + varchar(30)|0s 1 - + varchar(20)|0s 2 - + int|0s 3 - + float|0s 4 - + iNumber iNumber inorder - + iNumber btree - + varchar(20)|0s 1 1 - + varchar(20)|0s 2 - + float|0s 3 - + float|0s 4 - + int|0s 5 - + int|0s 6 - + int|0s 7 - + varchar(20)|0s 8 - + varchar(20)|0s 9 - + float|0s 10 - + int|0s 0 11 - + supplyId id supplierinf - + id2 id prodcatalog - + id btree 1 - + name btree 1 - + supplyId btree - + id2 btree - + 1 1 PRIMARY - + name - + varchar(30)|0s 1 1 - + float|0s 2 - + timestamp|0s 3 - + varchar(15)|0s 4 - + int|0s 1 5 - + oNumber btree 1 - + 1 1 PRIMARY - + varchar(30)|0s 1 - + varchar(20)|0s 2 - + int|0s 3 - + float|0s 4 - + oNumber oNumber outorder - + oNumber btree - + varchar(20)|0s 1 1 - + varchar(20)|0s 2 - + id btree 1 - + 1 1 PRIMARY - + varchar(20)|0s 1 1 - + varchar(20)|0s 2 - + float|0s 3 - + float|0s 4 - + int|0s 5 - + int|0s 6 - + int|0s 7 - + varchar(20)|0s 8 - + varchar(20)|0s 9 - + float|0s 10 - + int|0s 1 11 - + id2 id prodcatalog - + id btree 1 - + name btree 1 - + id2 btree - + 1 1 PRIMARY - + name - + varchar(30)|0s 1 - + timestamp|0s 2 - + varchar(20)|0s 3 - + enum('+', '-')|0e 4 - + int|0s 5 - + 8 int|0s 1 1 - + varchar(30)|0s 2 - + varchar(50)|0s 3 - + varchar(11)|0s 4 - + varchar(50)|0s 5 - + int|0s 1 6 - + id btree 1 - + name btree 1 - + 1 1 PRIMARY - + name - + 5 int|0s 1 1 - + varchar(15)|0s 2 - + varchar(15)|0s 3 - + varchar(20)|0s 1 4 - + varchar(11)|0s 5 - + int|0s 1 6 - + varchar(50)|0s 7 - + int|0s 1 8 - + id btree 1 - + name btree 1 - + 1 1 PRIMARY - + name diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class index 17d8f88..c9dc4bd 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class index 1c4ec24..c9f09d6 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class index f8fd056..a244420 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class index e6049c6..dcbfc25 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView.class b/Supermarket/bin/com/lingnan/supermarket/view/InView.class index c6d8d22..0cd8297 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/InView.class and b/Supermarket/bin/com/lingnan/supermarket/view/InView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class index c9026fb..42e0526 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class and b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class differ diff --git a/Supermarket/bin/config/jdbc.properties b/Supermarket/bin/config/jdbc.properties index b8fa72c..4e23731 100644 --- a/Supermarket/bin/config/jdbc.properties +++ b/Supermarket/bin/config/jdbc.properties @@ -1,4 +1,4 @@ driver=com.mysql.cj.jdbc.Driver -url=jdbc:mysql://localhost:3306/supermarket +url=jdbc:mysql://localhost:3306/supermarket?serverTimezone=UTC user=root password=040820 \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/UserDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/UserDialog.java index 406dcfc..9d747e8 100644 --- a/Supermarket/src/com/lingnan/supermarket/dialog/UserDialog.java +++ b/Supermarket/src/com/lingnan/supermarket/dialog/UserDialog.java @@ -39,7 +39,7 @@ public class UserDialog extends JDialog implements ActionListener { // 下拉框组件,用于选择用户权限 private JComboBox combo; // 下拉框中的选项内容,包括请选择身份以及不同的权限角色 - private String[] identity = { "请选择身份", "收银员", "管理员", "超级管理员" }; + private String[] identity = { "请选择身份", "进货员","收银员", "管理员", "超级管理员" }; // 构造函数,用于创建添加用户信息的对话框 public UserDialog(JFrame parent) { @@ -168,6 +168,13 @@ public class UserDialog extends JDialog implements ActionListener { } // 内部类,实现了ItemListener接口,用于监听下拉框选项变化事件 + /**、 + * 进行权限的修改 + * 添加进货员权限 + * cwf + * 2024/12/11 + */ + static class MyItemListener implements ItemListener { @Override @@ -182,6 +189,8 @@ public class UserDialog extends JDialog implements ActionListener { sSuper = 2; else if (sSuper1.equals("管理员")) sSuper = 1; + else if (sSuper1.equals("进货员")) // 2024/12/11 添加进货员权限 + sSuper = 3; // 2024/12/11 添加进货员权限 else sSuper = 0; } diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java index 2dd01fc..3590fe4 100644 --- a/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java +++ b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java @@ -44,7 +44,7 @@ public class UserInfDialog extends JDialog implements ActionListener { // 下拉框组件,用于选择用户权限(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) private JComboBox combo; // 下拉框中的选项内容,包括当前权限以及不同的权限角色 - private String[] identity = { "当前权限", "收银员", "管理员", "超级管理员" }; + private String[] identity = { "当前权限", "进货员","收银员", "管理员", "超级管理员" }; // 父窗口JFrame的引用,可能用于在某些操作后对父窗口进行处理 private JFrame JFrame; @@ -189,6 +189,14 @@ public class UserInfDialog extends JDialog implements ActionListener { } // 内部类,实现了ItemListener接口,用于监听下拉框选项变化事件(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) + + /** + * cwf 2024/12/11 + * 添加了进货员的信息 + * sSuper1.equals("进货员") + * sSuper = 3; + */ + public class MyItemListener implements ItemListener { @Override @@ -198,13 +206,15 @@ public class UserInfDialog extends JDialog implements ActionListener { // 获取当前选中的下拉框选项内容 String sSuper1 = (String) cb.getSelectedItem(); if (sSuper1.equals("当前权限")) - sSuper = user.getUsuper(); + sSuper = user.getUsuper(); // 保持原权限 else if (sSuper1.equals("收银员")) - sSuper = 2; - else if (sSuper1.equals("管理员")) + sSuper = 2; // 收银员权限 + else if (sSuper1.equals("管理员")) // 新增权限角色 sSuper = 1; - else - sSuper = 0; + else if (sSuper1.equals("进货员")) // 新增权限角色 + sSuper = 3; + else + sSuper = 0; // 超级管理员 } } } \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/InView.java b/Supermarket/src/com/lingnan/supermarket/view/InView.java index 6738cf3..3a2e30d 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/InView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/InView.java @@ -486,7 +486,7 @@ public class InView extends JPanel implements ActionListener{ CreateOrder createOrder = new CreateOrder(); String OrderText = createOrder.CreateOrder(v, s[0], s[1], allPrice,uname); try {/*发送邮件*/ - SendQQMailUtil QQEmail = new SendQQMailUtil("sender@qq.com","自行获取 SMTP 授权码","receiver@qq.com","@新民超市进货需求申请",OrderText); + SendQQMailUtil QQEmail = new SendQQMailUtil("cwfeng5@qq.com","wlcinslohrgpdiac","1912638153@qq.com","@新民超市进货需求申请",OrderText); } catch (MessagingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); diff --git a/Supermarket/src/com/lingnan/supermarket/view/MainView.java b/Supermarket/src/com/lingnan/supermarket/view/MainView.java index 2d25fde..6aff0af 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/MainView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/MainView.java @@ -41,77 +41,77 @@ import com.lingnan.supermarket.view.base.BaseView; import java.awt.*; public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{ - - + + JMenuBar menuBar; JMenu settingMenu,helpMenu; - + JMenuItem skinMenuItem,configMenuItem; - - + + JSplitPane containerPanel; - + CardLayout rightPanelLayout; JPanel leftPanel,rightPanel; - + /*菜单栏*/ JLabel logoLabel,userMenuLabel1,homeMenuLabel,userMenuLabel,inMenuLabel, - outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel; - + outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel; + static JLabel remindMenuLabel;/*全局调用刷新*/ - + JPanel bottomPanel; - + JLabel timeLabel; - + JPanel purposePanel,timePanel; JLabel purposeLabel; - - + + JButton saveBtn,unSaveBtn,cancleBtn;/*退出时按钮*/ - + // Timer timer; - + private User user ;/*从登录界面传过来的用户信息*/ - + private BufferImpl bufferImpl; - + private Image bgImage ; private String iconSkin; private int skin; - + private Vector vP=new Vector() ;/*用于进货缓存*/ - + private int location; private int sSuper=-1;//界面权限 - + private static inOrderServiceImpl inOrderImpl = new inOrderServiceImpl(); private static int unConfirmmark;/*未确认订单*/ - + public MainView(User user,int skin,String iconSkin) { super(1300,850,"新民超市管理系统欢迎您",user,skin); timer = new Timer(1000,this); timer.start(); this.user = user; - + this.sSuper=user.getUsuper();//界面权限 System.out.println("userid="+user.getId()); this.addWindowListener(this); - + this.skin = skin; this.iconSkin = iconSkin; ImageIcon icon=new ImageIcon(iconSkin); //xxx代表图片存放路径,2.png图片名称及格式 this.setIconImage(icon.getImage()); - + //获得未进货的信息 Vector vInOrder; vInOrder = inOrderImpl.findUnconfirmInOrder(); unConfirmmark=vInOrder.size(); - + initView(user,skin); } @@ -120,50 +120,49 @@ public class MainView extends BaseView implements ActionListener, MouseListener, timer = new Timer(1000,this); timer.start(); this.user = user; - + this.sSuper=user.getUsuper();//界面权限 System.out.println("userid="+user.getId()); this.addWindowListener(this); - - + //获得未进货的信息 Vector vInOrder; vInOrder = inOrderImpl.findUnconfirmInOrder(); unConfirmmark=vInOrder.size(); - + initView(user,skin); } - + public static void refreshRemind() { Vector vInOrder; vInOrder = inOrderImpl.findUnconfirmInOrder(); unConfirmmark=vInOrder.size(); remindMenuLabel.setText("待确认进货:"+unConfirmmark); } - - - - + + + + /* public static User getUserInf() { return user; }*/ @Override protected void initView(User user,int skin) { - - - - + + + + /*菜单栏*/ menuBar = new JMenuBar(); - + settingMenu = new JMenu("设置"); - + helpMenu = new JMenu("帮助"); - + skinMenuItem = new JMenuItem("随机切换皮肤",new ImageIcon("static\\icon\\skin.png")); /* for(int i = 3;i<9;i++) { @@ -171,36 +170,36 @@ public class MainView extends BaseView implements ActionListener, MouseListener, }*/ configMenuItem = new JMenuItem("参数设置",new ImageIcon("static\\icon\\setting.png")); skinMenuItem.addActionListener(this); - + settingMenu.add(configMenuItem); settingMenu.add(skinMenuItem); menuBar.add(settingMenu); menuBar.add(helpMenu); - + setJMenuBar(menuBar); - + /*左边菜单栏设置*/ - - + + try { bgImage = ImageIO.read(new File("static\\bg\\bg"+skin+".jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + leftPanel = new BGPanel(bgImage);/*皮肤*/ leftPanel.setLayout(null); - + /*菜单栏:用户登录信息*/ System.out.println("用户头像地址=="+user.getImg()); JLabel logoLabel = new JLabel(new ImageIcon(user.getImg()),JLabel.LEFT); System.out.println(user.getImg()); leftPanel.add(logoLabel); logoLabel.setBounds(25, 30,150,150); - + /*账号名字*/ String x = UsuperIcon(user.getUsuper());/*判断权限返回icon地址*/ System.out.println("身份地址:"+x); @@ -210,9 +209,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener, userMenuLabel1.setBounds(20, 170,180,32); userMenuLabel1.setForeground(Color.white); leftPanel.add(userMenuLabel1);/*添加用户选项到菜单栏*/ - - - + + + /*菜单栏:首页*/ homeMenuLabel = new JLabel("新民首页",new ImageIcon("static\\icon\\home1.png"),JLabel.LEFT); homeMenuLabel.setFont(FontUtil.menuFont); @@ -220,9 +219,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener, homeMenuLabel.setBounds(20, 250,150,32); homeMenuLabel.setForeground(Color.white); leftPanel.add(homeMenuLabel);/*添加用户选项到菜单栏*/ - - - + + + /*菜单栏:人员管理*/ userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT); userMenuLabel.setFont(FontUtil.menuFont); @@ -230,7 +229,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, userMenuLabel.setBounds(20, 300,150,32); userMenuLabel.setForeground(Color.white); leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/ - + /*菜单栏:进货系统*/ inMenuLabel = new JLabel("进货系统",new ImageIcon("static\\icon\\in1.png") ,JLabel.LEFT); inMenuLabel.setFont(FontUtil.menuFont); @@ -238,7 +237,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, inMenuLabel.setBounds(20, 350,150,32); inMenuLabel.setForeground(Color.white); leftPanel.add(inMenuLabel); - + /*菜单栏:收银系统*/ outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT); outMenuLabel.setFont(FontUtil.menuFont); @@ -246,7 +245,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, outMenuLabel.setBounds(20, 400,150,32); outMenuLabel.setForeground(Color.white); leftPanel.add(outMenuLabel); - + /*菜单栏:库存*/ storageMenuLabel = new JLabel("商品库存",new ImageIcon("static\\icon\\storage1.png") ,JLabel.LEFT); storageMenuLabel.setFont(FontUtil.menuFont); @@ -254,7 +253,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, storageMenuLabel.setBounds(20, 450,150,32); storageMenuLabel.setForeground(Color.white); leftPanel.add(storageMenuLabel); - + /*菜单栏:供应商*/ supplierMenuLabel = new JLabel("供应商",new ImageIcon("static\\icon\\supplier1.png") ,JLabel.LEFT); supplierMenuLabel.setFont(FontUtil.menuFont); @@ -262,7 +261,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, supplierMenuLabel.setBounds(20, 500,150,32); supplierMenuLabel.setForeground(Color.white); leftPanel.add(supplierMenuLabel); - + /*菜单栏:商品目录*/ catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT); catalogMenuLabel.setFont(FontUtil.menuFont); @@ -270,7 +269,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, catalogMenuLabel.setBounds(20,550,150,32); catalogMenuLabel.setForeground(Color.white); leftPanel.add(catalogMenuLabel); - + /*提醒进货确认模块*/ remindMenuLabel = new JLabel("待确认进货:"+unConfirmmark,new ImageIcon("static\\icon\\remind1.png") ,JLabel.LEFT); remindMenuLabel.setFont(FontUtil.remindFont); @@ -278,37 +277,37 @@ public class MainView extends BaseView implements ActionListener, MouseListener, remindMenuLabel.setBounds(0,650,200,32); remindMenuLabel.setForeground(Color.white); leftPanel.add(remindMenuLabel); - - + + rightPanelLayout = new CardLayout(); - + //0.超市首页展示 JPanel homePanel = new HomeView(this); - + //1.用户管理界面:用户的列表 JPanel userPanel = new UserView(this); - + //2.进货系统界面 JPanel inPanel = new InView(this,user,vP,1); - + //3收银系统界面 JPanel outPanel = new OutView(this,user); - + //4.库存系统界面 JPanel storagePanel = new StorageView(this); - + //5.供应商界面 JPanel supplierPanel = new SupplierView(this); - + //6商品目录界面 JPanel ProdCatalogPanel = new ProdCatalogView(this); //7商品目录界面 JPanel superPanel = new SuperView(this); - + //8进货信息提示 JPanel inPanel2 = new InView(this,user,vP,0); - + /*添加界面并给索引*/ rightPanel = new JPanel(rightPanelLayout); rightPanel.add(homePanel, "0"); @@ -320,29 +319,29 @@ public class MainView extends BaseView implements ActionListener, MouseListener, rightPanel.add(ProdCatalogPanel, "6"); rightPanel.add(superPanel, "7"); rightPanel.add(inPanel2, "8"); - - + + containerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel); containerPanel.setDividerLocation(180); containerPanel.setDividerSize(0); - + bottomPanel = new JPanel();//默认的布局是流式布局 - + bottomPanel.setBackground(Color.WHITE); bottomPanel.setLayout(new BorderLayout()); - + purposePanel = new JPanel(); purposePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); purposePanel.setBackground(Color.WHITE); purposeLabel = new JLabel("当前位置是:超市首页"); purposePanel.add(purposeLabel); - + timePanel=new JPanel(); timePanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); timePanel.setBackground(Color.WHITE); timeLabel = new JLabel(DateUtil.dateToString(new Date(),null)); timePanel.add(timeLabel); - + bottomPanel.add(purposePanel,"West"); bottomPanel.add(timePanel,"East"); Container container = getContentPane(); @@ -361,96 +360,153 @@ public class MainView extends BaseView implements ActionListener, MouseListener, this.dispose(); new MainView(user,skin,iconSkin); } - + } - @Override/*左侧菜单栏点击事件*/ + + /** + * cwf 2024/12/11 + * 修改不同权限用户的功能代码 + */ + + @Override + /* 左侧菜单栏点击事件 */ public void mouseClicked(MouseEvent e) { - Object source = e.getSource(); - if(source==homeMenuLabel) { - rightPanelLayout.show(rightPanel,"0"); - location=0; - }else if(source==userMenuLabel) { - if(sSuper==0) - rightPanelLayout.show(rightPanel,"1"); - else{ - rightPanelLayout.show(rightPanel,"7"); + Object source = e.getSource(); // 获取点击事件的来源 + + // 如果点击的是首页菜单 + if (source == homeMenuLabel) { + rightPanelLayout.show(rightPanel, "0"); // 显示首页界面 + location = 0; // 设置当前位置为首页 + } + // 如果点击的是人员管理菜单 + else if (source == userMenuLabel) { + // 如果用户是管理员 (sSuper == 0) 或进货员 (sSuper == 1) + if (sSuper == 0 || sSuper == 1) { + rightPanelLayout.show(rightPanel, "1"); // 显示人员管理界面 + } + // 如果用户是普通用户 (sSuper == 3) + else if (sSuper == 3) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如普通用户权限) + else { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + location = 1; // 设置当前位置为人员管理 + } + // 如果点击的是进货系统菜单 + else if (source == inMenuLabel) { + // 如果用户是普通用户 (sSuper == 2) 或进货员 (sSuper == 1) + if (sSuper == 2 || sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "2"); // 显示进货系统界面 } - location=1; + location = 2; // 设置当前位置为进货系统 } - else if(source==inMenuLabel) { - if(sSuper==2) - rightPanelLayout.show(rightPanel,"7"); - else{ - rightPanelLayout.show(rightPanel,"2"); - + // 如果点击的是收银系统菜单 + else if (source == outMenuLabel) { + // 如果用户是普通用户 (sSuper == 3) 或进货员 (sSuper == 1) + if (sSuper == 3 || sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "3"); // 显示收银系统界面 + location = 3; // 设置当前位置为收银系统 } - location=2; } - else if(source==outMenuLabel) { - rightPanelLayout.show(rightPanel,"3"); - location=3; + // 如果点击的是库存系统菜单 + else if (source == storageMenuLabel) { + // 如果用户是进货员 (sSuper == 1) + if (sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "4"); // 显示库存系统界面 + location = 4; // 设置当前位置为库存系统 + } } - else if(source==storageMenuLabel) { - rightPanelLayout.show(rightPanel,"4"); - location=4; + // 如果点击的是供应商菜单 + else if (source == supplierMenuLabel) { + // 如果用户是进货员 (sSuper == 1) + if (sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "5"); // 显示供应商界面 + location = 5; // 设置当前位置为供应商 + } } - else if(source==supplierMenuLabel) { - rightPanelLayout.show(rightPanel,"5"); - - location=5; - + // 如果点击的是商品目录菜单 + else if (source == catalogMenuLabel) { + // 如果用户是进货员 (sSuper == 1) + if (sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 + } + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "6"); // 显示商品目录界面 + location = 6; // 设置当前位置为商品目录 + } } - else if(source==catalogMenuLabel) { - rightPanelLayout.show(rightPanel,"6"); - location=6; - - }else if(source==remindMenuLabel) { - if(sSuper==2) - rightPanelLayout.show(rightPanel,"7"); - else{ - rightPanelLayout.show(rightPanel,"8"); + // 如果点击的是提醒菜单 + else if (source == remindMenuLabel) { + // 如果用户是普通用户 (sSuper == 2) 或进货员 (sSuper == 1) + if (sSuper == 2 || sSuper == 1) { + rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面 } - location=7; - }else if(source==userMenuLabel1){ - - UserInfDialog userInfDialog = new UserInfDialog(this,user); - userInfDialog.setVisible(true); - location=8; + // 其他情况(例如管理员权限) + else { + rightPanelLayout.show(rightPanel, "8"); // 显示进货信息提示界面 + } + location = 7; // 设置当前位置为提醒 + } + // 如果点击的是用户信息菜单 + else if (source == userMenuLabel1) { + UserInfDialog userInfDialog = new UserInfDialog(this, user); // 创建用户信息对话框 + userInfDialog.setVisible(true); // 显示用户信息对话框 + location = 8; // 设置当前位置为用户信息 } - - refreshRemove(); + + refreshRemove(); // 刷新当前界面的位置信息 } + //获取当前位置 - public void refreshRemove(){ + public void refreshRemove(){ - purposePanel.removeAll(); - if(location==0){ - purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText()); - - }else if(location==1){ - purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText()); - - }else if(location==2){ - purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText()); - - }else if(location==3){ - purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText()); - - }else if(location==4){ - purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText()); - - }else if(location==5){ - purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText()); - - }else{ - purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText()); - } - - purposePanel.add(purposeLabel); - + purposePanel.removeAll(); + if(location==0){ + purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText()); + + }else if(location==1){ + purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText()); + + }else if(location==2){ + purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText()); + + }else if(location==3){ + purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText()); + + }else if(location==4){ + purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText()); + + }else if(location==5){ + purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText()); + + }else{ + purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText()); } + purposePanel.add(purposeLabel); + + } + @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub @@ -460,9 +516,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener, @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub - + } - + @Override/*鼠标焦点时*/ public void mouseEntered(MouseEvent e) { Object source = e.getSource(); @@ -488,21 +544,19 @@ public class MainView extends BaseView implements ActionListener, MouseListener, }else if(source==catalogMenuLabel) { catalogMenuLabel.setForeground(new Color(18, 150, 219)); catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog2.png")); - } - else if(source==userMenuLabel1) { + } else if(source==userMenuLabel1) { userMenuLabel1.setForeground(new Color(18, 150, 219)); - - } + + } } @Override public void mouseExited(MouseEvent e) { - Object source = e.getSource(); + Object source = e.getSource(); if(source==homeMenuLabel) { homeMenuLabel.setForeground(Color.white); homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); - } - else if(source==userMenuLabel) { + } else if(source==userMenuLabel) { userMenuLabel.setForeground(Color.white); userMenuLabel.setIcon(new ImageIcon("static\\icon\\user1.png")); }else if(source==inMenuLabel) { @@ -520,31 +574,30 @@ public class MainView extends BaseView implements ActionListener, MouseListener, }else if(source==catalogMenuLabel) { catalogMenuLabel.setForeground(Color.white); catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); - } - else { + } else { userMenuLabel1.setForeground(Color.white); - - } - + + } + } @Override protected void initView() { // TODO Auto-generated method stub - + } @Override public void windowOpened(WindowEvent e) { // TODO Auto-generated method stub - + } @Override public void windowClosing(WindowEvent e) { // TODO Auto-generated method stub - Object source = e.getSource(); + Object source = e.getSource(); if(source==this) {/*关闭窗口时检查进货系统和出货系统是否还有记录*/ this.vP =InView.getVector(); System.out.println("v的size="+vP.size()); @@ -554,7 +607,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener, closeDialog.setVisible(true); }else System.exit(0); - + } } @@ -562,31 +615,31 @@ public class MainView extends BaseView implements ActionListener, MouseListener, @Override public void windowClosed(WindowEvent e) { // TODO Auto-generated method stub - + } @Override public void windowIconified(WindowEvent e) { // TODO Auto-generated method stub - + } @Override public void windowDeiconified(WindowEvent e) { // TODO Auto-generated method stub - + } @Override public void windowActivated(WindowEvent e) { // TODO Auto-generated method stub - + } @Override public void windowDeactivated(WindowEvent e) { // TODO Auto-generated method stub - + }