spring data @query查询的使用,求指教
spring吧
全部回复
仅看楼主
level 1
strivefor_qyg 楼主
我现在的需求是查询出user表role=111的用户。因此我是需要写死的
但是写死了就有问题了。
这个是我不写死的代码,是可以的
@Query(nativeQuery = true, value = "select * from tpt_user where role = :role ")
public List<TptUser> findByRole(@Param("role") String role);
这个是我写死后的,就报错了不可以了。
@Query(nativeQuery = true, value = "select * from tpt_user where role = 111 ")
public List<TptUser> findByRole();

求各位指教
2017年12月18日 08点12分 1
1