Skip to content

Instantly share code, notes, and snippets.

@DenWav
Created August 25, 2016 20:14
Show Gist options
  • Select an option

  • Save DenWav/499a93d9b546b7e17282d2ce868e4aa2 to your computer and use it in GitHub Desktop.

Select an option

Save DenWav/499a93d9b546b7e17282d2ce868e4aa2 to your computer and use it in GitHub Desktop.
val result = if (damage == -1) {
query
.from(b)
.where(b.id.eq(id), b.blockid.eq(blockid.toShort()))
.uniqueResult(b.amount.sum())
} else {
query
.from(b)
.where(b.id.eq(id), b.blockid.eq(blockid.toShort()), b.damage.eq(damage.toShort()))
.uniqueResult(b.amount.sum())
} ?: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment