/*
* Copyright 2021 E.J.I.E., S.A.
*
* Licencia con arreglo a la EUPL, Versión 1.1 exclusivamente (la «Licencia»);
* Solo podrá usarse esta obra si se respeta la Licencia.
* Puede obtenerse una copia de la Licencia en
*
* http://ec.europa.eu/idabc/eupl.html
*
* Salvo cuando lo exija la legislación aplicable o se acuerde por escrito,
* el programa distribuido con arreglo a la Licencia se distribuye «TAL CUAL»,
* SIN GARANT�?AS NI CONDICIONES DE NINGÚN TIPO, ni expresas ni implícitas.
* Véase la Licencia en el idioma concreto que rige los permisos y limitaciones
* que establece la Licencia.
*/
package com.ejie.ad74a.dao;

import com.ejie.x38.dao.RowNumResultSetExtractor;
import com.ejie.x38.dto.TableManager;
import com.ejie.x38.dto.TableRequestDto;
import com.ejie.x38.dto.TableRowDto;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ejie.ad74a.model.MaestroNivSoporte;
import com.ejie.ad74a.util.UtilSQL;

/**
 * MaestroNivSoporteDaoImpl generated by UDA, 15-ago-2023 8:18:24.
 * 
 * @author UDA
 */

@Repository
@Transactional
public class MaestroNivSoporteDaoImpl implements MaestroNivSoporteDao {

	/**
	 * StringBuilder initilization value
	 */
	public static final int STRING_BUILDER_INIT = 4096;

	protected static final String[] ORDER_BY_WHITE_LIST = new String[] { "IDNIVELSOPORTE58", "DESCES58", "DESCEU58",
			"FALTA58", "USUALTA58", "FMODIF58", "USUMODIF58" };

	private JdbcTemplate jdbcTemplate;

	public static final String SEQUENCE_MAESTRO_NIV_SOPORTE = "SEQ_MAESTRO_NIV_SOPORTE";

	/*
	 * ROW_MAPPERS
	 */
	private RowMapper<MaestroNivSoporte> rwMap = new RowMapper<MaestroNivSoporte>() {
		public MaestroNivSoporte mapRow(ResultSet resultSet, int rowNum) throws SQLException {
			return new MaestroNivSoporte(UtilSQL.getLong(resultSet, "IDNIVELSOPORTE58"),
					resultSet.getString("DESCES58"), resultSet.getString("DESCEU58"), resultSet.getDate("FALTA58"),
					resultSet.getString("USUALTA58"), resultSet.getDate("FMODIF58"), resultSet.getString("USUMODIF58"));
		}
	};

	private RowMapper<MaestroNivSoporte> rwMapPK = new RowMapper<MaestroNivSoporte>() {
		public MaestroNivSoporte mapRow(ResultSet resultSet, int rowNum) throws SQLException {
			return new MaestroNivSoporte(UtilSQL.getLong(resultSet, "IDNIVELSOPORTE58"));
		}
	};

	/**
	 * Method use to set the datasource.
	 *
	 * @param dataSource DataSource
	 *
	 * @return
	 */
	@Resource
	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	/*
	 * OPERACIONES CRUD
	 */

	/**
	 * Inserts a single row in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 *
	 * @return MaestroNivSoporte
	 */
	public MaestroNivSoporte add(MaestroNivSoporte maestronivsoporte) {

		GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();

		String query = "INSERT INTO MAESTRO_NIV_SOPORTE (ID_NIVEL_SOPORTE_58, DESC_ES_58, DESC_EU_58, F_ALTA_58, USU_ALTA_58, F_MODIF_58, USU_MODIF_58) "
				+ "VALUES (" + SEQUENCE_MAESTRO_NIV_SOPORTE
				+ ".NEXTVAL,:descEs,:descEu,:fAlta,:usuAlta,:fModif,:usuModif)";

		MapSqlParameterSource parameters = new MapSqlParameterSource()
				.addValue("descEs", maestronivsoporte.getDescEs58()).addValue("descEu", maestronivsoporte.getDescEu58())
				.addValue("fAlta", maestronivsoporte.getfAlta58()).addValue("usuAlta", maestronivsoporte.getUsuAlta58())
				.addValue("fModif", maestronivsoporte.getfModif58())
				.addValue("usuModif", maestronivsoporte.getUsuModif58());

		NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
		namedParameterJdbcTemplate.update(query, parameters, generatedKeyHolder,
				new String[] { "ID_NIVEL_SOPORTE_58" });
		maestronivsoporte.setIdNivelSoporte58(generatedKeyHolder.getKey().longValue());

		return maestronivsoporte;
	}

