使用JPA重构DAO层
This commit is contained in:
parent
ccc39aed33
commit
62d95a3b6d
@ -1,14 +1,12 @@
|
|||||||
package com.example.springdemo.dao;
|
package com.example.springdemo.dao;
|
||||||
|
|
||||||
import com.example.springdemo.entities.Merchants;
|
import com.example.springdemo.entities.Merchants;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface MerchantsRepository extends JpaRepository<Merchants, Long> {
|
public interface MerchantsRepository
|
||||||
List<Merchants> findByName(String name);
|
extends JpaRepository<Merchants, Long> {
|
||||||
void deleteById(@NotNull Long id);
|
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