diff --git a/testJDBC/JDBCDemo2/JDBCDemo2.iml b/testJDBC/JDBCDemo2/JDBCDemo2.iml new file mode 100644 index 0000000..d6d5fab --- /dev/null +++ b/testJDBC/JDBCDemo2/JDBCDemo2.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/testJDBC/JDBCDemo2/lib/mysql-connector-java-8.0.11.jar b/testJDBC/JDBCDemo2/lib/mysql-connector-java-8.0.11.jar new file mode 100644 index 0000000..c3b5f70 Binary files /dev/null and b/testJDBC/JDBCDemo2/lib/mysql-connector-java-8.0.11.jar differ diff --git a/testJDBC/JDBCDemo2/src/com/msb/bean/Dept.java b/testJDBC/JDBCDemo2/src/com/msb/bean/Dept.java new file mode 100644 index 0000000..5145fb9 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/bean/Dept.java @@ -0,0 +1,51 @@ +package com.msb.bean; + +import java.io.Serializable; + +public class Dept implements Serializable { + private Integer deptno; + private String dname; + private String loc; + + public Dept() { + } + + public Dept(Integer deptno, String dname, String loc) { + this.deptno = deptno; + this.dname = dname; + this.loc = loc; + } + + @Override + public String toString() { + return "Dept{" + + "deptno=" + deptno + + ", dname='" + dname + '\'' + + ", loc='" + loc + '\'' + + '}'; + } + + public Integer getDeptno() { + return deptno; + } + + public void setDeptno(Integer deptno) { + this.deptno = deptno; + } + + public String getDname() { + return dname; + } + + public void setDname(String dname) { + this.dname = dname; + } + + public String getLoc() { + return loc; + } + + public void setLoc(String loc) { + this.loc = loc; + } +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/bean/Emp.java b/testJDBC/JDBCDemo2/src/com/msb/bean/Emp.java new file mode 100644 index 0000000..d9e80cd --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/bean/Emp.java @@ -0,0 +1,107 @@ +package com.msb.bean; + +import java.io.Serializable; +import java.util.Date; + +public class Emp implements Serializable { + private Integer empno; + private String ename; + private String job; + private Integer mgr; + private Date hiredate; + private Double sal; + private Double comm; + private Integer deptno; + + public Emp() { + } + + public Emp(Integer empno, String ename, String job, Integer mgr, Date hiredate, Double sal, Double comm, Integer deptno) { + this.empno = empno; + this.ename = ename; + this.job = job; + this.mgr = mgr; + this.hiredate = hiredate; + this.sal = sal; + this.comm = comm; + this.deptno = deptno; + } + + @Override + public String toString() { + return "Emp{" + + "empno=" + empno + + ", ename='" + ename + '\'' + + ", job='" + job + '\'' + + ", mgr=" + mgr + + ", hiredate=" + hiredate + + ", sal=" + sal + + ", comm=" + comm + + ", deptno=" + deptno + + '}'; + } + + public Integer getEmpno() { + return empno; + } + + public void setEmpno(Integer empno) { + this.empno = empno; + } + + public String getEname() { + return ename; + } + + public void setEname(String ename) { + this.ename = ename; + } + + public String getJob() { + return job; + } + + public void setJob(String job) { + this.job = job; + } + + public Integer getMgr() { + return mgr; + } + + public void setMgr(Integer mgr) { + this.mgr = mgr; + } + + public Date getHiredate() { + return hiredate; + } + + public void setHiredate(Date hiredate) { + this.hiredate = hiredate; + } + + public Double getSal() { + return sal; + } + + public void setSal(Double sal) { + this.sal = sal; + } + + public Double getComm() { + return comm; + } + + public void setComm(Double comm) { + this.comm = comm; + } + + public Integer getDeptno() { + return deptno; + } + + public void setDeptno(Integer deptno) { + this.deptno = deptno; + } +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/dao/DeptDao.java b/testJDBC/JDBCDemo2/src/com/msb/dao/DeptDao.java new file mode 100644 index 0000000..908ea67 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/dao/DeptDao.java @@ -0,0 +1,10 @@ +package com.msb.dao; + +import com.msb.bean.Dept; + +import java.util.List; + +public interface DeptDao { + public List findAll(); + public int addDept(Dept dept); +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/dao/EmpDao.java b/testJDBC/JDBCDemo2/src/com/msb/dao/EmpDao.java new file mode 100644 index 0000000..584a392 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/dao/EmpDao.java @@ -0,0 +1,12 @@ +package com.msb.dao; + +import com.msb.bean.Emp; + +import java.util.List; + +public interface EmpDao { + public List findAll(); + public int deleteByEmpno(int empno); + public int updateEmp(Emp emp); + public int addEmp(Emp emp); +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/dao/imp/DeptDaoImp.java b/testJDBC/JDBCDemo2/src/com/msb/dao/imp/DeptDaoImp.java new file mode 100644 index 0000000..e0e7293 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/dao/imp/DeptDaoImp.java @@ -0,0 +1,18 @@ +package com.msb.dao.imp; + +import com.msb.bean.Dept; +import com.msb.dao.DeptDao; + +import java.util.List; + +public class DeptDaoImp implements DeptDao { + @Override + public List findAll() { + return null; + } + + @Override + public int addDept(Dept dept) { + return 0; + } +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/dao/imp/EmpDaoImp.java b/testJDBC/JDBCDemo2/src/com/msb/dao/imp/EmpDaoImp.java new file mode 100644 index 0000000..a2f7d90 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/dao/imp/EmpDaoImp.java @@ -0,0 +1,28 @@ +package com.msb.dao.imp; + +import com.msb.bean.Emp; +import com.msb.dao.EmpDao; + +import java.util.List; + +public class EmpDaoImp implements EmpDao { + @Override + public List findAll() { + return null; + } + + @Override + public int deleteByEmpno(int empno) { + return 0; + } + + @Override + public int updateEmp(Emp emp) { + return 0; + } + + @Override + public int addEmp(Emp emp) { + return 0; + } +} diff --git a/testJDBC/JDBCDemo2/src/com/msb/view/EmpManageSystem.java b/testJDBC/JDBCDemo2/src/com/msb/view/EmpManageSystem.java new file mode 100644 index 0000000..9dc93f9 --- /dev/null +++ b/testJDBC/JDBCDemo2/src/com/msb/view/EmpManageSystem.java @@ -0,0 +1,7 @@ +package com.msb.view; + +public class EmpManageSystem { + public static void main(String[] args) { + + } +}