Skip to content

Instantly share code, notes, and snippets.

View Joxebus's full-sized avatar
:octocat:
Working from home

Omar Bautista Joxebus

:octocat:
Working from home
View GitHub Profile
@Grab(group = "org.reflections", module = "reflections", version = "0.9.11")
@Grab(group = "org.slf4j", module = "slf4j-simple", version = "1.7.25")
import groovy.json.JsonOutput
import org.codehaus.groovy.reflection.GeneratedMetaMethod
import org.reflections.Reflections
def reflections = new Reflections("org.codehaus.groovy.runtime")
def json = reflections.getSubTypesOf(GeneratedMetaMethod).collect {
@mislas
mislas / gist:1840815
Created February 16, 2012 01:44
Como hacer consultas parametrizadas correctamente
//FORMA ACTUAL DE LAS CONSULTAS QUE RECIBEN PARÁMETROS
def obtenerTotalAportadoresQnaFonac(quincena){
PeriodosFonac.findAll("FROM PeriodosFonac WHERE $quincena AND aportacionEmpleado >0").size()
}
//FORMA CORRECTA DE PARAMETRIZAR
/** Consulta que regresa el numero total de aportadores al FONAC en la quincena especificada
* @param quincena hace el query en base a este parametro correspondiente al campo quincena del domain PeriodosFonac */
def obtenerTotalAportadoresQnaFonac(quincena){