FINERACT-2232: Create LoanCapitalizedIncomeBalance entity and table
This commit is contained in:
+64
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.portfolio.loanaccount.domain;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.Version;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "m_loan_capitalized_income_balance")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class LoanCapitalizedIncomeBalance extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||||
|
|
||||||
|
@Version
|
||||||
|
private Long version;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "loan_id", nullable = false)
|
||||||
|
private Loan loan;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "loan_transaction_id", nullable = false)
|
||||||
|
private LoanTransaction loanTransaction;
|
||||||
|
|
||||||
|
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Column(name = "date", nullable = false)
|
||||||
|
private LocalDate date;
|
||||||
|
|
||||||
|
@Column(name = "unrecognized_amount", scale = 6, precision = 19, nullable = false)
|
||||||
|
private BigDecimal unrecognizedAmount;
|
||||||
|
|
||||||
|
@Column(name = "charged_off_amount", scale = 6, precision = 19)
|
||||||
|
private BigDecimal chargedOffAmount;
|
||||||
|
|
||||||
|
@Column(name = "amount_adjustment", scale = 6, precision = 19)
|
||||||
|
private BigDecimal amountAdjustment;
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.portfolio.loanaccount.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
public interface LoanCapitalizedIncomeBalanceRepository
|
||||||
|
extends JpaRepository<LoanCapitalizedIncomeBalance, Long>, JpaSpecificationExecutor<LoanCapitalizedIncomeBalance> {
|
||||||
|
|
||||||
|
List<LoanCapitalizedIncomeBalance> findAllByLoanId(Long loanId);
|
||||||
|
|
||||||
|
LoanCapitalizedIncomeBalance findByLoanIdAndLoanTransactionId(Long loanId, Long transactionId);
|
||||||
|
}
|
||||||
@@ -190,4 +190,5 @@
|
|||||||
<include file="parts/0169_add_missing_permissions.xml" relativeToChangelogFile="true" />
|
<include file="parts/0169_add_missing_permissions.xml" relativeToChangelogFile="true" />
|
||||||
<include file="parts/0170_days_in_year_custom_strategy.xml" relativeToChangelogFile="true"/>
|
<include file="parts/0170_days_in_year_custom_strategy.xml" relativeToChangelogFile="true"/>
|
||||||
<include file="parts/0171_loan_capitalized_income.xml" relativeToChangelogFile="true"/>
|
<include file="parts/0171_loan_capitalized_income.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="parts/0172_create_loan_capitalized_income_balance.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
|
||||||
|
<changeSet author="fineract" id="1" context="postgresql">
|
||||||
|
<createTable tableName="m_loan_capitalized_income_balance">
|
||||||
|
<column autoIncrement="true" name="id" type="BIGINT">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_m_loan_capitalized_income_balance"/>
|
||||||
|
</column>
|
||||||
|
<column name="version" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="loan_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="loan_transaction_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="amount" type="DECIMAL(19, 6)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="date" type="DATE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="unrecognized_amount" type="DECIMAL(19, 6)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="charged_off_amount" type="DECIMAL(19, 6)" />
|
||||||
|
<column name="amount_adjustment" type="DECIMAL(19, 6)" />
|
||||||
|
<column name="created_by" type="BIGINT"/>
|
||||||
|
<column name="created_on_utc" type="timestamp with time zone"/>
|
||||||
|
<column name="last_modified_by" type="BIGINT"/>
|
||||||
|
<column name="last_modified_on_utc" type="timestamp with time zone"/>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="fineract" id="2" context="mysql">
|
||||||
|
<createTable tableName="m_loan_capitalized_income_balance">
|
||||||
|
<column autoIncrement="true" name="id" type="BIGINT">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_m_loan_capitalized_income_balance"/>
|
||||||
|
</column>
|
||||||
|
<column name="version" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="loan_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="loan_transaction_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="amount" type="DECIMAL(19, 6)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="date" type="DATE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="unrecognized_amount" type="DECIMAL(19, 6)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="charged_off_amount" type="DECIMAL(19, 6)" />
|
||||||
|
<column name="amount_adjustment" type="DECIMAL(19, 6)" />
|
||||||
|
<column name="created_by" type="BIGINT"/>
|
||||||
|
<column name="created_on_utc" type="DATETIME"/>
|
||||||
|
<column name="last_modified_by" type="BIGINT"/>
|
||||||
|
<column name="last_modified_on_utc" type="DATETIME"/>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="fineract" id="3">
|
||||||
|
<addForeignKeyConstraint baseColumnNames="created_by" baseTableName="m_loan_capitalized_income_balance"
|
||||||
|
constraintName="FK_loan_capitalized_income_balance_created_by" deferrable="false" initiallyDeferred="false"
|
||||||
|
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
|
||||||
|
referencedTableName="m_appuser" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="last_modified_by" baseTableName="m_loan_capitalized_income_balance"
|
||||||
|
constraintName="FK_loan_capitalized_income_balance_last_modified_by" deferrable="false" initiallyDeferred="false"
|
||||||
|
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
|
||||||
|
referencedTableName="m_appuser" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="loan_id" baseTableName="m_loan_capitalized_income_balance"
|
||||||
|
constraintName="FK_loan_capitalized_income_balance_loan_id" deferrable="false" initiallyDeferred="false"
|
||||||
|
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
|
||||||
|
referencedTableName="m_loan" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="loan_transaction_id" baseTableName="m_loan_capitalized_income_balance"
|
||||||
|
constraintName="FK_loan_capitalized_income_balance_transaction_id" deferrable="false" initiallyDeferred="false"
|
||||||
|
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
|
||||||
|
referencedTableName="m_loan_transaction" validate="true"/>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="fineract" id="4" runInTransaction="false" context="postgresql">
|
||||||
|
<sql>
|
||||||
|
create unique index concurrently if not exists m_loan_capitalized_income_balance_idx_1 on m_loan_capitalized_income_balance(loan_id,loan_transaction_id);
|
||||||
|
create index concurrently if not exists m_loan_capitalized_income_balance_idx_2 on m_loan_capitalized_income_balance(loan_id);
|
||||||
|
</sql>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet author="fineract" id="5" context="mysql">
|
||||||
|
<sql>
|
||||||
|
create unique index m_loan_capitalized_income_balance_idx_1 on m_loan_capitalized_income_balance(loan_id,loan_transaction_id);
|
||||||
|
create index m_loan_capitalized_income_balance_idx_2 on m_loan_capitalized_income_balance(loan_id);
|
||||||
|
</sql>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
Reference in New Issue
Block a user