使用JPA重构DAO层
This commit is contained in:
parent
ccc39aed33
commit
62d95a3b6d
@ -1,14 +1,12 @@
|
||||
package com.example.springdemo.dao;
|
||||
|
||||
import com.example.springdemo.entities.Merchants;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MerchantsRepository extends JpaRepository<Merchants, Long> {
|
||||
List<Merchants> findByName(String name);
|
||||
void deleteById(@NotNull Long id);
|
||||
public interface MerchantsRepository
|
||||
extends JpaRepository<Merchants, Long> {
|
||||
Merchants findByName(String name);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.example.springdemo.dao;
|
||||
|
||||
import com.example.springdemo.entities.Users;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface UsersRepository
|
||||
extends JpaRepository<Users, Long> {
|
||||
Users findByName(String name);
|
||||
}
|
Loading…
Reference in New Issue
Block a user