Created
March 22, 2020 17:58
-
-
Save upangka/93d3e4e96afbe739c811025c1a873588 to your computer and use it in GitHub Desktop.
jooq dynamic record fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Field<?>[] fields = USER_SCORE.fields(); | |
List<Field> f = new ArrayList<>(Arrays.asList(fields)); | |
f.add(USER.USERNAME); | |
f.add(USER.MOBILE); | |
Field<?>[] myFields = f.toArray(new Field<?>[0]); | |
Record myRecord = db().newRecord(myFields); | |
List<? extends Record> fetch = db().select(myFields) | |
.from(USER_SCORE.leftJoin(USER).on(USER_SCORE.USER_ID.eq(USER.USER_ID)).leftJoin(USER_TAG).on(USER_SCORE.USER_ID.eq(USER_TAG.USER_ID))) | |
.where(USER_SCORE.DESC.eq(VersionName.SUB_3_SIGN_SCORE)) | |
.and(condition) | |
.orderBy(USER_SCORE.CREATE_TIME.desc()) | |
.fetchInto(myRecord.getClass()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment