Cet article est un article miroir de traduction automatique, veuillez cliquer ici pour accéder à l’article original.

Vue: 13586|Répondre: 2

[JavaSE] Système de gestion de l’information étudiante écrit par JAVA

[Copié le lien]
Publié sur 20/11/2014 20:43:50 | |Parcourez dans l’ordre |
Ce post a été modifié pour la dernière fois par Delver_Si le 20-11-2014 à 21:21

[mw_shl_code=sql,true]use master
Vas-y
if existe(sélectionnez * dans sys.databases où nom = « école »)
        École de base de données de drop
Vas-y
Créer une école de base de données
Vas-y
Utiliser l’école
Vas-y
Créer un élève de table
(
        stu_id varchar(10) ,-- la clé primaire
        stu_name varchar(20) non null,-- nom
        stu_addr Varchar (100) ,-- adresse
        stu_spec Varchar (50 ans) ,-- professionnel
        stu_dorm Varchar (50 ans) — Dortoir
)
Vas-y
insérer dans les valeurs étudiantes ('100001', 'Zhang San', 'Wuhan Xu Dong', 'Ingénierie de l’information', '101')
insérer dans les valeurs étudiantes ('100002', 'Li Si', 'Wuhan Xu Dong', 'Ingénierie de l’information', '102')

sélectionner * depuis l’étudiant

--supprimer de l’étudiant où stu_id = '100001'

--mise à jour de l’ensemble étudiant stu_name = 'Li Si', stu_addr = 'Zhang San', stu_spec= 'Test logiciel', stu_dorm = '1001' où stu_id = '100001'[/mw_shl_code]

[mw_shl_code=java,true]package online.school.test ;

import java.util.ArrayList ;
importer java.util.List ; importer online.école.domaine.Étudiant ;
importez en ligne.école.service.ÉtudiantService ;

classe publique StudentTest {

        public static void main(String[] args) {
                nouveau StudentTest().getAllStudent() ;
        }
        public int addStudent() {
                Étudiant étudiant = nouvel étudiant (« 3 », « Wang Wu », « Xiaogan », « Test logiciel », « 103 ») ;
                retourner nouveau StudentService().addÉtudiant(étudiant) ;
        }

        public int delStudent() {
                String stuId="3 » ;
                retour nouveau StudentService().delStudent(stuId) ;
        }

        public void findStudent() {
                String stuId="3 » ;
                Étudiant étudiant =nouveau StudentService().findÉtudiant(stuId) ;
                System.out.println(student.toString()) ;
        }

        public List<Student> getAllStudent() {
                ArrayList al = (ArrayList) new StudentService().getAllStudent() ;
                for(int i = 0 ; i<al.size() ; i++){
                        Object[] obj =(Objet[]) al.get(i) ;
                        for(int j=0 ; j<5 ; j++){
                                System.out.print(obj[j] + " « ) ;
                        }
                        System.out.println() ;
                }
                Retour au Al ;
        }

        public int updateStudent() {

                Étudiant étudiant = nouvel étudiant (« 3 », « Wang Wu », « Yingcheng », « Génie civil », « 103 ») ;
                nouveau StudentService().updateStudent(student) ;
                retour 0 ;
               
        }
}
[/mw_shl_code]

[mw_shl_code=java,true]package online.school.domain ;

classe publique Étudiant {
        
        le soldat String stu_id ; Nombre
        soldat String stu_name ; Nom
        soldat String stu_addr ; - Adresse
        soldat String stu_spec ; Carrière professionnelle
        le soldat String stu_dorm ; Dortoir
        Public String getStu_id() {
                retour stu_id ;
        }
        public void setStu_id(String stuId) {
                stu_id = stuId ;
        }
        Public String getStu_name() {
                retour stu_name ;
        }
        public void setStu_name(String stuName) {
                stu_name = stuNom ;
        }
        Public String getStu_addr() {
                retour stu_addr ;
        }
        public void setStu_addr(String stuAddr) {
                stu_addr = stuAddr ;
        }
        Public String getStu_spec() {
                retour stu_spec ;
        }
        public void setStu_spec(String stuSpec) {
                stu_spec = stuSpec ;
        }
        public String getStu_dorm() {
                retour stu_dorm ;
        }
        public void setStu_dorm(String stuDorm) {
                stu_dorm = stuDorm ;
        }
        
        
        
        public Student() {
                super() ;
        }
        public Student (String stuId, String stuName, String stuAddr,
                        String stuSpec, String stuDorm) {
                super() ;
                stu_id = stuId ;
                stu_name = stuNom ;
                stu_addr = stuAddr ;
                stu_spec = stuSpec ;
                stu_dorm = stuDorm ;
        }
        @Override
        public String toString() {
                retourner « Étudiant [stu_addr= » + stu_addr + », stu_dorm= » + stu_dorm
                                + « , stu_id= » + stu_id + « , stu_name= » + stu_name
                                + « , stu_spec= » + stu_spec + « ] » ;
        }
        
        
        

}
[/mw_shl_code]
[mw_shl_code=java,true]package online.school.service ;

importer java.util.List ;

importation en ligne.school.dao.StudentDao ;
importer online.école.domaine.Étudiant ;
importer online.school.utils.SqlHelp ;

public class StudentService implémente IStudentService{

        @Override
        public int addStudent(Student étudiant) {
               
                String sql = « insérer dans les valeurs de l’étudiant(?,?,?,?,?) » ;
                revenir nouveau StudentDao().addStudent(sql,student.getStu_id(),student.getStu_name(),student.getStu_addr(),student.getStu_spec(),student.getStu_dorm()) ;
        }

        @Override
        public int delStudent(String stuId) {
                String sql = « supprimer de l’étudiant où stu_id = ? » ;
                return new StudentDao().delStudent(sql, stuId) ;
        }

        @Override
        public Student findStudent(String stuId) {
                String sql = « sélectionner * de l’étudiant où stu_id = ? » ;
                return new StudentDao().findStudent(sql, stuId) ;
        }

        @Override
        public List<Student> getAllStudent() {
                String sql = « sélectionner * parmi l’étudiant » ;
                return new StudentDao().getAllStudent(sql) ;
        }

        @Override
        public int updateStudent(Student étudiant) {
                String sql = « mettre à jour l’ensemble étudiant stu_name = ?,stu_addr = ?, stu_spec= ?,stu_dorm = ? où stu_id = ? » ;
                return new StudentDao().updateStudent(sql, student.getStu_name(),student.getStu_addr(),student.getStu_spec(),student.getStu_dorm(),student.getStu_id()) ;
               
        }

        

        
}
[/mw_shl_code] [mw_shl_code=java,true]package online.school.dao ;

import java.util.ArrayList ;
importer java.util.List ;
importer online.école.domaine.Étudiant ;
importer online.school.utils.SqlHelp ;

la classe publique StudentDao implémente IStudentDao{

        @Override
        public int addStudent(String sql, String... args) {
                return new SqlHelp().executeUpdate(sql,args) ;
               
        }

        @Override
        public int delStudent (String sql, String... args) {
                return new SqlHelp().executeUpdate(sql,args) ;
        }

        @Override
        public Étudiant findÉtudiant(String sql, String... args) {
                ArrayList al = new SqlHelp().executeQuery(sql, args) ;
                        Object[] obj =(Objet[]) al.get(0) ;
                        Étudiant étudiant = nouvel étudiant() ;
                        student.setStu_id((Corde) obj[0]) ;
                        student.setStu_name((Corde) obj[1]) ;
                        student.setStu_addr((Corde) obj[2]) ;
                        student.setStu_spec((Corde) obj[3]) ;
                        student.setStu_dorm((Corde) obj[4]) ;
                        élève de retour ;
               
        }

        @Override
        public List<Student> getAllStudent(String sql) {

                ArrayList al = new SqlHelp().executeQuery(sql) ;
                Retour au Al ;
        }

        @Override
        mise à jour int publique Étudiant(String sql, String... args) {
               
                return new SqlHelp().executeUpdate(sql, args) ;
               
        }

        
        
}
[/mw_shl_code]

stuManager.rar

507,45 Ko, Temps de téléchargement : 0, Crédits de téléchargement : -1 prestige, -1 contribution

Prix de vente :2 Mo [Enregistrement]  [achat]





Précédent:Récemment, je réalise un projet en librairie en ligne, une fonction d’inscription qui a eu lieu ces derniers jours
Prochain:Version C# du système de gestion des élèves
 Propriétaire| Publié sur 20/11/2014 21:20:55 |
admin publié le 20-11-2014 à 21:13
Il est recommandé au propriétaire de vendre le code source de la pièce jointe pour 2 dollars

:victoire :
Publié sur 20/11/2014 21:13:20 |
Il est recommandé au propriétaire de vendre le code source de la pièce jointe pour 2 dollars
Démenti:
Tous les logiciels, supports de programmation ou articles publiés par Code Farmer Network sont uniquement destinés à l’apprentissage et à la recherche ; Le contenu ci-dessus ne doit pas être utilisé à des fins commerciales ou illégales, sinon les utilisateurs assumeront toutes les conséquences. Les informations sur ce site proviennent d’Internet, et les litiges de droits d’auteur n’ont rien à voir avec ce site. Vous devez supprimer complètement le contenu ci-dessus de votre ordinateur dans les 24 heures suivant le téléchargement. Si vous aimez le programme, merci de soutenir un logiciel authentique, d’acheter l’immatriculation et d’obtenir de meilleurs services authentiques. En cas d’infraction, veuillez nous contacter par e-mail.

Mail To:help@itsvse.com