SUPPORT-9080: Fix

This commit is contained in:
Eduard Tihomirov 2025-04-04 17:15:25 +03:00
parent e4b2e0d92e
commit d5e8b49c2c
7 changed files with 73 additions and 6 deletions

View file

@ -89,6 +89,11 @@ public class UserApplicationRole extends TableImpl<UserApplicationRoleRecord> {
*/
public final TableField<UserApplicationRoleRecord, Timestamp> FINISHED = createField(DSL.name("finished"), SQLDataType.TIMESTAMP(0), this, "Дата и время окончания действия роли");
/**
* The column <code>public.user_application_role.role_code</code>. Код роли
*/
public final TableField<UserApplicationRoleRecord, String> ROLE_CODE = createField(DSL.name("role_code"), SQLDataType.VARCHAR, this, "Код роли");
private UserApplicationRole(Name alias, Table<UserApplicationRoleRecord> aliased) {
this(alias, aliased, (Field<?>[]) null, null);
}

View file

@ -100,6 +100,20 @@ public class UserApplicationRoleRecord extends UpdatableRecordImpl<UserApplicati
return (Timestamp) get(4);
}
/**
* Setter for <code>public.user_application_role.role_code</code>. Код роли
*/
public void setRoleCode(String value) {
set(5, value);
}
/**
* Getter for <code>public.user_application_role.role_code</code>. Код роли
*/
public String getRoleCode() {
return (String) get(5);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@ -123,7 +137,7 @@ public class UserApplicationRoleRecord extends UpdatableRecordImpl<UserApplicati
/**
* Create a detached, initialised UserApplicationRoleRecord
*/
public UserApplicationRoleRecord(String userRoleId, String roleName, Timestamp created, Timestamp updated, Timestamp finished) {
public UserApplicationRoleRecord(String userRoleId, String roleName, Timestamp created, Timestamp updated, Timestamp finished, String roleCode) {
super(UserApplicationRole.USER_APPLICATION_ROLE);
setUserRoleId(userRoleId);
@ -131,6 +145,7 @@ public class UserApplicationRoleRecord extends UpdatableRecordImpl<UserApplicati
setCreated(created);
setUpdated(updated);
setFinished(finished);
setRoleCode(roleCode);
resetChangedOnNotNull();
}
}

View file

@ -26,6 +26,8 @@ public class RoleResponse {
private Long createDate;
private Long modified;
private Long finish;
private String name;
private Boolean ervuRole;
public String getId() {
return id;
@ -66,5 +68,22 @@ public class RoleResponse {
public void setFinish(Long finish) {
this.finish = finish;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getErvuRole() {
return ervuRole;
}
public void setErvuRole(Boolean ervuRole) {
this.ervuRole = ervuRole;
}
}
}

View file

@ -167,6 +167,9 @@ public class ErvuDirectoriesService {
List<UserApplicationRoleRecord> roleRecords = new ArrayList<>();
List<String> ids = ervuDirectoriesDaoService.getRoleIds();
dataList.forEach(data -> {
if (data.getErvuRole() == null || !data.getErvuRole()) {
return;
}
Timestamp updatedAt = Timestamp.from(Instant.ofEpochSecond(data.getModified()));
Timestamp createdAt = Timestamp.from(Instant.ofEpochSecond(data.getCreateDate()));
Timestamp finishAt = null;
@ -175,6 +178,7 @@ public class ErvuDirectoriesService {
}
UserApplicationRoleRecord roleRecord = ervuDirectoriesDaoService.getRoleRecord();
roleRecord.setUserRoleId(data.getId());
roleRecord.setRoleCode(data.getName());
roleRecord.setRoleName(data.getDisplayName());
roleRecord.setCreated(createdAt);
roleRecord.setUpdated(updatedAt);

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<changeSet id="0001" author="tihomirov">
<comment>truncate user_application_role table</comment>
<sql>
TRUNCATE public.user_application_role CASCADE;
</sql>
</changeSet>
<changeSet id="0002" author="tihomirov">
<comment>add role_code column to user_application_role table</comment>
<sql>
ALTER TABLE IF EXISTS public.user_application_role ADD COLUMN IF NOT EXISTS role_code character varying;
COMMENT ON COLUMN public.user_application_role.role_code IS 'Код роли';
</sql>
</changeSet>
</databaseChangeLog>

View file

@ -18,4 +18,5 @@
<include file="20250313-SUPPORT-8957_add_trace_id.xml" relativeToChangelogFile="true"/>
<include file="20250317-SUPPORT-8696_add_shedlock.xml" relativeToChangelogFile="true"/>
<include file="20250324-SUPPORT-9023_add_sent_date.xml" relativeToChangelogFile="true"/>
<include file="20250404-SUPPORT-9080_add_role_code.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasource>
<dbBeanPackage>ru.micord.ervu.account_applications.db_beans</dbBeanPackage>
<dbName>ervu_account_applications_seamlessness</dbName>
<dbName>account_applications</dbName>
<driverClassName>org.postgresql.Driver</driverClassName>
<host>10.10.31.118</host>
<host>localhost</host>
<manually>false</manually>
<password>ervu_account_applications</password>
<password>RfrLtkf7</password>
<port>5432</port>
<schemas>public</schemas>
<sqlDialect>POSTGRES</sqlDialect>
<url>jdbc:postgresql://10.10.31.118:5432/ervu_account_applications_seamlessness</url>
<url>jdbc:postgresql://localhost:5432/account_applications</url>
<urlPrefix>jdbc:postgresql:</urlPrefix>
<user>ervu_account_applications</user>
<user>postgres</user>
</datasource>