private BigDecimal outstanding() { BigDecimal outstanding = BigDecimal.ZERO; for (Order order : orders) { outstanding = outstanding.add(order.getPrice()); } return outstanding; }
/** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Order entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String type = entity.getType(); if (type != null) { stmt.bindString(2, type); } String topic = entity.getTopic(); if (topic != null) { stmt.bindString(3, topic); } String startTime = entity.getStartTime(); if (startTime != null) { stmt.bindString(4, startTime); } String endTime = entity.getEndTime(); if (endTime != null) { stmt.bindString(5, endTime); } Double price = entity.getPrice(); if (price != null) { stmt.bindDouble(6, price); } Boolean realtime = entity.getRealtime(); if (realtime != null) { stmt.bindLong(7, realtime ? 1L : 0L); } String contactName = entity.getContactName(); if (contactName != null) { stmt.bindString(8, contactName); } String contactGender = entity.getContactGender(); if (contactGender != null) { stmt.bindString(9, contactGender); } String contactPhone = entity.getContactPhone(); if (contactPhone != null) { stmt.bindString(10, contactPhone); } Long expertId = entity.getExpertId(); if (expertId != null) { stmt.bindLong(11, expertId); } Long userId = entity.getUserId(); if (userId != null) { stmt.bindLong(12, userId); } }