| @@ -1,6 +1,7 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | package com.ffii.tsms.modules.data.entity; | ||||
| import com.ffii.core.entity.IdEntity; | import com.ffii.core.entity.IdEntity; | ||||
| import com.ffii.tsms.modules.data.entity.projections.StaffSearchInfo; | |||||
| import jakarta.persistence.Column; | import jakarta.persistence.Column; | ||||
| import jakarta.persistence.Entity; | import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.JoinColumn; | import jakarta.persistence.JoinColumn; | ||||
| @@ -26,7 +27,7 @@ public class SalaryEffective extends IdEntity<Long> { | |||||
| } | } | ||||
| @ManyToOne | @ManyToOne | ||||
| @JoinColumn(name = "salaryId") | |||||
| @JoinColumn(name = "salaryId", referencedColumnName = "salaryPoint") | |||||
| @NotNull | @NotNull | ||||
| private Salary salary; | private Salary salary; | ||||
| @@ -1,11 +1,15 @@ | |||||
| package com.ffii.tsms.modules.data.entity; | package com.ffii.tsms.modules.data.entity; | ||||
| import com.ffii.core.support.AbstractRepository; | import com.ffii.core.support.AbstractRepository; | ||||
| import com.ffii.tsms.modules.data.entity.projections.SalaryEffectiveInfo; | |||||
| import org.springframework.data.repository.query.Param; | import org.springframework.data.repository.query.Param; | ||||
| import java.util.List; | |||||
| import java.util.Optional; | import java.util.Optional; | ||||
| public interface SalaryEffectiveRepository extends AbstractRepository<SalaryEffective, Long> { | public interface SalaryEffectiveRepository extends AbstractRepository<SalaryEffective, Long> { | ||||
| Optional<SalaryEffective> findByStaffIdAndSalaryId(@Param("staffId") Long staffId, @Param("salaryId") Long salaryId); | Optional<SalaryEffective> findByStaffIdAndSalaryId(@Param("staffId") Long staffId, @Param("salaryId") Long salaryId); | ||||
| List<SalaryEffectiveInfo> findSalaryEffectiveInfoByStaffIdInOrderByStaffId(List<Long> staffIds); | |||||
| } | } | ||||
| @@ -0,0 +1,23 @@ | |||||
| package com.ffii.tsms.modules.data.entity.projections | |||||
| import com.ffii.tsms.modules.data.entity.Salary | |||||
| import org.springframework.beans.factory.annotation.Value | |||||
| import java.time.LocalDate | |||||
| interface SalaryEffectiveInfo { | |||||
| val id: Long? | |||||
| val date: LocalDate | |||||
| val salary: Salary | |||||
| @get:Value("#{target.staff?.name}") | |||||
| val name: String? | |||||
| @get:Value("#{target.staff?.staffId}") | |||||
| val staffId: String? | |||||
| @get:Value("#{target.staff?.grade?.name}") | |||||
| val gradeName: String? | |||||
| @get:Value("#{target.staff?.grade?.code}") | |||||
| val gradeCode: String? | |||||
| @get:Value("#{target.staff?.team?.code}") | |||||
| val teamCode: String? | |||||
| @get:Value("#{target.staff?.team?.name}") | |||||
| val teamName: String? | |||||
| } | |||||
| @@ -684,7 +684,7 @@ open class InvoiceService( | |||||
| open fun updateInvoiceDetail(editInvoiceRequest :EditInvoiceRequest): EditInvoiceResponse { | open fun updateInvoiceDetail(editInvoiceRequest :EditInvoiceRequest): EditInvoiceResponse { | ||||
| val invoice = repository.findById(editInvoiceRequest.id) | val invoice = repository.findById(editInvoiceRequest.id) | ||||
| val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") | val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") | ||||
| println("${editInvoiceRequest.issuedDate}, ${editInvoiceRequest.receiptDate}") | |||||
| // println("${editInvoiceRequest.issuedDate}, ${editInvoiceRequest.receiptDate}") | |||||
| if (invoice.isPresent){ | if (invoice.isPresent){ | ||||
| val updateInvocie = invoice.get().apply { | val updateInvocie = invoice.get().apply { | ||||
| invoiceNo = editInvoiceRequest.invoiceNo | invoiceNo = editInvoiceRequest.invoiceNo | ||||
| @@ -0,0 +1,4 @@ | |||||
| -- liquibase formatted sql | |||||
| -- changeset jasonT:Update_FK_salary_effective | |||||
| ALTER TABLE salary_effective ADD CONSTRAINT `salary_effective_salary_FK` FOREIGN KEY (`salaryId`) REFERENCES `salary` (`salaryPoint`); | |||||