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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package common.repository;
import common.model.Menu;
import common.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
public interface UserRepository extends JpaRepository<User, Long> {
@Query(value="select * from user where email = ?1 and password = ?2 and del_flag is not true",nativeQuery=true)
User login(String email, String pwd);
@Query(value="select * from user where role = ?1 and del_flag is not true",nativeQuery=true)
List<User> findOneDepartment(Long role);
@Query(value="select * from user where del_flag is not true",nativeQuery=true)
List<User> findList();
@Query(value="select * from user where email = ?1 and del_flag is not true",nativeQuery=true)
User login(String email);
@Query(value="select * from user where email = ?1",nativeQuery=true)
User findByEmail(String email);
@Query(value="select * from user where del_flag is not true and (role = 2 or role = 3)",nativeQuery=true)
List<User> findSales();
@Query(value="SELECT * from `user` where del_flag is not true and role = ?1 ORDER BY role_type",nativeQuery=true)
List<User> findAllByRole(Long role);
@Query(value="SELECT * from `user` where role = ?1 ORDER BY role_type",nativeQuery=true)
List<User> findAllUserByRole(Long role);
@Query(value="SELECT * from `user` where role in ?1 ORDER BY role_type",nativeQuery=true)
List<User> findAllUserByRoles(List<Long> roles);
@Query(value="SELECT * from `user` where del_flag is not true and parent = ?1",nativeQuery=true)
List<User> findAllByParent(Long id);
@Query(value="SELECT * from `user` where parent = ?1",nativeQuery=true)
List<User> findByParent(Long id);
@Query(value="SELECT * from `user` where del_flag is not true and id in ?1",nativeQuery=true)
List<User> findAllByIds(List<Long> ids);
@Query(value="SELECT * from `user` where id in ?1",nativeQuery=true)
List<User> findByIds(List<Long> ids);
@Query(value="SELECT * from `user` where del_flag is not true and parent in ?1",nativeQuery=true)
List<User> findAllByParents(List<Long> ids);
@Query(value="SELECT * from `user` where parent in ?1",nativeQuery=true)
List<User> findByParents(List<Long> ids);
@Query(value="SELECT * from `user` where role = ?1",nativeQuery=true)
List<User> findListByRole(Long key);
}