This commit is contained in:
xixu-me committed 2024-05-29 17:04:25 +08:00
1 parent ba46ad52f6
commit e534efa80e
6 files changed
+7 -10

No files matched your search

Binary file not shown.
@@ -34,9 +34,8 @@ public class PermissionJudgment {
role = rs.getString("juese");
System.out.println("当前收银员:" + rs.getString("xingming"));
loginSuccess = true;
} else {
} else
System.out.println("用户名或密码不正确,请重新输入");
}
if (loginSuccess) {
int choice;
do {
@@ -58,11 +57,10 @@ public class PermissionJudgment {
break;
case 3:
case 5:
if ("管理员".equals(role)) {
if ("管理员".equals(role))
System.out.println("你可以执行该操作");
} else {
else
System.out.println("很抱歉,你没有权限执行该操作");
}
break;
default:
System.out.println("无效的选择,请重新选择(1-6)");
@@ -17,7 +17,6 @@ public class ProductAdditionAndInquiry {
Connection conn = DriverManager.getConnection(DBURL);
Scanner scanner = new Scanner(System.in);
int choice;
do {
System.out.println("===超市商品管理维护====");
System.out.println("1、输入商品");
@@ -31,9 +31,9 @@ public class ProductModificationAndDeletion {
pstmt = conn.prepareStatement("SELECT * FROM t_shangping WHERE tiaoma = ?");
pstmt.setString(1, codeToDelete);
rs = pstmt.executeQuery();
if (!rs.next()) {
if (!rs.next())
System.out.println("你输入的编码不存在,请重新输入");
} else {
else {
pstmt = conn.prepareStatement("DELETE FROM t_shangping WHERE tiaoma = ?");
pstmt.setString(1, codeToDelete);
pstmt.executeUpdate();
@@ -46,9 +46,9 @@ public class ProductModificationAndDeletion {
pstmt = conn.prepareStatement("SELECT * FROM t_shangping WHERE tiaoma = ?");
pstmt.setString(1, codeToModify);
rs = pstmt.executeQuery();
if (!rs.next()) {
if (!rs.next())
System.out.println("你输入的编码不存在,请重新输入");
} else {
else {
System.out.print("商品名称(" + rs.getString("mingcheng") + "):");
String name = sc.nextLine();
sc.nextLine();