	/**
	 * Updates a single row in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 *
	 * @return MaestroNivSoporte
	 */
	public MaestroNivSoporte update(MaestroNivSoporte maestronivsoporte) {
		String query = "UPDATE MAESTRO_NIV_SOPORTE SET DESC_ES_58=?, DESC_EU_58=?, F_MODIF_58=?, USU_MODIF_58=? WHERE ID_NIVEL_SOPORTE_58=?";
		this.jdbcTemplate.update(query, maestronivsoporte.getDescEs58(), maestronivsoporte.getDescEu58(),
				maestronivsoporte.getfModif58(), maestronivsoporte.getUsuModif58(),
				maestronivsoporte.getIdNivelSoporte58());
		return maestronivsoporte;
	}

	/**
	 * Finds a single row in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 *
	 * @return MaestroNivSoporte
	 */
	@Transactional(readOnly = true)
	public MaestroNivSoporte find(MaestroNivSoporte maestronivsoporte) {
		String query = "SELECT t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58, t1.DESC_ES_58 DESCES58, t1.DESC_EU_58 DESCEU58, t1.F_ALTA_58 FALTA58, t1.USU_ALTA_58 USUALTA58, t1.F_MODIF_58 FMODIF58, t1.USU_MODIF_58 USUMODIF58 FROM MAESTRO_NIV_SOPORTE t1  WHERE t1.ID_NIVEL_SOPORTE_58 = ?  ";

		List<MaestroNivSoporte> maestronivsoporteList = this.jdbcTemplate.query(query, this.rwMap,
				maestronivsoporte.getIdNivelSoporte58());
		return DataAccessUtils.uniqueResult(maestronivsoporteList);
	}

	/**
	 * Removes a single row in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 */
	public void remove(MaestroNivSoporte maestronivsoporte) {
		String query = "DELETE FROM MAESTRO_NIV_SOPORTE WHERE ID_NIVEL_SOPORTE_58=?";
		this.jdbcTemplate.update(query, maestronivsoporte.getIdNivelSoporte58());
	}

	public List<MaestroNivSoporte> getMultiple(MaestroNivSoporte filterMaestroNivSoporte,
			TableRequestDto tableRequestDto, Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58, t1.DESC_ES_58 DESCES58, t1.DESC_EU_58 DESCEU58, t1.F_ALTA_58 FALTA58, t1.USU_ALTA_58 USUALTA58, t1.F_MODIF_58 FMODIF58, t1.USU_MODIF_58 USUMODIF58 ");
		// FROM
		query.append("FROM MAESTRO_NIV_SOPORTE t1 ");
		// WHERE clause & Params
		Map<String, Object> mapaWhere = this.getWhereLikeMap(filterMaestroNivSoporte, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		@SuppressWarnings("unchecked")
		List<Object> params = (List<Object>) mapaWhere.get("params");

		StringBuilder sbMultipleSQL = query.append(TableManager.getSelectMultipleQuery(tableRequestDto,
				MaestroNivSoporte.class, params, "id_nivel_soporte_58"));

		return this.jdbcTemplate.query(sbMultipleSQL.toString(), this.rwMap, params.toArray());
	}

	/**
	 * Finds a list of rows in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 * @param tableRequestDto   TableRequestDto
	 *
	 * @return List<MaestroNivSoporte>
	 */
	@Transactional(readOnly = true)
	public List<MaestroNivSoporte> findAll(MaestroNivSoporte maestronivsoporte, TableRequestDto tableRequestDto) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT  t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58,t1.DESC_ES_58 DESCES58,t1.DESC_EU_58 DESCEU58,t1.F_ALTA_58 FALTA58,t1.USU_ALTA_58 USUALTA58,t1.F_MODIF_58 FMODIF58,t1.USU_MODIF_58 USUMODIF58 ");

		// FROM
		query.append("FROM MAESTRO_NIV_SOPORTE t1 ");

		// WHERE clause & Params
		Map<String, ?> mapaWhere = this.getWhereMap(maestronivsoporte);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		if (tableRequestDto != null) {
			query = TableManager.getPaginationQuery(tableRequestDto, query,
					MaestroNivSoporteDaoImpl.ORDER_BY_WHITE_LIST);
		}

		return this.jdbcTemplate.query(query.toString(), this.rwMap, params.toArray());
	}

