-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement transaction-account-report-item
- Loading branch information
Showing
25 changed files
with
2,190 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"fields": [ | ||
{ | ||
"fieldName": "accountName", | ||
"fieldType": "String" | ||
}, | ||
{ | ||
"fieldName": "accountNumber", | ||
"fieldType": "String" | ||
}, | ||
{ | ||
"fieldName": "accountBalance", | ||
"fieldType": "BigDecimal" | ||
} | ||
], | ||
"relationships": [], | ||
"service": "serviceImpl", | ||
"dto": "mapstruct", | ||
"jpaMetamodelFiltering": true, | ||
"readOnly": true, | ||
"pagination": "pagination", | ||
"name": "TransactionAccountReportItem", | ||
"changelogDate": "20241115120936", | ||
"incrementalChangelog": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/main/java/io/github/erp/domain/TransactionAccountReportItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
package io.github.erp.domain; | ||
|
||
/*- | ||
* Erp System - Mark X No 10 (Jehoiada Series) Server ver 1.8.2 | ||
* Copyright © 2021 - 2024 Edwin Njeru and the ERP System Contributors ([email protected]) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import java.io.Serializable; | ||
import java.math.BigDecimal; | ||
import javax.persistence.*; | ||
import org.hibernate.annotations.Cache; | ||
import org.hibernate.annotations.CacheConcurrencyStrategy; | ||
|
||
/** | ||
* A TransactionAccountReportItem. | ||
*/ | ||
@Entity | ||
@Table(name = "transaction_account_report_item") | ||
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) | ||
@org.springframework.data.elasticsearch.annotations.Document(indexName = "transactionaccountreportitem") | ||
public class TransactionAccountReportItem implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") | ||
@SequenceGenerator(name = "sequenceGenerator") | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@Column(name = "account_name") | ||
private String accountName; | ||
|
||
@Column(name = "account_number") | ||
private String accountNumber; | ||
|
||
@Column(name = "account_balance", precision = 21, scale = 2) | ||
private BigDecimal accountBalance; | ||
|
||
// jhipster-needle-entity-add-field - JHipster will add fields here | ||
|
||
public Long getId() { | ||
return this.id; | ||
} | ||
|
||
public TransactionAccountReportItem id(Long id) { | ||
this.setId(id); | ||
return this; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getAccountName() { | ||
return this.accountName; | ||
} | ||
|
||
public TransactionAccountReportItem accountName(String accountName) { | ||
this.setAccountName(accountName); | ||
return this; | ||
} | ||
|
||
public void setAccountName(String accountName) { | ||
this.accountName = accountName; | ||
} | ||
|
||
public String getAccountNumber() { | ||
return this.accountNumber; | ||
} | ||
|
||
public TransactionAccountReportItem accountNumber(String accountNumber) { | ||
this.setAccountNumber(accountNumber); | ||
return this; | ||
} | ||
|
||
public void setAccountNumber(String accountNumber) { | ||
this.accountNumber = accountNumber; | ||
} | ||
|
||
public BigDecimal getAccountBalance() { | ||
return this.accountBalance; | ||
} | ||
|
||
public TransactionAccountReportItem accountBalance(BigDecimal accountBalance) { | ||
this.setAccountBalance(accountBalance); | ||
return this; | ||
} | ||
|
||
public void setAccountBalance(BigDecimal accountBalance) { | ||
this.accountBalance = accountBalance; | ||
} | ||
|
||
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof TransactionAccountReportItem)) { | ||
return false; | ||
} | ||
return id != null && id.equals(((TransactionAccountReportItem) o).id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ | ||
return getClass().hashCode(); | ||
} | ||
|
||
// prettier-ignore | ||
@Override | ||
public String toString() { | ||
return "TransactionAccountReportItem{" + | ||
"id=" + getId() + | ||
", accountName='" + getAccountName() + "'" + | ||
", accountNumber='" + getAccountNumber() + "'" + | ||
", accountBalance=" + getAccountBalance() + | ||
"}"; | ||
} | ||
} |
129 changes: 129 additions & 0 deletions
129
...in/java/io/github/erp/erp/resources/ledgers/TransactionAccountReportItemResourceProd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package io.github.erp.erp.resources.ledgers; | ||
|
||
/*- | ||
* Erp System - Mark X No 10 (Jehoiada Series) Server ver 1.8.2 | ||
* Copyright © 2021 - 2024 Edwin Njeru and the ERP System Contributors ([email protected]) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import io.github.erp.internal.repository.InternalTransactionAccountReportItemRepository; | ||
import io.github.erp.internal.service.ledgers.InternalTransactionAccountReportItemService; | ||
import io.github.erp.repository.TransactionAccountReportItemRepository; | ||
import io.github.erp.service.TransactionAccountReportItemQueryService; | ||
import io.github.erp.service.TransactionAccountReportItemService; | ||
import io.github.erp.service.criteria.TransactionAccountReportItemCriteria; | ||
import io.github.erp.service.dto.TransactionAccountReportItemDTO; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder; | ||
import tech.jhipster.web.util.PaginationUtil; | ||
import tech.jhipster.web.util.ResponseUtil; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* REST controller for managing {@link io.github.erp.domain.TransactionAccountReportItem}. | ||
*/ | ||
@RestController | ||
@RequestMapping("/api/accounts") | ||
public class TransactionAccountReportItemResourceProd { | ||
|
||
private final Logger log = LoggerFactory.getLogger(TransactionAccountReportItemResourceProd.class); | ||
|
||
private final InternalTransactionAccountReportItemService transactionAccountReportItemService; | ||
|
||
private final InternalTransactionAccountReportItemRepository transactionAccountReportItemRepository; | ||
|
||
private final TransactionAccountReportItemQueryService transactionAccountReportItemQueryService; | ||
|
||
public TransactionAccountReportItemResourceProd( | ||
InternalTransactionAccountReportItemService transactionAccountReportItemService, | ||
InternalTransactionAccountReportItemRepository transactionAccountReportItemRepository, | ||
TransactionAccountReportItemQueryService transactionAccountReportItemQueryService | ||
) { | ||
this.transactionAccountReportItemService = transactionAccountReportItemService; | ||
this.transactionAccountReportItemRepository = transactionAccountReportItemRepository; | ||
this.transactionAccountReportItemQueryService = transactionAccountReportItemQueryService; | ||
} | ||
|
||
/** | ||
* {@code GET /transaction-account-report-items} : get all the transactionAccountReportItems. | ||
* | ||
* @param pageable the pagination information. | ||
* @param criteria the criteria which the requested entities should match. | ||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of transactionAccountReportItems in body. | ||
*/ | ||
@GetMapping("/transaction-account-report-items") | ||
public ResponseEntity<List<TransactionAccountReportItemDTO>> getAllTransactionAccountReportItems( | ||
TransactionAccountReportItemCriteria criteria, | ||
Pageable pageable | ||
) { | ||
log.debug("REST request to get TransactionAccountReportItems by criteria: {}", criteria); | ||
Page<TransactionAccountReportItemDTO> page = transactionAccountReportItemService.findAll(LocalDate.of(2024,7,31), pageable); | ||
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); | ||
return ResponseEntity.ok().headers(headers).body(page.getContent()); | ||
} | ||
|
||
/** | ||
* {@code GET /transaction-account-report-items/count} : count all the transactionAccountReportItems. | ||
* | ||
* @param criteria the criteria which the requested entities should match. | ||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body. | ||
*/ | ||
@GetMapping("/transaction-account-report-items/count") | ||
public ResponseEntity<Long> countTransactionAccountReportItems(TransactionAccountReportItemCriteria criteria) { | ||
log.debug("REST request to count TransactionAccountReportItems by criteria: {}", criteria); | ||
return ResponseEntity.ok().body(transactionAccountReportItemQueryService.countByCriteria(criteria)); | ||
} | ||
|
||
/** | ||
* {@code GET /transaction-account-report-items/:id} : get the "id" transactionAccountReportItem. | ||
* | ||
* @param id the id of the transactionAccountReportItemDTO to retrieve. | ||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the transactionAccountReportItemDTO, or with status {@code 404 (Not Found)}. | ||
*/ | ||
@GetMapping("/transaction-account-report-items/{id}") | ||
public ResponseEntity<TransactionAccountReportItemDTO> getTransactionAccountReportItem(@PathVariable Long id) { | ||
log.debug("REST request to get TransactionAccountReportItem : {}", id); | ||
Optional<TransactionAccountReportItemDTO> transactionAccountReportItemDTO = transactionAccountReportItemService.findOne(id); | ||
return ResponseUtil.wrapOrNotFound(transactionAccountReportItemDTO); | ||
} | ||
|
||
/** | ||
* {@code SEARCH /_search/transaction-account-report-items?query=:query} : search for the transactionAccountReportItem corresponding | ||
* to the query. | ||
* | ||
* @param query the query of the transactionAccountReportItem search. | ||
* @param pageable the pagination information. | ||
* @return the result of the search. | ||
*/ | ||
@GetMapping("/_search/transaction-account-report-items") | ||
public ResponseEntity<List<TransactionAccountReportItemDTO>> searchTransactionAccountReportItems( | ||
@RequestParam String query, | ||
Pageable pageable | ||
) { | ||
log.debug("REST request to search for a page of TransactionAccountReportItems for query {}", query); | ||
Page<TransactionAccountReportItemDTO> page = transactionAccountReportItemService.search(query, pageable); | ||
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); | ||
return ResponseEntity.ok().headers(headers).body(page.getContent()); | ||
} | ||
} |
Oops, something went wrong.