#foreach ($column in $columns)
#end
#if($table.sub)
#foreach ($column in $subTable.columns)
#end
#end
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
#foreach($column in $columns)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
#set($javaType=$column.javaType)
#set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query)
#if($column.queryType == "EQ")
and $columnName = #{entity.$javaField}
#elseif($queryType == "NE")
and $columnName != #{entity.$javaField}
#elseif($queryType == "GT")
and $columnName > #{entity.$javaField}
#elseif($queryType == "GTE")
and $columnName >= #{entity.$javaField}
#elseif($queryType == "LT")
and $columnName < #{entity.$javaField}
#elseif($queryType == "LTE")
and $columnName <= #{entity.$javaField}
#elseif($queryType == "LIKE")
and $columnName like concat('%', #{entity.$javaField}, '%')
#elseif($queryType == "BETWEEN")
and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}
#end
#end
#end
#foreach($column in $columns)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
#set($javaType=$column.javaType)
#set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query)
#if($column.queryType == "EQ")
and $columnName = #{$javaField}
#elseif($queryType == "NE")
and $columnName != #{$javaField}
#elseif($queryType == "GT")
and $columnName > #{$javaField}
#elseif($queryType == "GTE")
and $columnName >= #{$javaField}
#elseif($queryType == "LT")
and $columnName < #{$javaField}
#elseif($queryType == "LTE")
and $columnName <= #{$javaField}
#elseif($queryType == "LIKE")
and $columnName like concat('%', #{$javaField}, '%')
#elseif($queryType == "BETWEEN")
and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}
#end
#end
#end