Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
S4.A02.1-H-Adrien.fryson-Othemane.khachnane
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Othemane Khachnane
S4.A02.1-H-Adrien.fryson-Othemane.khachnane
Commits
aad747ce
Commit
aad747ce
authored
3 months ago
by
Adrien
Browse files
Options
Downloads
Patches
Plain Diff
nettoyage + fix bugs
parent
b779288c
No related branches found
No related tags found
No related merge requests found
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sae/WEB-INF/vue/list.jsp
+0
-40
0 additions, 40 deletions
sae/WEB-INF/vue/list.jsp
sae/WEB-INF/vue/view.jsp
+0
-38
0 additions, 38 deletions
sae/WEB-INF/vue/view.jsp
script.sql
+78
-64
78 additions, 64 deletions
script.sql
with
78 additions
and
142 deletions
sae/WEB-INF/vue/list.jsp
deleted
100644 → 0
+
0
−
40
View file @
b779288c
<%@ page
import=
"java.util.List"
%>
<%@ page
import=
"modele.PartieDAO"
%>
<%@ page
import=
"modele.Partie"
%>
<!DOCTYPE html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Lister les parties
</title>
</head>
<body>
<%
PartieDAO
pdao
=
new
PartieDAO
();
List
<
Partie
>
parties
=
pdao
.
findAll
();
%>
<h1>
Liste des parties
</h1>
<table>
<tr>
<th>
pno
</th>
<th>
jno1
</th>
<th>
jno2
</th>
<th>
Date
</th>
<th>
Statut
</th>
<th>
Temps
</th>
<th>
Gagnant
</th>
</tr>
<%
for
(
Partie
p
:
parties
)
{
%>
<tr>
<td><%=
p
.
getPno
()
%></td>
<td><%=
p
.
getJno1
()
%></td>
<td><%=
p
.
getJno2
()
%></td>
<td><%=
p
.
getDate
()
%></td>
<td><%=
p
.
getStatut
()
%></td>
<td><%=
p
.
getTemps
()
%></td>
<td><%=
p
.
getGagnant
()
%></td>
</tr>
<%
}
%>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sae/WEB-INF/vue/view.jsp
deleted
100644 → 0
+
0
−
38
View file @
b779288c
<%@ page
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%>
<%@ page
import=
"modele.Partie"
%>
<!DOCTYPE html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Voir
</title>
</head>
<body>
<%
int
pno
=
Integer
.
parseInt
(
request
.
getParameter
(
"pno"
));
Partie
partie
=
(
Partie
)
request
.
getAttribute
(
"partie"
);
%>
<h1>
Données de la partie
<%=
pno
%></h1>
<table>
<tr>
<th>
pno
</th>
<th>
jno1
</th>
<th>
jno2
</th>
<th>
Date
</th>
<th>
Statut
</th>
<th>
Temps
</th>
<th>
Gagnant
</th>
</tr>
<tr>
<td><%=
partie
.
getPno
()
%></td>
<td><%=
partie
.
getJno1
()
%></td>
<td><%=
partie
.
getJno2
()
%></td>
<td><%=
partie
.
getDate
()
%></td>
<td><%=
partie
.
getStatut
()
%></td>
<td><%=
partie
.
getTemps
()
%></td>
<td><%=
partie
.
getGagnant
()
%></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
script.sql
+
78
−
64
View file @
aad747ce
...
...
@@ -4,110 +4,124 @@ DROP TABLE IF EXISTS FilDeDiscussion;
DROP
TABLE
IF
EXISTS
Utilisateur
;
CREATE
TABLE
Utilisateur
(
id
SERIAL
PRIMARY
KEY
,
nom
VARCHAR
(
100
)
NOT
NULL
,
email
VARCHAR
(
100
)
UNIQUE
NOT
NULL
,
mot_de_passe
VARCHAR
(
255
)
NOT
NULL
,
date_inscription
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
nom
VARCHAR
(
100
)
NOT
NULL
,
motDePasse
VARCHAR
(
255
)
NOT
NULL
,
dateInscription
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
pk_utilisateur
PRIMARY
KEY
(
email
)
);
CREATE
TABLE
FilDeDiscussion
(
id
SERIAL
PRIMARY
KEY
,
id
SERIAL
,
nom
VARCHAR
(
100
)
NOT
NULL
,
date_creation
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
createur_id
INTEGER
,
CONSTRAINT
fk_createur
FOREIGN
KEY
(
createur_id
)
REFERENCES
Utilisateur
(
id
)
dateCreation
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
createurEmail
VARCHAR
(
100
),
CONSTRAINT
pk_fil
PRIMARY
KEY
(
id
),
CONSTRAINT
fk_createur
FOREIGN
KEY
(
createurEmail
)
REFERENCES
Utilisateur
(
email
)
ON
DELETE
SET
NULL
);
CREATE
TABLE
Message
(
id
SERIAL
PRIMARY
KEY
,
id
SERIAL
,
contenu
TEXT
NOT
NULL
,
date_publication
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
fil_id
INTEGER
,
auteur_id
INTEGER
,
CONSTRAINT
fk_fil
FOREIGN
KEY
(
fil_id
)
REFERENCES
FilDeDiscussion
(
id
)
datePublication
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
filId
INTEGER
,
auteurEmail
VARCHAR
(
100
),
CONSTRAINT
pk_message
PRIMARY
KEY
(
id
),
CONSTRAINT
fk_fil
FOREIGN
KEY
(
filId
)
REFERENCES
FilDeDiscussion
(
id
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_auteur
FOREIGN
KEY
(
auteur
_id
)
REFERENCES
Utilisateur
(
id
)
CONSTRAINT
fk_auteur
FOREIGN
KEY
(
auteur
Email
)
REFERENCES
Utilisateur
(
email
)
ON
DELETE
SET
NULL
);
CREATE
TABLE
Abonnement
(
utilisateur
_id
INTEGER
,
fil
_i
d
INTEGER
,
date
_a
bonnement
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
pk_abonnement
PRIMARY
KEY
(
utilisateur
_id
,
fil
_i
d
),
CONSTRAINT
fk_utilisateur
FOREIGN
KEY
(
utilisateur
_id
)
REFERENCES
Utilisateur
(
id
)
utilisateur
Email
VARCHAR
(
100
)
,
fil
I
d
INTEGER
,
date
A
bonnement
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
,
CONSTRAINT
pk_abonnement
PRIMARY
KEY
(
utilisateur
Email
,
fil
I
d
),
CONSTRAINT
fk_utilisateur
FOREIGN
KEY
(
utilisateur
Email
)
REFERENCES
Utilisateur
(
email
)
ON
DELETE
CASCADE
,
CONSTRAINT
fk_fil
FOREIGN
KEY
(
fil
_i
d
)
REFERENCES
FilDeDiscussion
(
id
)
CONSTRAINT
fk_fil
FOREIGN
KEY
(
fil
I
d
)
REFERENCES
FilDeDiscussion
(
id
)
ON
DELETE
CASCADE
);
INSERT
INTO
Utilisateur
(
nom
,
email
,
mot_de_passe
)
VALUES
(
'Alice'
,
'alice@example.com'
,
MD5
(
'password1'
)),
(
'Bob'
,
'bob@example.com'
,
MD5
(
'password2'
)),
(
'Charlie'
,
'charlie@example.com'
,
MD5
(
'password3'
));
INSERT
INTO
Utilisateur
(
email
,
nom
,
motDePasse
)
VALUES
(
'utilisateur1@exemple.com'
,
'Utilisateur 1'
,
MD5
(
'motdepasse123'
));
INSERT
INTO
FilDeDiscussion
(
nom
,
createur_id
)
VALUES
(
'Discussion Générale'
,
1
),
(
'Projet Informatique'
,
2
);
INSERT
INTO
FilDeDiscussion
(
nom
,
createurEmail
)
VALUES
(
'Discussion Générale'
,
'utilisateur1@exemple.com'
);
INSERT
INTO
Message
(
contenu
,
fil_id
,
auteur_id
)
VALUES
(
'Bonjour tout le monde !'
,
1
,
1
),
(
'Salut, quelqu
''
un peut m
''
aider avec ce projet ?'
,
2
,
2
);
INSERT
INTO
Message
(
contenu
,
filId
,
auteurEmail
)
VALUES
(
'Bonjour, ceci est mon premier message !'
,
1
,
'utilisateur1@exemple.com'
);
INSERT
INTO
Abonnement
(
utilisateur_id
,
fil_id
)
VALUES
(
1
,
1
),
(
2
,
1
),
(
3
,
2
);
INSERT
INTO
Abonnement
(
utilisateurEmail
,
filId
)
VALUES
(
'utilisateur1@exemple.com'
,
1
);
-- Lister tous les utilisateurs
-- Lister tous les utilisateurs
:
-- SELECT * FROM Utilisateur;
-- Lister tous les fils de discussion
créés par un utilis
ateur
donné
-- Lister tous les fils de discussion
avec le nom du cré
ateur
:
-- SELECT * FROM FilDeDiscussion WHERE createur_id = 1;
-- SELECT f.id, f.nom, u.nom AS nomCreateur
-- FROM FilDeDiscussion f
-- JOIN Utilisateur u ON f.createurEmail = u.email;
-- Lister tous les messages d'un fil de discussion
donné
-- Lister tous les messages d'un fil de discussion
spécifique avec le nom de l'auteur :
-- SELECT * FROM Message WHERE fil_id = 1 ORDER BY date_publication;
-- SELECT m.contenu, u.nom AS nomAuteur, m.datePublication
-- FROM Message m
-- JOIN Utilisateur u ON m.auteurEmail = u.email
-- WHERE m.filId = 1
-- ORDER BY m.datePublication;
-- Lister tous les abonn
é
s d'un
fil de discussion donné
-- Lister tous les abonn
ement
s d'un
utilisateur spécifique :
-- SELECT u.* FROM Utilisateur u
-- JOIN Abonnement a ON u.id = a.utilisateur_id
-- WHERE a.fil_id = 1;
-- SELECT f.nom AS nomFil, a.dateAbonnement
-- FROM Abonnement a
-- JOIN FilDeDiscussion f ON a.filId = f.id
-- WHERE a.utilisateurEmail = 'utilisateur1@exemple.com';
-- Lister
tous
les fils de discussion auxquels un utilisateur est abonné
-- Lister les fils de discussion auxquels un utilisateur
n'
est
pas
abonné
:
-- SELECT f.* FROM FilDeDiscussion f
-- JOIN Abonnement a ON f.id = a.fil_id
-- WHERE a.utilisateur_id = 1;
-- SELECT f.id, f.nom
-- FROM FilDeDiscussion f
-- LEFT JOIN Abonnement a ON f.id = a.filId AND a.utilisateurEmail = 'utilisateur1@exemple.com'
-- WHERE a.utilisateurEmail IS NULL;
--
Lis
ter le
s 5 derniers messages postés dans tous les
fil
s
de discussion
--
Comp
ter le
nombre de messages par
fil de discussion
:
-- SELECT * FROM Message ORDER BY date_publication DESC LIMIT 5;
-- SELECT f.nom AS nomFil, COUNT(m.id) AS nombreMessages
-- FROM FilDeDiscussion f
-- LEFT JOIN Message m ON f.id = m.filId
-- GROUP BY f.nom;
--
List
er les
fils de discussion avec le nombre
de messages
--
Trouv
er les
utilisateurs qui ont publié
de
s
messages
dans un fil spécifique :
-- SELECT
f.id, f.nom, COUNT(m.id) AS nombre_messages
-- FROM
FilDeDiscussion f
--
LEFT
JOIN Message m ON
f.id = m.fil_id
--
GROUP BY f.id, f.nom
;
-- SELECT
DISTINCT u.nom, u.email
-- FROM
Utilisateur u
-- JOIN Message m ON
u.email = m.auteurEmail
--
WHERE m.filId = 1
;
-- Lister les
utilisateurs qui ne sont abonnés à auc
un fil de discussion
-- Lister les
5 derniers messages publiés dans
un fil de discussion
:
-- SELECT u.* FROM Utilisateur u
-- LEFT JOIN Abonnement a ON u.id = a.utilisateur_id
-- WHERE a.fil_id IS NULL;
-- SELECT m.contenu, u.nom AS nomAuteur, m.datePublication
-- FROM Message m
-- JOIN Utilisateur u ON m.auteurEmail = u.email
-- WHERE m.filId = 1
-- ORDER BY m.datePublication DESC
-- LIMIT 5;
--
Lis
ter le
s
fil
s
de discussion
sans messages
--
Comp
ter le
nombre d'abonnés par
fil de discussion
:
-- SELECT f.* FROM FilDeDiscussion f
-- LEFT JOIN Message m ON f.id = m.fil_id
-- WHERE m.id IS NULL;
-- SELECT f.nom AS nomFil, COUNT(a.utilisateurEmail) AS nombreAbonnes
-- FROM FilDeDiscussion f
-- LEFT JOIN Abonnement a ON f.id = a.filId
-- GROUP BY f.nom;
-- Lister les
messages postés par un utilisateur donné
-- Lister les
utilisateurs qui ne sont abonnés à aucun fil de discussion :
-- SELECT * FROM Message WHERE auteur_id = 1 ORDER BY date_publication;
\ No newline at end of file
-- SELECT u.email, u.nom
-- FROM Utilisateur u
-- LEFT JOIN Abonnement a ON u.email = a.utilisateurEmail
-- WHERE a.utilisateurEmail IS NULL;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment