fix crud user
This commit is contained in:
parent
00dd061bac
commit
cab86cf8fa
@ -46,7 +46,14 @@ public class JwtTokenUtil implements Serializable {
|
|||||||
claims.put("nama", tokenContent.getNama());
|
claims.put("nama", tokenContent.getNama());
|
||||||
claims.put("username", tokenContent.getUsername());
|
claims.put("username", tokenContent.getUsername());
|
||||||
claims.put("user_id", tokenContent.getUserId());
|
claims.put("user_id", tokenContent.getUserId());
|
||||||
|
claims.put("roleId", tokenContent.getRoleId());
|
||||||
claims.put("role", tokenContent.getRole());
|
claims.put("role", tokenContent.getRole());
|
||||||
|
claims.put("instansiId", tokenContent.getInstansiId());
|
||||||
|
claims.put("instansi", tokenContent.getInstansi());
|
||||||
|
claims.put("bidangId", tokenContent.getBidangId());
|
||||||
|
claims.put("bidang", tokenContent.getBidang());
|
||||||
|
claims.put("jabatanId", tokenContent.getJabatanId());
|
||||||
|
claims.put("jabatan", tokenContent.getJabatan());
|
||||||
|
|
||||||
return doGenerateToken(claims, username, expirationInMs);
|
return doGenerateToken(claims, username, expirationInMs);
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ public class Users extends BaseEntity {
|
|||||||
@Column(name = "bidang_id")
|
@Column(name = "bidang_id")
|
||||||
private Long bidangId;
|
private Long bidangId;
|
||||||
|
|
||||||
@Column(name = "jabatan")
|
@Column(name = "jabatan_id")
|
||||||
private String jabatan;
|
private Long jabatanId;
|
||||||
|
|
||||||
@Column(name = "role_id")
|
@Column(name = "role_id")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
@ -10,6 +10,7 @@ public interface UserRoleView {
|
|||||||
String getInstansi();
|
String getInstansi();
|
||||||
Long getBidangId();
|
Long getBidangId();
|
||||||
String getBidang();
|
String getBidang();
|
||||||
|
Long getJabatanId();
|
||||||
String getJabatan();
|
String getJabatan();
|
||||||
Boolean getIsActive();
|
Boolean getIsActive();
|
||||||
String getPassword();
|
String getPassword();
|
||||||
@ -25,6 +26,7 @@ public interface UserRoleView {
|
|||||||
void setInstansi(String instansi);
|
void setInstansi(String instansi);
|
||||||
void setBidangId(Long bidangId);
|
void setBidangId(Long bidangId);
|
||||||
void setBidang(String bidang);
|
void setBidang(String bidang);
|
||||||
|
void setJabatanId(Long jabatanId);
|
||||||
void setJabatan(String Jabatan);
|
void setJabatan(String Jabatan);
|
||||||
void setIsActive(Boolean isActive);
|
void setIsActive(Boolean isActive);
|
||||||
void setPassword(String password);
|
void setPassword(String password);
|
||||||
|
@ -21,6 +21,7 @@ public class UsersRequest extends BaseRequest {
|
|||||||
private Long bidangId;
|
private Long bidangId;
|
||||||
private String bidang;
|
private String bidang;
|
||||||
private String nama;
|
private String nama;
|
||||||
|
private Long jabatanId;
|
||||||
private String jabatan;
|
private String jabatan;
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
private String role;
|
private String role;
|
||||||
|
@ -14,6 +14,8 @@ public class UsersResponse extends BaseResponse {
|
|||||||
private Long id;
|
private Long id;
|
||||||
private String nama;
|
private String nama;
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
private Long jabatanId;
|
||||||
private String jabatan;
|
private String jabatan;
|
||||||
|
|
||||||
private Long instansiId;
|
private Long instansiId;
|
||||||
|
@ -9,8 +9,15 @@ import java.util.Set;
|
|||||||
@Data
|
@Data
|
||||||
public class TokenContent {
|
public class TokenContent {
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private String role;
|
|
||||||
private Set<String> accessMenu;
|
|
||||||
private String nama;
|
private String nama;
|
||||||
private String username;
|
private String username;
|
||||||
|
private Long roleId;
|
||||||
|
private String role;
|
||||||
|
private Long instansiId;
|
||||||
|
private String instansi;
|
||||||
|
private Long bidangId;
|
||||||
|
private String bidang;
|
||||||
|
private Long jabatanId;
|
||||||
|
private String jabatan;
|
||||||
|
private Set<String> accessMenu;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
@Query("SELECT u.id as id, " +
|
@Query("SELECT u.id as id, " +
|
||||||
"u.nama as nama, " +
|
"u.nama as nama, " +
|
||||||
"u.username as username, " +
|
"u.username as username, " +
|
||||||
"u.jabatan as jabatan, " +
|
"u.jabatanId as jabatanId, " +
|
||||||
|
"j.jabatan as jabatan, " +
|
||||||
"u.roleId as roleId, " +
|
"u.roleId as roleId, " +
|
||||||
"r.role as role, " +
|
"r.role as role, " +
|
||||||
"u.bidangId as bidangId, " +
|
"u.bidangId as bidangId, " +
|
||||||
@ -30,10 +31,11 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
"JOIN Roles r ON r.id = u.roleId " +
|
"JOIN Roles r ON r.id = u.roleId " +
|
||||||
"JOIN Bidang b ON b.id = u.bidangId " +
|
"JOIN Bidang b ON b.id = u.bidangId " +
|
||||||
"JOIN Instansi i ON i.id = u.instansiId " +
|
"JOIN Instansi i ON i.id = u.instansiId " +
|
||||||
|
"JOIN Jabatan j ON j.id = u.jabatanId " +
|
||||||
"Where u.isDelete = false " +
|
"Where u.isDelete = false " +
|
||||||
"AND (:search='' " +
|
"AND (:search='' " +
|
||||||
"or (UPPER(u.nama) like :search " +
|
"or (UPPER(u.nama) like :search " +
|
||||||
" OR UPPER(u.jabatan) like :search " +
|
" OR UPPER(j.jabatan) like :search " +
|
||||||
" OR UPPER(r.role) like :search " +
|
" OR UPPER(r.role) like :search " +
|
||||||
" OR UPPER(b.bidang) like :search " +
|
" OR UPPER(b.bidang) like :search " +
|
||||||
" OR UPPER(i.instansi) like :search " +
|
" OR UPPER(i.instansi) like :search " +
|
||||||
@ -48,7 +50,8 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
"u.nama as nama, " +
|
"u.nama as nama, " +
|
||||||
"u.username as username, " +
|
"u.username as username, " +
|
||||||
"u.password as password, " +
|
"u.password as password, " +
|
||||||
"u.jabatan as jabatan, " +
|
"u.jabatanId as jabatanId, " +
|
||||||
|
"j.jabatan as jabatan, " +
|
||||||
"u.roleId as roleId, " +
|
"u.roleId as roleId, " +
|
||||||
"r.role as role, " +
|
"r.role as role, " +
|
||||||
"u.bidangId as bidangId, " +
|
"u.bidangId as bidangId, " +
|
||||||
@ -62,6 +65,7 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
"JOIN Roles r ON r.id = u.roleId " +
|
"JOIN Roles r ON r.id = u.roleId " +
|
||||||
"JOIN Bidang b ON b.id = u.bidangId " +
|
"JOIN Bidang b ON b.id = u.bidangId " +
|
||||||
"JOIN Instansi i ON i.id = u.instansiId " +
|
"JOIN Instansi i ON i.id = u.instansiId " +
|
||||||
|
"JOIN Jabatan j ON j.id = u.jabatanId " +
|
||||||
"Where u.isDelete = false " +
|
"Where u.isDelete = false " +
|
||||||
"AND (u.username = :input OR u.email = :input)")
|
"AND (u.username = :input OR u.email = :input)")
|
||||||
Optional<UserRoleView> getByUsernameOrEmail(String input);
|
Optional<UserRoleView> getByUsernameOrEmail(String input);
|
||||||
@ -71,7 +75,8 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
@Query("SELECT u.id as id, " +
|
@Query("SELECT u.id as id, " +
|
||||||
"u.nama as nama, " +
|
"u.nama as nama, " +
|
||||||
"u.username as username, " +
|
"u.username as username, " +
|
||||||
"u.jabatan as jabatan, " +
|
"u.jabatanId as jabatanId, " +
|
||||||
|
"j.jabatan as jabatan, " +
|
||||||
"u.roleId as roleId, " +
|
"u.roleId as roleId, " +
|
||||||
"r.role as role, " +
|
"r.role as role, " +
|
||||||
"u.bidangId as bidangId, " +
|
"u.bidangId as bidangId, " +
|
||||||
@ -85,6 +90,7 @@ public interface UsersRepository extends JpaRepository<Users, Long> {
|
|||||||
"JOIN Roles r ON r.id = u.roleId " +
|
"JOIN Roles r ON r.id = u.roleId " +
|
||||||
"JOIN Bidang b ON b.id = u.bidangId " +
|
"JOIN Bidang b ON b.id = u.bidangId " +
|
||||||
"JOIN Instansi i ON i.id = u.instansiId " +
|
"JOIN Instansi i ON i.id = u.instansiId " +
|
||||||
|
"JOIN Jabatan j ON j.id = u.jabatanId " +
|
||||||
"Where u.isDelete = false " +
|
"Where u.isDelete = false " +
|
||||||
"AND u.id = :id")
|
"AND u.id = :id")
|
||||||
Optional<UserRoleView> getUserByIdAndDeletedFase(Long id);
|
Optional<UserRoleView> getUserByIdAndDeletedFase(Long id);
|
||||||
|
@ -65,7 +65,14 @@ public class LoginService implements BaseService<LoginRequest, LoginResponse> {
|
|||||||
.userId(userRoleView.getId())
|
.userId(userRoleView.getId())
|
||||||
.username(userRoleView.getUsername())
|
.username(userRoleView.getUsername())
|
||||||
.nama(userRoleView.getNama())
|
.nama(userRoleView.getNama())
|
||||||
|
.roleId(userRoleView.getRoleId())
|
||||||
.role(userRoleView.getRole())
|
.role(userRoleView.getRole())
|
||||||
|
.instansiId(userRoleView.getInstansiId())
|
||||||
|
.instansi(userRoleView.getInstansi())
|
||||||
|
.bidangId(userRoleView.getBidangId())
|
||||||
|
.bidang(userRoleView.getBidang())
|
||||||
|
.jabatanId(userRoleView.getJabatanId())
|
||||||
|
.jabatan(userRoleView.getJabatan())
|
||||||
.accessMenu(new HashSet<>())
|
.accessMenu(new HashSet<>())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -72,7 +72,12 @@ public class TokenManagementService implements BaseService<RefreshTokenRequest,
|
|||||||
.userId(userRoleView.getId())
|
.userId(userRoleView.getId())
|
||||||
.username(userRoleView.getUsername())
|
.username(userRoleView.getUsername())
|
||||||
.nama(userRoleView.getNama())
|
.nama(userRoleView.getNama())
|
||||||
|
.roleId(userRoleView.getRoleId())
|
||||||
.role(userRoleView.getRole())
|
.role(userRoleView.getRole())
|
||||||
|
.instansiId(userRoleView.getInstansiId())
|
||||||
|
.instansi(userRoleView.getInstansi())
|
||||||
|
.bidangId(userRoleView.getBidangId())
|
||||||
|
.bidang(userRoleView.getBidang())
|
||||||
.accessMenu(new HashSet<>())
|
.accessMenu(new HashSet<>())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ public class GetListUserService implements BaseService<UsersRequest, GetUsersRes
|
|||||||
.id(userRoleView.getId())
|
.id(userRoleView.getId())
|
||||||
.nama(userRoleView.getNama())
|
.nama(userRoleView.getNama())
|
||||||
.username(userRoleView.getUsername())
|
.username(userRoleView.getUsername())
|
||||||
|
.jabatanId(userRoleView.getJabatanId())
|
||||||
.jabatan(userRoleView.getJabatan())
|
.jabatan(userRoleView.getJabatan())
|
||||||
.roleId(userRoleView.getRoleId())
|
.roleId(userRoleView.getRoleId())
|
||||||
.role(userRoleView.getRole())
|
.role(userRoleView.getRole())
|
||||||
|
@ -26,6 +26,7 @@ public class GetUserByIdService implements BaseService<UsersRequest, UsersRespon
|
|||||||
.id(userRoleView.getId())
|
.id(userRoleView.getId())
|
||||||
.nama(userRoleView.getNama())
|
.nama(userRoleView.getNama())
|
||||||
.username(userRoleView.getUsername())
|
.username(userRoleView.getUsername())
|
||||||
|
.jabatanId(userRoleView.getJabatanId())
|
||||||
.jabatan(userRoleView.getJabatan())
|
.jabatan(userRoleView.getJabatan())
|
||||||
.roleId(userRoleView.getRoleId())
|
.roleId(userRoleView.getRoleId())
|
||||||
.role(userRoleView.getRole())
|
.role(userRoleView.getRole())
|
||||||
|
@ -36,7 +36,7 @@ public class PostCreateUserService implements BaseService<UsersRequest, UsersRes
|
|||||||
.bidangId(input.getBidangId())
|
.bidangId(input.getBidangId())
|
||||||
.nama(input.getNama())
|
.nama(input.getNama())
|
||||||
.username(input.getUsername())
|
.username(input.getUsername())
|
||||||
.jabatan(input.getJabatan())
|
.jabatanId(input.getJabatanId())
|
||||||
.roleId(input.getRoleId())
|
.roleId(input.getRoleId())
|
||||||
.email(input.getEmail())
|
.email(input.getEmail())
|
||||||
.password(input.getPassword())
|
.password(input.getPassword())
|
||||||
|
@ -31,7 +31,7 @@ public class PutUpdateUserService implements BaseService<UsersRequest, UsersResp
|
|||||||
users.setBidangId(input.getBidangId());
|
users.setBidangId(input.getBidangId());
|
||||||
users.setNama(input.getNama());
|
users.setNama(input.getNama());
|
||||||
users.setUsername(input.getUsername());
|
users.setUsername(input.getUsername());
|
||||||
users.setJabatan(input.getJabatan());
|
users.setJabatanId(input.getJabatanId());
|
||||||
users.setRoleId(input.getRoleId());
|
users.setRoleId(input.getRoleId());
|
||||||
users.setEmail(input.getEmail());
|
users.setEmail(input.getEmail());
|
||||||
users.setPassword(input.getPassword());
|
users.setPassword(input.getPassword());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user