From 0d359aa1b0b357f453c42c35aee7e2775d53a32c Mon Sep 17 00:00:00 2001 From: polarloves <1107061838@qq.com> Date: Wed, 19 Jul 2023 03:15:48 +0000 Subject: [PATCH] =?UTF-8?q?if=20else=E7=9A=84=E6=AD=A3=E7=A1=AE=E7=94=A8?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: polarloves <1107061838@qq.com> --- Java/IfElseUsage.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Java/IfElseUsage.java diff --git a/Java/IfElseUsage.java b/Java/IfElseUsage.java new file mode 100644 index 0000000..5eb9d82 --- /dev/null +++ b/Java/IfElseUsage.java @@ -0,0 +1,43 @@ + // 业务代码 + Update update; + if (operationType.equals(AuditResultOperationType.getStart())) { + update = new Update().set("XXX", AuditResultOperationType.getStart()); + } else if (operationType.equals(AuditResultOperationType.getStopBystart())) { + update = new Update().set("XXX", AuditResultOperationType.getStopBystart()); + } else if (operationType.equals(AuditResultOperationType.getImExe())) { + update = new Update().set("XXX", AuditResultOperationType.getImExe()); + } else if (operationType.equals(AuditResultOperationType.getStopByimExe())) { + update = new Update().set("XXX", AuditResultOperationType.getStopByimExe()); + } else { //删除 + update = new Update().set("XXX", AuditResultOperationType.getDel()); + } +// 这是类.... +public class AuditResultOperationType { + public static final String start = "启用"; + public static final String stopBystart = "停用"; + public static final String imExe = "立即执行"; + public static final String stopByimExe = "停止"; + public static final String del = "删除"; + + public static Integer getStart() { + return 0; + } + + public static Integer getStopBystart() { + return 1; + } + + public static Integer getImExe() { + return 2; + } + + public static Integer getStopByimExe() { + return 3; + } + + public static Integer getDel() { + return 4; + } + + +} \ No newline at end of file -- Gitee