Mybatis多对多关系

用户和职位

1、用户

package com.qf.meeting.pojo;
import java.io.Serializable;
import java.util.Set;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

public class User implements Serializable{
	private final static Logger LOG = LogManager.getLogger(User.class);
	private Integer userId;
	private String userLoginName;
	private String userTel;
	private String userPwd;
	private String photo;
	private String userName;
	private Delegation delegation;
	private Set staffs;
	public User() {
		super();
	}
	
	@Override
	public String toString() {
		return "User [userId=" + userId + ", userLoginName=" + userLoginName + ", userTel=" + userTel + ", userPwd="
				+ userPwd + ", photo=" + photo + ", userName=" + userName + ", delegation=" + delegation + ", staffs="
				+ staffs + "]";
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public String getUserLoginName() {
		return userLoginName;
	}
	public void setUserLoginName(String userLoginName) {
		this.userLoginName = userLoginName;
	}
	public String getUserTel() {
		return userTel;
	}
	public void setUserTel(String userTel) {
		this.userTel = userTel;
	}
	public String getUserPwd() {
		return userPwd;
	}
	public void setUserPwd(String userPwd) {
		this.userPwd = userPwd;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public Delegation getDelegation() {
		return delegation;
	}
	public void setDelegation(Delegation delegation) {
		this.delegation = delegation;
	}
	public Set getStaffs() {
		return staffs;
	}
	public void setStaffs(Set staffs) {
		this.staffs = staffs;
	}
	
	public User(Integer userId, String userLoginName, String userTel, String userPwd, String photo, String userName,
			Delegation delegation, Set staffs) {
		super();
		this.userId = userId;
		this.userLoginName = userLoginName;
		this.userTel = userTel;
		this.userPwd = userPwd;
		this.photo = photo;
		this.userName = userName;
		this.delegation = delegation;
		this.staffs = staffs;
	}
}

2、职位

package com.qf.meeting.pojo;
import java.io.Serializable;
import java.util.Set;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
public class Staff implements Serializable{
	private final static Logger LOG = LogManager.getLogger(Staff.class);

	private Integer staffId;
	private String staffName;
	private Set user;
	public Staff() {
		super();
	}
	public Staff(Integer staffId, String staffName, Set user) {
		super();
		this.staffId = staffId;
		this.staffName = staffName;
		this.user = user;
	}
	@Override
	public String toString() {
		return "Staff [staffId=" + staffId + ", staffName=" + staffName + ", user=" + user + "]";
	}
	public Integer getStaffId() {
		return staffId;
	}
	public void setStaffId(Integer staffId) {
		this.staffId = staffId;
	}
	public String getStaffName() {
		return staffName;
	}
	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}
	public Set getUser() {
		return user;
	}
	public void setUser(Set user) {
		this.user = user;
	}
	
}

3、xml文件




	
		
		
		
		
		
		
		
			
			
		
	

	

 

你可能感兴趣的:(Mybatis)