| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import com.pollex.pam.enums.SatisfactionStatusEnum; |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | |
| | | @Repository |
| | | public interface SatisfactionRepository extends JpaRepository<Satisfaction, Long>{ |
| | | |
| | | List<Satisfaction> findByAgentNo(String agentNo); |
| | | List<Satisfaction> findByAgentNoAndType(String agentNo, SatisfactionTypeEnum type); |
| | | |
| | | List<Satisfaction> findByCustomerId(Long customerId); |
| | | |
| | | Optional<Satisfaction> findOneByAppointmentId(Long appointmentId); |
| | | Optional<Satisfaction> findOneByAppointmentIdAndType(Long appointmentId, SatisfactionTypeEnum type); |
| | | |
| | | @Query(value = "SELECT avg(score) FROM satisfaction where agent_no=:agent_no" |
| | | List<Satisfaction> findAllByStatusAndType(SatisfactionStatusEnum status, SatisfactionTypeEnum type); |
| | | |
| | | @Query(value = "SELECT avg(score) FROM satisfaction where type='APPOINTMENT'" |
| | | + " and agent_no=:agent_no" |
| | | + " and score is not null" |
| | | , nativeQuery = true) |
| | | Float getAgentScoreAvg(@Param("agent_no") String agentNo); |
| | | Optional<Float> getAgentScoreAvg(@Param("agent_no") String agentNo); |
| | | } |
| | | |