Skip to content

Instantly share code, notes, and snippets.

@edgarMejia
Last active April 9, 2019 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgarMejia/98ed143cbac34d21d00e157b2da824a6 to your computer and use it in GitHub Desktop.
Save edgarMejia/98ed143cbac34d21d00e157b2da824a6 to your computer and use it in GitHub Desktop.
//Changing user status to inactive.
List<String> ldapUsernames = lstLdap.stream()
.map(ItemUserLDAP::getUsername)
.collect(Collectors.toList());
List<User> inactiveUsers = User.find.
where()
.not(Expr.in("username", ldapUsernames))
.not(Expr.eq("username", MAIN_USR))
.eq("status_ldap", Parameters.ACTIVE)
.findList();
// SORTING
find.where().orderBy("fieldname desc").findList();
// Obtener una lista de resultados que esten entre dos números
lstDuplicate = find.where()
.isNull("deleted_at")
.or(Expr.between("lower_limit ", "upper_limit", original.getLowerLimit()),
Expr.between("lower_limit ", "upper_limit", original.getUpperLimit()))
.eq("periodicity_id", periodicity)
.findList();
/**
* OBTENET UNA LISTA DE REGISTROS QUE ESTEN ENTRE DOS FECHAS
* @param paysheetId paysheet unique id
* @param employeeId employee unique id
* @param startDate start of date range
* @param finishDate finish of date range
* @return total as Double
*/
public static List<VwRecalculatedRent> getTotalPreRentSalary(Integer paysheetId, Integer employeeId, Date startDate, Date finishDate) {
return find.where()
.eq(PAYSHEET_ID, paysheetId)
.eq(EMPLOYEE_ID, employeeId)
.between(PAYSHEET_DATE, new java.sql.Date(startDate.getTime()), new java.sql.Date(finishDate.getTime()))
.findList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment