Java实训 学生信息管理系统 第一天

一、创建学生管理系统思维导图
在这里插入图片描述
二、创建student数据库,添加student,user,college,status四张表。
student表:
在这里插入图片描述
user表:
在这里插入图片描述
college表:
在这里插入图片描述
status表:
在这里插入图片描述
三、创建实体类:
1.college实体


package net.syp.student.bean;

import java.util.Date;
/*
类名:college
描述:学校实体
作者:宋云鹏
日期:2019.6.17
 */
public class College {
    private int id;
    private String name;//学校名称
    private String president;//校长
    private Date startTime;//建校时间
    private String telephone;//联系电话
    private String email;//电子邮箱
    private String address;//通讯地址
    private String profile;//学校简历

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPresident() {
        return president;
    }

    public void setPresident(String president) {
        this.president = president;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    @Override
    public String toString() {
        return "College{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", president='" + president + '\'' +
                ", startTime=" + startTime +
                ", telephone='" + telephone + '\'' +
                ", email='" + email + '\'' +
                ", address='" + address + '\'' +
                ", profile='" + profile + '\'' +
                '}';
    }
}

2.status实体


package net.syp.student.bean;
/*
类名:Status
描述:状态实体
作者:宋云鹏
日期:2019.6.17
 */
public class Status {
    private int id;
    private String college;//校名
    private String version;//版本
    private String author;//作者
    private String telephone;//联系电话
    private String address;//通讯地址
    private String email;//电子邮箱
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCollege() {
        return college;
    }

    public void setCollege(String college) {
        this.college = college;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "Status{" +
                "id=" + id +
                ", college='" + college + '\'' +
                ", version='" + version + '\'' +
                ", author='" + author + '\'' +
                ", telephone='" + telephone + '\'' +
                ", address='" + address + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}

3.student实体

package net.syp.student.bean;

/*
类名:student
描述:学生实体
作者:宋云鹏
日期:2019.6.17
 */
public class Student {
    private String id;//学号
    private String name;//姓名
    private String sex;//性别
    private int age;//年龄
    private String department;//系部
    private String clazz;//班级
    private String telephone;//联系电话

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                ", department='" + department + '\'' +
                ", clazz='" + clazz + '\'' +
                ", telephone='" + telephone + '\'' +
                '}';
    }
}

4.user实体

package net.syp.student.bean;
/*
类名:user
描述:用户实体
作者:宋云鹏
日期:2019.6.17
 */


import java.util.Date;

public class User {
    private int id;
    private String username;//用户名
    private String password;//密码
    private String telephone;//联系电话
    private Date registerTime;//注册时间

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", telephone='" + telephone + '\'' +
                ", registerTime=" + registerTime +
                '}';
    }
}

四、创建接口
1.学校数据访问接口CollegeDao

/*
类名:CollegeDao
描述:学校数据访问接口
作者:宋云鹏
时间:2019.3.17
 */
package net.syp.student.dao;

import net.syp.student.bean.College;

public interface CollegeDao {
    College findById(int id);
    int update(College college);
}

2.状态数据访问接口StatusDao

/*
类名:StatusDao
描述:状态数据访问接口
作者:宋云鹏
时间:2019.3.17
 */
package net.syp.student.dao;

import net.syp.student.bean.Status;

public interface StatusDao {
    Status findById(int id);
    int update(Status status);
}

3.学生数据访问接口StudentDao

/*
类名:StudentDao
描述:学生数据访问接口
作者:宋云鹏
时间:2019.3.17
 */
package net.syp.student.dao;


import net.syp.student.bean.Student;

import java.util.List;
import java.util.Vector;

public interface StudentDao {
    int insert(Student student);
    int deleteById(String id);
    int deleteByClass(String clazz);
    int deleteByDepartment(String department);
    int update(Student student);
    Student findById(String id);
    List<Student> findByName(String name);
    List<Student> findByClass(String clazz);
    List<Student> findByDepartment(String department);
    List<Student> findAll();
    Vector findRowsBySex();
    Vector findRowsByClass();
    Vector findRowsByDepartment();
}

4.用户数据访问接口UserDao

/*
类名:UserDao
描述:用户数据访问接口
作者:宋云鹏
日期:2019.6.17
 */
package net.syp.student.dao;
import java.util.List;
import net.syp.student.bean.User;

public interface UserDao {
    int insert(User user);
    int deleteById(int id);
    int update(User user);
    User findById(int id);
    List<User> findAll();
    User login(String username,String password);

}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值