|
|
@ -89,34 +89,61 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp
|
|
|
|
public VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId)
|
|
|
|
public VppUserDTO updateVppUser(VppUserDTO userDTO, int tenantId)
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
throws ApplicationManagementDAOException {
|
|
|
|
|
|
|
|
|
|
|
|
String sql = "UPDATE "
|
|
|
|
String sql = "UPDATE AP_VPP_USER SET ";
|
|
|
|
+ "AP_VPP_USER "
|
|
|
|
if (userDTO.getClientUserId() != null && !userDTO.getClientUserId().isEmpty()) {
|
|
|
|
+ "SET "
|
|
|
|
sql += "CLIENT_USER_ID = ?,";
|
|
|
|
+ "CLIENT_USER_ID = ?,"
|
|
|
|
}
|
|
|
|
+ "DM_USERNAME = ?, "
|
|
|
|
if (userDTO.getDmUsername() != null && !userDTO.getDmUsername().isEmpty()) {
|
|
|
|
+ "TENANT_ID = ?, "
|
|
|
|
sql += "DM_USERNAME = ?,";
|
|
|
|
+ "EMAIL = ?, "
|
|
|
|
}
|
|
|
|
+ "INVITE_CODE = ?, "
|
|
|
|
if (userDTO.getEmail() != null && !userDTO.getEmail().isEmpty()) {
|
|
|
|
+ "STATUS = ?, "
|
|
|
|
sql += "EMAIL = ?,";
|
|
|
|
+ "LAST_UPDATED_TIME = ?, "
|
|
|
|
}
|
|
|
|
+ "MANAGED_ID = ?, "
|
|
|
|
if (userDTO.getInviteCode() != null && !userDTO.getInviteCode().isEmpty()) {
|
|
|
|
+ "TEMP_PASSWORD = ? "
|
|
|
|
sql += "INVITE_CODE = ?,";
|
|
|
|
+ "WHERE ID = ?";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getStatus() != null && !userDTO.getStatus().isEmpty()) {
|
|
|
|
|
|
|
|
sql += "STATUS = ?,";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getManagedId() != null && !userDTO.getManagedId().isEmpty()) {
|
|
|
|
|
|
|
|
sql += "MANAGED_ID = ?,";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getTmpPassword() != null && !userDTO.getTmpPassword().isEmpty()) {
|
|
|
|
|
|
|
|
sql += "TEMP_PASSWORD = ?,";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sql += " TENANT_ID = ?, LAST_UPDATED_TIME = ? WHERE ID = ?";
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = this.getDBConnection();
|
|
|
|
Connection conn = this.getDBConnection();
|
|
|
|
long updatedTime = System.currentTimeMillis();
|
|
|
|
long updatedTime = System.currentTimeMillis();
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
stmt.setString(1, userDTO.getClientUserId());
|
|
|
|
int x = 0;
|
|
|
|
stmt.setString(2, userDTO.getDmUsername());
|
|
|
|
|
|
|
|
stmt.setInt(3, tenantId);
|
|
|
|
if (userDTO.getClientUserId() != null && !userDTO.getClientUserId().isEmpty()) {
|
|
|
|
stmt.setString(4, userDTO.getEmail());
|
|
|
|
stmt.setString(++x, userDTO.getClientUserId());
|
|
|
|
stmt.setString(5, userDTO.getInviteCode());
|
|
|
|
}
|
|
|
|
stmt.setString(6, userDTO.getStatus());
|
|
|
|
if (userDTO.getDmUsername() != null && !userDTO.getDmUsername().isEmpty()) {
|
|
|
|
stmt.setLong(7, updatedTime);
|
|
|
|
stmt.setString(++x, userDTO.getDmUsername());
|
|
|
|
stmt.setString(8, userDTO.getManagedId());
|
|
|
|
}
|
|
|
|
stmt.setString(9, userDTO.getTmpPassword());
|
|
|
|
if (userDTO.getEmail() != null && !userDTO.getEmail().isEmpty()) {
|
|
|
|
stmt.setInt(10, userDTO.getId());
|
|
|
|
stmt.setString(++x, userDTO.getEmail());
|
|
|
|
stmt.executeUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getInviteCode() != null && !userDTO.getInviteCode().isEmpty()) {
|
|
|
|
|
|
|
|
stmt.setString(++x, userDTO.getInviteCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getStatus() != null && !userDTO.getStatus().isEmpty()) {
|
|
|
|
|
|
|
|
stmt.setString(++x, userDTO.getStatus());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getManagedId() != null && !userDTO.getManagedId().isEmpty()) {
|
|
|
|
|
|
|
|
stmt.setString(++x, userDTO.getManagedId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDTO.getTmpPassword() != null && !userDTO.getTmpPassword().isEmpty()) {
|
|
|
|
|
|
|
|
stmt.setString(++x, userDTO.getTmpPassword());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stmt.setInt(++x, tenantId);
|
|
|
|
|
|
|
|
stmt.setLong(++x, updatedTime);
|
|
|
|
|
|
|
|
stmt.setInt(++x, userDTO.getId());
|
|
|
|
if (stmt.executeUpdate() == 1) {
|
|
|
|
if (stmt.executeUpdate() == 1) {
|
|
|
|
return userDTO;
|
|
|
|
return userDTO;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -147,6 +174,7 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp
|
|
|
|
+ "LAST_UPDATED_TIME, "
|
|
|
|
+ "LAST_UPDATED_TIME, "
|
|
|
|
+ "MANAGED_ID, "
|
|
|
|
+ "MANAGED_ID, "
|
|
|
|
+ "TEMP_PASSWORD "
|
|
|
|
+ "TEMP_PASSWORD "
|
|
|
|
|
|
|
|
+ "DM_USERNAME "
|
|
|
|
+ "FROM AP_VPP_USER "
|
|
|
|
+ "FROM AP_VPP_USER "
|
|
|
|
+ "WHERE DM_USERNAME = ? AND TENANT_ID = ?";
|
|
|
|
+ "WHERE DM_USERNAME = ? AND TENANT_ID = ?";
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|