Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/pesquisar grupo evento #215

Merged
merged 3 commits into from
Dec 6, 2023

Conversation

robsonad07
Copy link
Collaborator

No description provided.

Comment on lines +583 to +628
public ArrayList<GrupoEventos> pesquisarGrupoEventos(String nome, Date inicioDate, Date fimDate){
String sql = "SELECT * FROM pesquisa_grupo_evento where nome ilike ? ";

if (inicioDate != null)
sql += "and inicio >= '" + inicioDate.toString() + "' ";

if (fimDate != null)
sql += "and fim <= '" + fimDate.toString() + "' ";

if (nome == "" && inicioDate == null && fimDate == null)
sql += "limit 30";

try {
ArrayList<GrupoEventos> grupoEventos = new ArrayList<>();

PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, "%" + nome + "%");
ResultSet resultSet = stmt.executeQuery();

while (resultSet.next()) {
GrupoEventos grupoEventosTemp = new GrupoEventos(resultSet.getInt("id_grupo_eventos"));
grupoEventos.add(getPreviewGrupoEventos(grupoEventosTemp).get());
}
return grupoEventos;
} catch (SQLException e) {
return new ArrayList<GrupoEventos>();
}
}

public ArrayList<Integer> pesquisarGrupoMetas(int id_grupo_eventos){
String sql = "SELECT * FROM pesquisa_grupo_evento_meta where id_grupo_eventos = ? ";
try {
ArrayList<Integer> metaId = new ArrayList<>();

PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setInt(1, id_grupo_eventos);
ResultSet resultSet = stmt.executeQuery();

while (resultSet.next()) {
metaId.add(resultSet.getInt("id_meta"));
}
return metaId;
} catch (SQLException e) {
return new ArrayList<Integer>();
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Método de pesquisar já existe

@Joao-Pedro-P-Holanda Joao-Pedro-P-Holanda merged commit c30f203 into development Dec 6, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants