From 34b07249c7e7a9f487a6bc08f022db6bcb925d42 Mon Sep 17 00:00:00 2001
From: Jack <jack.su@pollex.com.tw>
Date: 星期四, 20 一月 2022 14:46:35 +0800
Subject: [PATCH] [UPDATE] 調整客戶填寫滿意度的API [UPDATE] 調整產生滿意度調查資料的時機點,改為每次進到結案狀態就新增滿意度資料 [UPDATE] 調整結案API,新增和修改都使用同一支API由後端判斷為新增或修改 [BUG] 當沒有任何一筆滿意度的時候取得顧問平均分數會發生錯誤的問題修正

---
 pamapi/src/main/java/com/pollex/pam/repository/SatisfactionRepository.java |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/repository/SatisfactionRepository.java b/pamapi/src/main/java/com/pollex/pam/repository/SatisfactionRepository.java
index 7763c51..98476e7 100644
--- a/pamapi/src/main/java/com/pollex/pam/repository/SatisfactionRepository.java
+++ b/pamapi/src/main/java/com/pollex/pam/repository/SatisfactionRepository.java
@@ -4,6 +4,8 @@
 import java.util.Optional;
 
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 import com.pollex.pam.domain.Satisfaction;
@@ -16,4 +18,10 @@
 	List<Satisfaction> findByCustomerId(Long customerId);
 
 	Optional<Satisfaction> findOneByAppointmentId(Long appointmentId);
+
+	@Query(value = "SELECT avg(score) FROM satisfaction where agent_no=:agent_no"
+			+ " and score is not null"
+			, nativeQuery = true)
+	Float getAgentScoreAvg(@Param("agent_no") String agentNo);
 }
+	
\ No newline at end of file

--
Gitblit v1.8.0