2018-04-21 01:27:45 -04:00
package com.moparisthebest.jdbc.codegen ;
import com.moparisthebest.jdbc.dto.* ;
2018-04-24 00:04:53 -04:00
import com.moparisthebest.jdbc.util.CaseInsensitiveHashMap ;
import com.moparisthebest.jdbc.util.ResultSetIterable ;
2018-04-21 01:27:45 -04:00
import java.sql.SQLException ;
2018-04-24 00:04:53 -04:00
import java.util.List ;
import java.util.Map ;
2018-04-21 01:27:45 -04:00
2018-05-07 23:10:20 -04:00
//IFJAVA8_START
import java.util.stream.Stream ;
2018-05-07 23:49:56 -04:00
import java.time.* ;
2018-05-07 23:10:20 -04:00
//IFJAVA8_END
2018-04-21 01:27:45 -04:00
@JdbcMapper.Mapper (
cachePreparedStatements = JdbcMapper . OptionalBool . FALSE
, allowReflection = JdbcMapper . OptionalBool . TRUE
)
public interface QmDao extends JdbcMapper {
public static final String personRegular = " SELECT person_no, first_name, last_name, birth_date FROM person WHERE person_no = {personNo} " ;
public static final String bossRegularAndUnderscore = " SELECT p.person_no, p.first_name AS firstName, p.last_name, p.birth_date, b.department, p.first_name " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
public static final String bossRegularAndUnderscoreReverse = " SELECT p.person_no, p.first_name, p.last_name, p.birth_date, b.department, p.first_name AS firstName " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
2018-05-10 16:01:57 -04:00
public static final String personRegularNoConstructor = " SELECT person_no, first_name, last_name, birth_date, first_name AS dummy FROM person WHERE person_no = {personNo} " ;
public static final String bossRegularAndUnderscoreNoConstructor = " SELECT p.person_no, p.first_name AS firstName, p.last_name, p.birth_date, b.department, p.first_name, p.first_name AS dummy " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
public static final String bossRegularAndUnderscoreReverseNoConstructor = " SELECT p.person_no, p.first_name, p.last_name, p.birth_date, b.department, p.first_name AS firstName, p.first_name AS dummy " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
2018-04-21 01:27:45 -04:00
public static final String bossRegular = " SELECT p.person_no, p.first_name AS firstName, p.last_name, p.birth_date, b.department " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
public static final String bossUnderscore = " SELECT p.person_no, p.first_name, p.last_name, p.birth_date, b.department " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no = {personNo} " ;
2018-04-24 00:04:53 -04:00
public static final String allNames = " SELECT first_name, last_name FROM person WHERE person_no < 4 " ;
String selectPersonNo = " SELECT person_no FROM person WHERE person_no = {personNo} " ;
String selectMapLongPerson = " SELECT p.person_no, p.first_name AS firstName, p.last_name, p.birth_date, b.department " +
" FROM person p " +
" JOIN boss b ON p.person_no = b.person_no " +
" WHERE p.person_no in (2,3,4) " ;
String selectLongLong = " SELECT person_no AS first_no, person_no AS last_no FROM person WHERE person_no < 4 " ;
String selectLongArray = " SELECT 1, 2, 3 FROM person WHERE person_no = 1 " ;
String bobTomMap = " SELECT 'bob' as bob, 'tom' as tom FROM person WHERE person_no = 1 " ;
String selectThreePeople = " SELECT person_no, first_name, last_name, birth_date from person WHERE person_no IN ({personNo1}, {personNo2}, {personNo3}) ORDER BY person_no " ;
2018-04-21 01:27:45 -04:00
2018-05-07 23:49:56 -04:00
String selectBirthDate = " SELECT birth_date FROM person WHERE person_no = {personNo} " ;
String selectNumVal = " SELECT num_val FROM val WHERE val_no = {valNo} " ;
String selectStrVal = " SELECT str_val FROM val WHERE val_no = {valNo} " ;
2018-04-21 01:27:45 -04:00
@JdbcMapper.SQL ( personRegular )
FieldPerson getFieldRegularPerson ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( personRegular )
BuilderPerson getBuilderPerson ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscore )
FieldBoss getFieldRegularAndUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscoreReverse )
FieldBoss getFieldRegularAndUnderscoreReverse ( long personNo ) throws SQLException ;
2018-05-10 16:01:57 -04:00
@JdbcMapper.SQL ( bossRegularAndUnderscoreNoConstructor )
FieldBoss getFieldRegularAndUnderscoreNoConstructor ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscoreReverseNoConstructor )
FieldBoss getFieldRegularAndUnderscoreReverseNoConstructor ( long personNo ) throws SQLException ;
2018-04-21 01:27:45 -04:00
@JdbcMapper.SQL ( bossRegular )
FieldBoss getFieldRegular ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossUnderscore )
FieldBoss getFieldUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( personRegular )
SetPerson getSetRegularPerson ( long personNo ) throws SQLException ;
2018-05-10 16:01:57 -04:00
@JdbcMapper.SQL ( personRegularNoConstructor )
SetPerson getSetRegularPersonNoConstructor ( long personNo ) throws SQLException ;
2018-04-21 01:27:45 -04:00
@JdbcMapper.SQL ( bossRegularAndUnderscore )
SetBoss getSetRegularAndUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscoreReverse )
SetBoss getSetRegularAndUnderscoreReverse ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegular )
SetBoss getSetRegular ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossUnderscore )
SetBoss getSetUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( personRegular )
ReverseFieldPerson getReverseFieldRegularPerson ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscore )
ReverseFieldBoss getReverseFieldRegularAndUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscoreReverse )
ReverseFieldBoss getReverseFieldRegularAndUnderscoreReverse ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegular )
ReverseFieldBoss getReverseFieldRegular ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossUnderscore )
ReverseFieldBoss getReverseFieldUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( personRegular )
ReverseSetPerson getReverseSetRegularPerson ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscore )
ReverseSetBoss getReverseSetRegularAndUnderscore ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegularAndUnderscoreReverse )
ReverseSetBoss getReverseSetRegularAndUnderscoreReverse ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossRegular )
ReverseSetBoss getReverseSetRegular ( long personNo ) throws SQLException ;
@JdbcMapper.SQL ( bossUnderscore )
ReverseSetBoss getReverseSetUnderscore ( long personNo ) throws SQLException ;
2018-04-24 00:04:53 -04:00
@SQL ( selectPersonNo )
Long getPersonNo ( long personNo ) throws SQLException ;
@SQL ( selectPersonNo )
long getPersonNoPrimitive ( long personNo ) throws SQLException ;
@SQL ( selectPersonNo )
int getPersonNoPrimitiveInt ( int personNo ) throws SQLException ;
@SQL ( selectPersonNo )
Long [ ] getPersonNoObjectArray ( Long personNo ) throws SQLException ;
@SQL ( allNames )
List < Map < String , String > > getAllNames ( ) throws SQLException ;
@SQL ( allNames )
2018-05-08 00:09:56 -04:00
Map < String , String > [ ] getAllNamesArray ( ) throws SQLException ;
2018-04-24 00:04:53 -04:00
@SQL ( allNames )
Map < String , String > getAllNameMap ( ) throws SQLException ;
@SQL ( selectMapLongPerson )
Map < Long , FieldBoss > getMapLongPerson ( ) throws SQLException ;
@SQL ( selectLongLong )
Map < Long , Long > getMapLongLong ( ) throws SQLException ;
2018-05-09 23:20:40 -04:00
2018-04-24 00:04:53 -04:00
@SQL ( selectLongArray )
2018-05-09 23:20:40 -04:00
@SingleRow
2018-04-24 00:04:53 -04:00
Long [ ] getLongObjectArray ( ) throws SQLException ;
@SQL ( selectLongArray )
2018-05-09 23:20:40 -04:00
@SingleRow
2018-04-24 00:04:53 -04:00
long [ ] getLongPrimitiveArray ( ) throws SQLException ;
@SQL ( bobTomMap )
List < Map < String , String > > getBobTomMap ( ) throws SQLException ;
@SQL ( bobTomMap )
List < CaseInsensitiveHashMap < String , String > > getBobTomMapCaseInsensitive ( ) throws SQLException ;
@SQL ( selectThreePeople )
List < FieldPerson > getThreePeople ( long personNo1 , long personNo2 , long personNo3 ) throws SQLException ;
@SQL ( selectThreePeople )
ResultSetIterable < FieldPerson > getThreePeopleResultSetIterable ( long personNo1 , long personNo2 , long personNo3 ) throws SQLException ;
2018-05-04 00:26:04 -04:00
2018-05-07 23:10:20 -04:00
//IFJAVA8_START
2018-05-04 00:26:04 -04:00
@SQL ( selectThreePeople )
2018-05-07 23:10:20 -04:00
Stream < FieldPerson > getThreePeopleStream ( long personNo1 , long personNo2 , long personNo3 ) throws SQLException ;
2018-05-04 00:26:04 -04:00
2018-05-07 23:10:20 -04:00
//IFJAVA8_END
2018-05-07 23:49:56 -04:00
@SQL ( " SELECT first_name, last_name FROM person WHERE person_no = {personNo} " )
EnumPerson getEnumPerson ( long personNo ) throws SQLException ;
@SQL ( " SELECT first_name FROM person WHERE person_no = {personNo} " )
EnumPerson getEnumPersonConstructor ( long personNo ) throws SQLException ;
@SQL ( " SELECT first_name FROM person WHERE person_no = {personNo} " )
FirstName getFirstName ( long personNo ) throws SQLException ;
@SQL ( " SELECT str_val as first_name, str_val as last_name FROM val WHERE val_no = 4 " )
EnumPerson getEnumPersonNull ( ) throws SQLException ;
@SQL ( " SELECT str_val FROM val WHERE val_no = 4 " )
FirstName getFirstNameNull ( ) throws SQLException ;
@SQL ( " SELECT first_name AS M_PERSON_FIRST_NAME FROM person WHERE person_no = {personNo} " )
CaseSensitivePerson getCaseSensitivePerson ( long personNo ) throws SQLException ;
//IFJAVA8_START
@SQL ( selectBirthDate )
Instant getBirthdateInstant ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
LocalDateTime getBirthdateLocalDateTime ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
LocalDate getBirthdateLocalDate ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
LocalTime getBirthdateLocalTime ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
ZonedDateTime getBirthdateZonedDateTime ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
OffsetDateTime getBirthdateOffsetDateTime ( long personNo ) throws SQLException ;
@SQL ( selectBirthDate )
OffsetTime getBirthdateOffsetTime ( long personNo ) throws SQLException ;
@SQL ( selectNumVal )
Year getYearInt ( long valNo ) throws SQLException ;
@SQL ( selectStrVal )
Year getYearString ( long valNo ) throws SQLException ;
@SQL ( selectStrVal )
ZoneId getZoneId ( long valNo ) throws SQLException ;
@SQL ( selectStrVal )
ZoneOffset getZoneOffsetInt ( long valNo ) throws SQLException ;
@SQL ( selectStrVal )
ZoneOffset getZoneOffsetString ( long valNo ) throws SQLException ;
//IFJAVA8_END
2018-05-15 08:10:52 -04:00
@SQL ( " SELECT person_no, first_name, last_name, birth_date from person WHERE {person_no IN personNos} ORDER BY person_no " )
List < FieldPerson > getFieldPeople ( List < Long > personNos ) throws SQLException ;
2018-05-20 12:51:37 -04:00
@SQL ( " SELECT person_no, first_name, last_name, birth_date from person WHERE {person_no IN personNos} AND ({first_name IN names} OR {last_name IN names}) ORDER BY person_no " )
List < FieldPerson > getFieldPeopleByName ( List < Long > personNos , List < String > names ) throws SQLException ;
2018-04-21 01:27:45 -04:00
}