@Override
  public void clear() {
    MainFrame.getLoglabel().setText("清空");
    refreshTable();

    this.textField_paymentId.setText("");
    this.textField_paymentamount.setText("");
    this.textField_paymentdatetime.setText("");
  }
 private void update() {
   Payment payment = getPayment();
   int paymentId = Integer.parseInt(this.textField_paymentId.getText());
   payment.setId(paymentId);
   boolean result = paymentblservice.update(payment);
   // 重新读取数据
   setViewDatas();
   // 刷新列表, 清空表单
   clear();
   // 通知更新结果
   if (result) {
     MainFrame.getLoglabel().setText("更新付款信息成功");
     logger.info("更新付款信息成功");
   } else {
     MainFrame.getLoglabel().setText("更新付款信息失败");
     logger.error("更新付款信息失败");
   }
 }
 private void delete() {
   if (!this.textField_vehicleId.getText().equals("")) {
     int vehicleId = Integer.parseInt(this.textField_vehicleId.getText());
     boolean result = vehicleblservice.delete(vehicleId);
     // 重新读取数据
     setViewDatas();
     // 刷新列表, 清空表单
     clear();
     if (result) {
       MainFrame.getLoglabel().setText("刪除车辆信息成功");
       logger.info("刪除车辆信息成功");
     } else {
       MainFrame.getLoglabel().setText("刪除车辆信息失败");
       logger.error("刪除车辆信息失败");
     }
   } else {
     showWarn("未选择车辆");
   }
 }
  private void add() {
    if (isTextExist() && isTextValidate()) {

      Vehicle vehicle = getVehicle();
      int result = vehicleblservice.add(vehicle);
      // 重新读取数据
      setViewDatas();
      // 刷新列表, 清空表单
      clear();
      // 通知添加结果
      if (result == 0) {
        MainFrame.getLoglabel().setText("新增车辆信息失败");
        logger.error("新增车辆信息失败");
      } else {
        MainFrame.getLoglabel().setText("新增车辆信息成功");
        logger.info("新增车辆信息成功");
      }
    }
  }
  private void add() {
    if (isTextExist() && isTextValidate()) {

      Payment payment = getPayment();
      int result = paymentblservice.add(payment);
      // 重新读取数据
      setViewDatas();
      // 刷新列表, 清空表单
      clear();
      // 通知添加结果
      if (result == 0) {
        MainFrame.getLoglabel().setText("新增付款信息失败");
        logger.error("新增付款信息失败");
      } else {
        MainFrame.getLoglabel().setText("新增付款信息成功");
        logger.info("新增付款信息成功");
      }
    }
  }
  private void update() {

    // getvehicle方法已经保存了department
    Vehicle vehicle = getVehicle();
    int vehicleId = Integer.parseInt(this.textField_vehicleId.getText());
    vehicle.setId(vehicleId);
    boolean result = vehicleblservice.update(vehicle);
    // 重新读取数据
    setViewDatas();
    // 刷新列表, 清空表单
    clear();
    // 通知更新结果
    if (result) {
      MainFrame.getLoglabel().setText("更新车辆信息成功");
      logger.info("更新车辆信息成功");
    } else {
      MainFrame.getLoglabel().setText("更新车辆信息失败");
      logger.error("更新车辆信息失败");
    }
  }
 private void view() {
   int id = getSelectId(getJTable());
   Vehicle vehicle = vehicleblservice.getById(id);
   MainFrame.getLoglabel().setText("查看车辆(车辆编号:" + vehicle.getVehicle_num() + ")");
   this.textField_vehicleId.setText(id + "");
   this.comboBox_showBusiness.setSelectedItem(makeDepartment(vehicle.getDepartment()));
   this.textField_vehicleNum.setText(vehicle.getVehicle_num());
   this.textField_license.setText(vehicle.getLicense_plate_number());
   this.textField_usetime.setText(DateUtil.getStringByDate(vehicle.getUsetime()));
   this.textField_vehicleinfo.setText(vehicle.getVehicle_info());
 }
 private void view() {
   int id = getSelectId(getJTable());
   Payment payment = paymentblservice.getById(id);
   MainFrame.getLoglabel().setText("查看付款单");
   this.textField_paymentId.setText(id + "");
   this.comboBox_paymentType.setSelectedItem(payment.getPayment_type());
   this.textField_paymentdatetime.setText(
       DateUtil.getStringByDateTime(payment.getPayment_datetime()));
   this.textField_paymentamount.setText(payment.getPayment_amount() + "");
   this.comboBox_user.setSelectedItem(makeUser(payment.getFinance_user()));
 }
  @Override
  public void clear() {
    MainFrame.getLoglabel().setText("清空");
    refreshTable();
    getAllTips();
    AutoTextFieldUtil.setupAutoComplete(textField_query, tips);
    this.textField_vehicleId.setText("");

    this.textField_vehicleNum.setText("");
    this.textField_license.setText("");
    this.textField_usetime.setText("");
    this.textField_vehicleinfo.setText("");
  }
  private void query() {
    String text = this.textField_query.getText().trim();
    Vector<Vehicle> vehicles;
    Vector<Vector> datas;
    String departmentName = this.comboBox_query_choosebusiness.getSelectedItem().toString();
    String sql = "";

    MainFrame.getLoglabel().setText("查询车辆(" + departmentName + " " + text + ")");
    logger.info("查询车辆(" + departmentName + " " + text + ")");

    if (departmentName.equals("所有")) {
      sql =
          "select * from vehicle where vehicle_num = '"
              + text
              + "' or license_plate_number = '"
              + text
              + "' ";

      vehicles = vehicleblservice.getBySql(sql);
      datas = changeDatas(vehicles);
      setDatas(datas);
      refreshTable();
    } else {
      sql =
          "select * from vehicle , department  where (vehicle.department_id_fk=department.id ) "
              + " and ("
              + "department.department_name = '"
              + departmentName
              + "' )"
              + "and (vehicle_num = '"
              + text
              + "' or license_plate_number = '"
              + text
              + "' ) ";
      vehicles = vehicleblservice.getBySql(sql);
      datas = changeDatas(vehicles);
      setDatas(datas);
      refreshTable();
    }
  }
  /** 向下拉框添加财务人员 */
  private void addFinancer() {
    User user = MainFrame.getInstance().getUser();

    this.comboBox_user.addItem(makeUser(user));
  }