在我的public enum Operation {
PLUS("+", (x, y) -> x + y),
MINUS("-", (x, y) -> x - y),
MULTIPLY("*", (x, y) -> x * y),
DIVIDE("/", (x, y) -> x / y);
private final DoubleBinaryOperator op;
private final String symbol;
public double apply(double x, double y) {
return op.applyAsDouble(x, y);
}
Operation(String symbol, DoubleBinaryOperator op) {
this.symbol = symbol;
this.op = op;
}
public String toString() {
return symbol;
}
public static void setAnswerText(double num1, double num2, Operation operator) {
final double ans = operator.apply(num1, num2);
final double doub = Math.round(ans * 100000.0) / 100000.0;
if (doub == (int) ans) {
Answer.setText(Integer.toString((int) ans));
} else {
Answer.setText(Double.toString(doub));
}
}
public static void main(String[] args) {
final double num1 = 100;
final double num2 = 200;
final Operation oper = Operation.PLUS;
setAnswerText(num1, num2, oper);
}
}
表中,有 4 列:employee_kra
。
这4个是复合主键,在插入查询中插入了4条记录后,我希望自动增量到Staff_id,Appraisal_type_id,EmpKra_id,Kra_id
。