| 21545 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity;
|
|
|
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
|
|
|
5 |
import javax.persistence.Column;
|
|
|
6 |
import javax.persistence.Entity;
|
|
|
7 |
import javax.persistence.GeneratedValue;
|
|
|
8 |
import javax.persistence.GenerationType;
|
|
|
9 |
import javax.persistence.Id;
|
|
|
10 |
import javax.persistence.NamedQueries;
|
|
|
11 |
import javax.persistence.NamedQuery;
|
|
|
12 |
import javax.persistence.Table;
|
|
|
13 |
import javax.persistence.UniqueConstraint;
|
|
|
14 |
|
|
|
15 |
/**
|
|
|
16 |
* This class basically contains api details
|
|
|
17 |
*
|
|
|
18 |
* @author ashikali
|
|
|
19 |
*
|
|
|
20 |
*/
|
|
|
21 |
@Entity
|
|
|
22 |
@Table(name="user_role", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "role_id"})})
|
|
|
23 |
@NamedQueries({
|
|
|
24 |
@NamedQuery(name="UserRole.selectByUserId", query="select ur from UserRole ur where ur.userId= :userId"),
|
|
|
25 |
@NamedQuery(name="UserRole.deleteByUserAndRoleId", query="delete from UserRole ur where ur.userId= :userId and ur.roleId = :roleId"),
|
|
|
26 |
@NamedQuery(name = "UserRole.selectRolesByUserId", query = "select r.id, r.name, r.type, r.status, r.createTimestamp, r.updateTimestamp, p.type from UserRole ur join Role r on r.id = ur.roleId join Permission p on p.roleId = ur.roleId where ur.userId = :userId")
|
|
|
27 |
})
|
|
|
28 |
public class UserRole implements Serializable{
|
|
|
29 |
|
|
|
30 |
private static final long serialVersionUID = 1L;
|
|
|
31 |
|
|
|
32 |
@Id
|
|
|
33 |
@Column(name="id", unique=true, updatable=false)
|
|
|
34 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
35 |
private int id;
|
|
|
36 |
|
|
|
37 |
public UserRole() {
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
public int getId() {
|
|
|
41 |
return id;
|
|
|
42 |
}
|
|
|
43 |
public void setId(int id) {
|
|
|
44 |
this.id = id;
|
|
|
45 |
}
|
|
|
46 |
@Column(name="user_id", unique=false, updatable=false)
|
|
|
47 |
private int userId;
|
|
|
48 |
|
|
|
49 |
@Column(name="role_id", unique = false)
|
|
|
50 |
private int roleId;
|
|
|
51 |
|
|
|
52 |
public int getUserId() {
|
|
|
53 |
return userId;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
public void setUserId(int userId) {
|
|
|
57 |
this.userId = userId;
|
|
|
58 |
}
|
|
|
59 |
public int getRoleId() {
|
|
|
60 |
return roleId;
|
|
|
61 |
}
|
|
|
62 |
public void setRoleId(int roleId) {
|
|
|
63 |
this.roleId = roleId;
|
|
|
64 |
}
|
| 21602 |
ashik.ali |
65 |
|
|
|
66 |
@Override
|
|
|
67 |
public String toString() {
|
|
|
68 |
return "UserRole [id=" + id + ", userId=" + userId + ", roleId=" + roleId + "]";
|
|
|
69 |
}
|
| 21545 |
ashik.ali |
70 |
|
| 21602 |
ashik.ali |
71 |
|
|
|
72 |
|
| 21545 |
ashik.ali |
73 |
}
|