First of all, you must determine the relationship between tables; One-to-many, many-to-one or many-to-many. Employee employee table Department department table Then the entity can be created like this: Class Employee { private String id; private String name; private List< ;Department> depts; }
Class Department { private String id; private String post; private List<Employee> employee; } This is the most standard way of writing, If the diagram is simple, you can write all the fields involved into a class; The next step depends on the SQL statement you write. Are you using mybaits or Hibernate or something else.
First of all, you must determine the relationship between tables;
One-to-many, many-to-one or many-to-many.
Employee employee table Department department table
Then the entity can be created like this:
Class Employee {
private String id;
private String name;
private List< ;Department> depts;
}
Class Department {
private String id;
private String post;
private List<Employee> employee;
}
This is the most standard way of writing, If the diagram is simple, you can write all the fields involved into a class;
The next step depends on the SQL statement you write. Are you using mybaits or Hibernate or something else.