feat: implement educator management and display educator initials on training schedule
This commit is contained in:
@@ -52,6 +52,9 @@ public class CreneauEntrainement {
|
||||
@Transient
|
||||
private Set<String> categoriesEnConflit = new HashSet<>();
|
||||
|
||||
@Transient
|
||||
private String initialesEducateurs = "";
|
||||
|
||||
// Logic for Gantt diagram grid placement
|
||||
|
||||
public int getStartColumn() {
|
||||
@@ -214,4 +217,12 @@ public class CreneauEntrainement {
|
||||
public void setCategoriesEnConflit(Set<String> categoriesEnConflit) {
|
||||
this.categoriesEnConflit = categoriesEnConflit;
|
||||
}
|
||||
|
||||
public String getInitialesEducateurs() {
|
||||
return initialesEducateurs;
|
||||
}
|
||||
|
||||
public void setInitialesEducateurs(String initialesEducateurs) {
|
||||
this.initialesEducateurs = initialesEducateurs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ public class Educateur {
|
||||
@JoinColumn(name = "categorie_id")
|
||||
private Categorie categorie;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "equipe_id")
|
||||
private Equipe equipe;
|
||||
|
||||
// Getters and Setters
|
||||
|
||||
public Long getId() { return id; }
|
||||
@@ -45,4 +49,13 @@ public class Educateur {
|
||||
|
||||
public Categorie getCategorie() { return categorie; }
|
||||
public void setCategorie(Categorie categorie) { this.categorie = categorie; }
|
||||
|
||||
public Equipe getEquipe() { return equipe; }
|
||||
public void setEquipe(Equipe equipe) { this.equipe = equipe; }
|
||||
|
||||
public String getInitiales() {
|
||||
String p = (prenom != null && !prenom.isEmpty()) ? prenom.substring(0, 1).toUpperCase() : "";
|
||||
String n = (nom != null && !nom.isEmpty()) ? nom.substring(0, 1).toUpperCase() : "";
|
||||
return p + n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.astalange.core.repository;
|
||||
|
||||
import com.astalange.core.entity.Educateur;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface EducateurRepository extends JpaRepository<Educateur, Long> {
|
||||
|
||||
@Query("SELECT e FROM Educateur e LEFT JOIN FETCH e.categorie LEFT JOIN FETCH e.equipe")
|
||||
List<Educateur> findAllWithCategorieAndEquipe();
|
||||
}
|
||||
@@ -4,10 +4,16 @@ import com.astalange.core.entity.Equipe;
|
||||
import com.astalange.core.entity.Saison;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface EquipeRepository extends JpaRepository<Equipe, Long> {
|
||||
List<Equipe> findByCategorieId(Long categorieId);
|
||||
|
||||
@Query("SELECT e FROM Equipe e JOIN FETCH e.categorie WHERE e.saison = :saison")
|
||||
List<Equipe> findBySaison(Saison saison);
|
||||
|
||||
@Query("SELECT e FROM Equipe e JOIN FETCH e.categorie")
|
||||
List<Equipe> findAllWithCategorie();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- V13__add_equipe_to_educateur.sql
|
||||
ALTER TABLE educateur ADD COLUMN equipe_id BIGINT;
|
||||
ALTER TABLE educateur ADD CONSTRAINT fk_educateur_equipe FOREIGN KEY (equipe_id) REFERENCES equipe(id) ON DELETE SET NULL;
|
||||
Reference in New Issue
Block a user