以下是Company 和 Employee 的两个实体,想要实现之间的增删改查,有看技术文档,但是还是不太明白如何去操作
@Table("t_company")
public class Company implements IEntity<Long> {
@Id(auto = false)
private Long id;
@Name
private String name;
@Column
private String remark;
@Many(target = Employee.class, field = "companyId")
private List<Employee> employees;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<Employee> getEmployees() {
return employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
}
@Table("t_employee")
public class Employee implements IEntity<Long> {
@Id(auto = false)
private Long id;
@Name
private String name;
@Column
private String remark;
@Column("comid")
private int companyId;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public int getCompanyId() {
return companyId;
}
public void setCompanyId(int companyId) {
this.companyId = companyId;
}
}