-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmployeeRepositoryImpl.java
30 lines (26 loc) · 1.11 KB
/
EmployeeRepositoryImpl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.jlakshmi.ems.service;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import com.jlakshmi.ems.entity.Employee;
import com.jlakshmi.ems.repository.EmployeeRepositoryCustom;
public class EmployeeRepositoryImpl implements EmployeeRepositoryCustom {
@Autowired
private MongoTemplate mongoTemplate;
@Override
public Employee findBypanNumber(String panNumber) {
Query query = new Query(Criteria.where("panNumber").is(panNumber));
return mongoTemplate.findOne(query, Employee.class);
}
@Override
public Employee findByemail(String email) {
Query query = new Query(Criteria.where("email").is(email));
return mongoTemplate.findOne(query, Employee.class);
}
@Override
public Employee findByphoneNumber(String phoneNumber) {
Query query = new Query(Criteria.where("phoneNumber").is(phoneNumber));
return mongoTemplate.findOne(query, Employee.class);
}
}