📄 userservice.java
字号:
package com.netctoss.liping.userManage;
import java.sql.Date;
import javax.persistence.*;
import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
import com.netctoss.liping.pricing.Pricing;
/**
* 用户管理模块 采用的是hibernateAnnotation的方式映射数据
* UserService实体类的设计
* lab_login_name和user_id_fk是联合唯一的
* lab_login_name和pricing_id_fk是联合唯一的
* 1 map 的查询 1>updatePassByUserServiceById 2>findUserServiceById
* 2 不能自己更新的属性 除lab_login_password
* 3 不能为空的属性 全部
* 4 延迟加载的属性 enroll_date,close_date ,关联的对象user
* 5 不需要生成insert的属性 :enroll_date,close_date
*/
@Entity
@Table( name="userservice_liping" ,uniqueConstraints={
@UniqueConstraint(columnNames={"lab_login_name","user_id_fk"}),
@UniqueConstraint(columnNames={"lab_login_name","pricing_id_fk"})})
@NamedQueries( value = {
@NamedQuery(name = "findUserServiceById", query = "from UserService us left join fetch us.user left join fetch us.pricing where us.id = ?"),
})
public class UserService {
@Id
@GeneratedValue( strategy = GenerationType.AUTO)
@Column( name="userservice_id" ,nullable=false, updatable=false)
private Long id;
@Column(updatable=false,nullable=false)
private String lab_login_name;
private String lab_login_password;
@Column(updatable=false,nullable=false)
private String lab_ip;
@Column(updatable=false,nullable=false)
private String user_status;
@Basic( fetch = FetchType.LAZY )
@Column(updatable=false,insertable=false)
private Date enroll_date;
@Basic( fetch = FetchType.LAZY )
@Column(updatable=false,insertable=false)
private Date close_date;
@ManyToOne( fetch=FetchType.LAZY,targetEntity=com.netctoss.liping.userManage.User.class)
@JoinColumn( name="user_id_fk", nullable=false,updatable=false)
private User user = new User();
@ManyToOne( fetch=FetchType.EAGER,targetEntity=com.netctoss.liping.pricing.Pricing.class)
@JoinColumn( name="pricing_id_fk", nullable=false,updatable=false)
private Pricing pricing = new Pricing();
public UserService() {}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the lab_login_name
*/
public String getLab_login_name() {
return lab_login_name;
}
/**
* @param lab_login_name the lab_login_name to set
*/
public void setLab_login_name(String lab_login_name) {
this.lab_login_name = lab_login_name;
}
/**
* @return the lab_login_password
*/
public String getLab_login_password() {
return lab_login_password;
}
/**
* @param lab_login_password the lab_login_password to set
*/
public void setLab_login_password(String lab_login_password) {
this.lab_login_password = lab_login_password;
}
/**
* @return the lab_ip
*/
public String getLab_ip() {
return lab_ip;
}
/**
* @param lab_ip the lab_ip to set
*/
public void setLab_ip(String lab_ip) {
this.lab_ip = lab_ip;
}
/**
* @return the user_status
*/
public String getUser_status() {
return user_status;
}
/**
* @param user_status the user_status to set
*/
public void setUser_status(String user_status) {
this.user_status = user_status;
}
/**
* @return the enroll_date
*/
public Date getEnroll_date() {
return enroll_date;
}
/**
* @param enroll_date the enroll_date to set
*/
public void setEnroll_date(Date enroll_date) {
this.enroll_date = enroll_date;
}
/**
* @return the close_date
*/
public Date getClose_date() {
return close_date;
}
/**
* @param close_date the close_date to set
*/
public void setClose_date(Date close_date) {
this.close_date = close_date;
}
/**
* @return the user
*/
public User getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(User user) {
this.user = user;
}
/**
* @return the pricing
*/
public Pricing getPricing() {
return pricing;
}
/**
* @param pricing the pricing to set
*/
public void setPricing(Pricing pricing) {
this.pricing = pricing;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -