编程语言
首页 > 编程语言> > 做个简单的Java学生考勤系统01--实体类的创建与建表

做个简单的Java学生考勤系统01--实体类的创建与建表

作者:互联网

从这篇开始,写个从零开始的简单学生考勤,层级结构本来想着是Service层就够了,再加个Entity实体类就行了。后面再拓宽,前端发送请求,增加Controller层,Dao层保存数据库,这里Dao层选择最原始的JDBC,快捷。主要是博主懒。最后加个Util工具类啥的,该有的都有了。

一、实体类

1、学生实体类(主键id,学号,姓名,性别,班级,登录名,登录密码,是否删除)

package model;

public class Txuesheng {
	private int id;
	private String xuehao;
	private String xingming;
	private String xingbie;
	
	private String nianling;
	private String banji;
	private String loginname;
	private String loginpw;
	private String del;
	
	// getter,setter方法
}

2、签到表(主键id,学生id,课表id,签到时间,引用课表对象,学生对象)

package model;

public class Tqiandao {
	private int id;
	private int xuesheng_id;
	private int kebiao_id;
	private String shijian;
	
	private Tkebiao kebiao;
	private Txuesheng xuesheng;

	// getter,setter方法
	
}

3、课表实体类(主键id,课程id,上课时间,教室,老师id,引用课程对象,老师对象,是否签到)

package model;


public class Tkebiao {
	private int id;
	private int kecheng_id;
	private String shijian;
	
	private String jiaoshi;
	private String laoshi_id;
	
	private Tkecheng kecheng;
	private Tlaoshi laoshi;
	
	private String shifouqiandao;
	// getter,setter方法
	
}

4、课程实体类(主键id,编号,名称,科室,是否删除)

package model;

public class Tkecheng {
	private int id;
	private String bianhao;
	private String mingcheng;
	private String keshi;
	private String del;
	// getter,setter方法
}

5、老师实体类(主键id,编号,姓名,性别,年龄,职称,登录名,登录密码,是否删除)

package model;

public class Tlaoshi {
	private int id;
	private String bianhao;
	private String xingming;
	private String xingbie;
	
	private String nianling;
	private String zhicheng;
	private String loginname;
	private String loginpw;
	private String del;
	// getter,setter方法
}

最后,创建个管理员实体类,管理学生,教室,课表等信息

6、管理员实体类(主键id,登录名,密码)

package model;

public class TAdmin {
	private int userId;
	
	private String userName;

	private String userPw;

	// getter,setter方法

}

实体类创建好了,接下来创建表

二、创建表


CREATE TABLE `t_admin` (
  `userId` int(4) NOT NULL,
  `userName` varchar(50) DEFAULT NULL,
  `userPw` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`userId`)
);



CREATE TABLE `t_kaoqin` (
  `id` int(4) NOT NULL,
  `xuesheng_id` int(4) DEFAULT NULL,
  `kebiao_id` int(4) DEFAULT NULL,
  `shijian` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `t_kebiao` (
  `id` int(4) NOT NULL,
  `kecheng_id` int(4) DEFAULT NULL,
  `shijian` varchar(50) DEFAULT NULL,
  `jiaoshi` varchar(50) DEFAULT NULL,
  `laoshi_id` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `t_kecheng` (
  `id` int(4) NOT NULL AUTO_INCREMENT,
  `bianhao` varchar(50) DEFAULT NULL,
  `mingcheng` varchar(50) DEFAULT NULL,
  `keshi` varchar(50) DEFAULT NULL,
  `del` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
);


CREATE TABLE `t_laoshi` (
  `id` int(4) NOT NULL,
  `bianhao` varchar(50) DEFAULT NULL,
  `xingming` varchar(50) DEFAULT NULL,
  `xingbie` varchar(50) DEFAULT NULL,
  `nianling` varchar(50) DEFAULT NULL,
  `zhicheng` varchar(20) DEFAULT NULL,
  `loginname` varchar(50) DEFAULT NULL,
  `loginpw` varchar(50) DEFAULT NULL,
  `del` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
);


CREATE TABLE `t_qiandao` (
  `id` int(10) NOT NULL,
  `xuesheng_id` int(10) DEFAULT NULL,
  `kebiao_id` int(10) DEFAULT NULL,
  `shijian` varchar(50) DEFAULT NULL,
  `qingjia` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
);


CREATE TABLE `t_xuesheng` (
  `id` int(4) NOT NULL,
  `xuehao` varchar(50) DEFAULT NULL,
  `xingming` varchar(50) DEFAULT NULL,
  `xingbie` varchar(50) DEFAULT NULL,
  `nianling` varchar(50) DEFAULT NULL,
  `banji` varchar(20) DEFAULT NULL,
  `loginname` varchar(20) DEFAULT NULL,
  `loginpw` varchar(20) DEFAULT NULL,
  `del` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

实体类和表已经创建好了,下一篇会讲解功能是怎么实现的

标签:01,Java,String,DEFAULT,private,考勤,varchar,NULL,id
来源: https://blog.csdn.net/exodus3/article/details/121025959