	/**
	 * Finds rows in the MaestroNivSoporte table using like.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 * @param tableRequestDto   TableRequestDto
	 * @param startsWith        Boolean
	 *
	 * @return List<MaestroNivSoporte>
	 */
	@Transactional(readOnly = true)
	public List<MaestroNivSoporte> findAllLike(MaestroNivSoporte maestronivsoporte, TableRequestDto tableRequestDto,
			Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT  t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58,t1.DESC_ES_58 DESCES58,t1.DESC_EU_58 DESCEU58,t1.F_ALTA_58 FALTA58,t1.USU_ALTA_58 USUALTA58,t1.F_MODIF_58 FMODIF58,t1.USU_MODIF_58 USUMODIF58 ");

		// FROM
		query.append("FROM MAESTRO_NIV_SOPORTE t1 ");

		// WHERE clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(maestronivsoporte, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		if (tableRequestDto != null) {
			query = TableManager.getPaginationQuery(tableRequestDto, query,
					MaestroNivSoporteDaoImpl.ORDER_BY_WHITE_LIST);
		}

		return this.jdbcTemplate.query(query.toString(), this.rwMap, params.toArray());
	}

	/*
	 * OPERACIONES RUP_TABLE
	 */

	/**
	 * Counts rows in the MaestroNivSoporte table.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 *
	 * @return Long
	 */
	@Transactional(readOnly = true)
	public Long findAllCount(MaestroNivSoporte maestronivsoporte) {
		// SELECT
		StringBuilder query = new StringBuilder("SELECT COUNT(1) FROM MAESTRO_NIV_SOPORTE t1 ");

		// WHERE clause & Params
		Map<String, ?> mapaWhere = this.getWhereMap(maestronivsoporte);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		return this.jdbcTemplate.queryForObject(query.toString(), params.toArray(), Long.class);
	}

	/**
	 * Counts rows in the MaestroNivSoporte table using like.
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 * @param startsWith        Boolean
	 *
	 * @return Long
	 */
	@Transactional(readOnly = true)
	public Long findAllLikeCount(MaestroNivSoporte maestronivsoporte, Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder("SELECT COUNT(1) FROM MAESTRO_NIV_SOPORTE t1 ");

		// WHERE clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(maestronivsoporte, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		return this.jdbcTemplate.queryForObject(query.toString(), params.toArray(), Long.class);
	}

	/**
	 * Reorder the data list of MaestroNivSoporte selected for rup_table
	 *
	 * @param maestronivsoporte MaestroNivSoporte
	 * @param tableRequestDto   TableRequestDto
	 * @param startsWith        Boolean
	 *
	 * @return List<TableRowDto<MaestroNivSoporte>>
	 */
	@Override
	public List<TableRowDto<MaestroNivSoporte>> reorderSelection(MaestroNivSoporte maestronivsoporte,
			TableRequestDto tableRequestDto, Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58,t1.DESC_ES_58 DESCES58,t1.DESC_EU_58 DESCEU58,t1.F_ALTA_58 FALTA58,t1.USU_ALTA_58 USUALTA58,t1.F_MODIF_58 FMODIF58,t1.USU_MODIF_58 USUMODIF58 ");
		// FROM
		query.append("FROM MAESTRO_NIV_SOPORTE t1 ");
		// FILTRADO
		// WHERE clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(maestronivsoporte, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		// Parámetros de filtrado
		@SuppressWarnings("unchecked")
		List<Object> filterParamList = (List<Object>) mapaWhere.get("params");

		// SQL para la reordenación
		StringBuilder sbReorderSelectionSQL = TableManager.getReorderQuery(query, tableRequestDto,
				MaestroNivSoporte.class, filterParamList, "idnivelsoporte58");

		return this.jdbcTemplate.query(sbReorderSelectionSQL.toString(),
				new RowNumResultSetExtractor<MaestroNivSoporte>(this.rwMapPK, tableRequestDto),
				filterParamList.toArray());
	}

	/**
	 * Search method for rup_table
	 *
	 * @param filterParams    MaestroNivSoporte
	 * @param searchParams    MaestroNivSoporte
	 * @param tableRequestDto TableRequestDto
	 * @param startsWith      Boolean
	 *
	 * @return List<TableRowDto<MaestroNivSoporte>>
	 */
	@Override
	public List<TableRowDto<MaestroNivSoporte>> search(MaestroNivSoporte filterParams, MaestroNivSoporte searchParams,
			TableRequestDto tableRequestDto, Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_NIVEL_SOPORTE_58 IDNIVELSOPORTE58,t1.DESC_ES_58 DESCES58,t1.DESC_EU_58 DESCEU58,t1.F_ALTA_58 FALTA58,t1.USU_ALTA_58 USUALTA58,t1.F_MODIF_58 FMODIF58,t1.USU_MODIF_58 USUMODIF58 ");
		// FROM
		query.append("FROM MAESTRO_NIV_SOPORTE t1 ");
		// TABLAS_ALIAS
		List<String> from_alias = new ArrayList<String>();
		from_alias.add(" t1 ");

		// FILTRADO
		Map<String, ?> mapaWhereFilter = this.getWhereLikeMap(filterParams, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhereFilter.get("query"));
		query.append(where);
		// Filter params
		@SuppressWarnings("unchecked")
		List<Object> filterParamList = (List<Object>) mapaWhereFilter.get("params");

		// BUSQUEDA
		Map<String, Object> mapaWhereSearch = this.getWhereLikeMap(searchParams, startsWith);
		String searchSQL = ((StringBuilder) mapaWhereSearch.get("query")).toString();
		// Search params
		@SuppressWarnings("unchecked")
		List<Object> searchParamList = (List<Object>) mapaWhereSearch.get("params");

		// SQL
		StringBuilder sbReorderSelectionSQL = TableManager.getSearchQuery(query, tableRequestDto,
				MaestroNivSoporte.class, filterParamList, searchSQL, searchParamList, from_alias, "IDNIVELSOPORTE58");

		return this.jdbcTemplate.query(sbReorderSelectionSQL.toString(),
				new RowNumResultSetExtractor<MaestroNivSoporte>(this.rwMapPK, tableRequestDto),
				filterParamList.toArray());
	}

	/**
	 * Remove multiple method for rup_table
	 *
	 * @param tableRequestDto TableRequestDto
	 */
	@Override
	public void removeMultiple(TableRequestDto tableRequestDto) {
		StringBuilder sbRemoveMultipleSQL = TableManager.getRemoveMultipleQuery(null, tableRequestDto,
				MaestroNivSoporte.class, "MAESTRO_NIV_SOPORTE", "t1", new String[] { "IDNIVELSOPORTE58" });

		List<String> params = tableRequestDto.getMultiselection().getSelectedIds();

		this.jdbcTemplate.update(sbRemoveMultipleSQL.toString(), params.toArray());
	}

	/*
	 * MÃ‰TODOS PRIVADOS
	 */

	/**
	 * Returns a map with the needed value to create the conditions to filter by the
	 * MaestroNivSoporte entity
	 *
	 * @param maestronivsoporte MaestroNivSoporte Bean with the criteria values to
	 *                          filter by.
	 *
	 * @return Map created with two keys key query stores the sql query syntax key
	 *         params stores the parameter values to be used in the condition
	 *         sentence.
	 */
	private Map<String, ?> getWhereMap(MaestroNivSoporte maestronivsoporte) {
		StringBuilder where = new StringBuilder(MaestroNivSoporteDaoImpl.STRING_BUILDER_INIT);
		List<Object> params = new ArrayList<Object>();

		if (maestronivsoporte != null && maestronivsoporte.getIdNivelSoporte58() != null) {
			where.append(" AND t1.ID_NIVEL_SOPORTE_58 = ?");
			params.add(maestronivsoporte.getIdNivelSoporte58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getDescEs58() != null) {
			where.append(" AND t1.DESC_ES_58 = ?");
			params.add(maestronivsoporte.getDescEs58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getDescEu58() != null) {
			where.append(" AND t1.DESC_EU_58 = ?");
			params.add(maestronivsoporte.getDescEu58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getfAlta58() != null) {
			where.append(" AND t1.F_ALTA_58 = ?");
			params.add(maestronivsoporte.getfAlta58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getUsuAlta58() != null) {
			where.append(" AND t1.USU_ALTA_58 = ?");
			params.add(maestronivsoporte.getUsuAlta58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getfModif58() != null) {
			where.append(" AND t1.F_MODIF_58 = ?");
			params.add(maestronivsoporte.getfModif58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getUsuModif58() != null) {
			where.append(" AND t1.USU_MODIF_58 = ?");
			params.add(maestronivsoporte.getUsuModif58());
		}

		Map<String, Object> mapWhere = new HashMap<String, Object>();
		mapWhere.put("query", where);
		mapWhere.put("params", params);

		return mapWhere;
	}

	/**
	 * Returns a map with the needed value to create the conditions to filter by the
	 * MaestroNivSoporte entity
	 *
	 * @param maestronivsoporte MaestroNivSoporte Bean with the criteria values to
	 *                          filter by.
	 * @param startsWith        Boolean
	 *
	 * @return Map created with two keys key query stores the sql query syntax key
	 *         params stores the parameter values to be used in the condition
	 *         sentence.
	 */
	private Map<String, Object> getWhereLikeMap(MaestroNivSoporte maestronivsoporte, Boolean startsWith) {
		StringBuilder where = new StringBuilder(MaestroNivSoporteDaoImpl.STRING_BUILDER_INIT);
		List<Object> params = new ArrayList<Object>();

		if (maestronivsoporte != null && maestronivsoporte.getIdNivelSoporte58() != null) {
			where.append(" AND t1.ID_NIVEL_SOPORTE_58 = ?");
			params.add(maestronivsoporte.getIdNivelSoporte58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getDescEs58() != null) {
			where.append(" AND UPPER(t1.DESC_ES_58) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(maestronivsoporte.getDescEs58().toUpperCase() + "%");
			} else {
				params.add("%" + maestronivsoporte.getDescEs58().toUpperCase() + "%");
			}
			where.append(" AND t1.DESC_ES_58 IS NOT NULL");
		}
		if (maestronivsoporte != null && maestronivsoporte.getDescEu58() != null) {
			where.append(" AND UPPER(t1.DESC_EU_58) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(maestronivsoporte.getDescEu58().toUpperCase() + "%");
			} else {
				params.add("%" + maestronivsoporte.getDescEu58().toUpperCase() + "%");
			}
			where.append(" AND t1.DESC_EU_58 IS NOT NULL");
		}
		if (maestronivsoporte != null && maestronivsoporte.getfAlta58() != null) {
			where.append(" AND t1.F_ALTA_58 = ?");
			params.add(maestronivsoporte.getfAlta58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getUsuAlta58() != null) {
			where.append(" AND UPPER(t1.USU_ALTA_58) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(maestronivsoporte.getUsuAlta58().toUpperCase() + "%");
			} else {
				params.add("%" + maestronivsoporte.getUsuAlta58().toUpperCase() + "%");
			}
			where.append(" AND t1.USU_ALTA_58 IS NOT NULL");
		}
		if (maestronivsoporte != null && maestronivsoporte.getfModif58() != null) {
			where.append(" AND t1.F_MODIF_58 = ?");
			params.add(maestronivsoporte.getfModif58());
		}
		if (maestronivsoporte != null && maestronivsoporte.getUsuModif58() != null) {
			where.append(" AND UPPER(t1.USU_MODIF_58) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(maestronivsoporte.getUsuModif58().toUpperCase() + "%");
			} else {
				params.add("%" + maestronivsoporte.getUsuModif58().toUpperCase() + "%");
			}
			where.append(" AND t1.USU_MODIF_58 IS NOT NULL");
		}

		Map<String, Object> mapWhere = new HashMap<String, Object>();
		mapWhere.put("query", where);
		mapWhere.put("params", params);

		return mapWhere;
	}
}
