## ============================================================================ ## Filename : SQLSelectQueryTemplate.vm ## Note(s) : This template is used to generate SQL select statement to query ## rows from a table/view. ## ## Copyright (c) 2007-2008 ThinkUI Software Inc. All rights reserved. ## ============================================================================ ## ## **************************************************************************** ## The following variables are available in this template. For more ## information on any of the following variable, please refer to the user guide. ## **************************************************************************** ## $projectName ## $authorName ## $headerText ## $tableName ## $schemaName ## $prjPkgName ## $prjClassPrefix ## $dataClass ## $dataObject ## $countOnly ## $aliasName ## $date ## $codeGen ## $stmtSeparator ## #if ($countOnly) SELECT count(*) #else SELECT#set( $firstItem = 1 )#foreach( $attr in $dataClass.getAttributes() ) #if ($firstItem == 1) #set( $firstItem = 0 ) ${aliasName}.${codeGen.getColumnNameExpr($attr)} #else ,${aliasName}.${codeGen.getColumnNameExpr($attr)} #end #end #end FROM ${schemaName.toLowerCase()}.${tableName.toLowerCase()} ${aliasName} --WHERE #set( $firstItem = 1 )#foreach( $pkAttrName in $dataClass.getPrimaryKeyAttrNames() ) #set( $attr = $dataClass.getAttribute($pkAttrName) ) #if ($firstItem == 1) #set( $firstItem = 0 )${aliasName}.${codeGen.getColumnName($attr)}=$codeGen.formatJDBCHolder($dataObject, $attr)#else -- AND ${aliasName}.${codeGen.getColumnName($attr)}=$codeGen.formatJDBCHolder($dataObject, $attr)#end#end${stmtSeparator}