1.定义数据表Dao层接口的包
2.定义对AdUser的接口
package com.imooc.ad.dao;
import com.imooc.ad.entity.AdUser;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AdUserRepository extends JpaRepository<AdUser, Long> {
/**
* <h2>根据用户名查找用户记录</h2>
* */
AdUser findByUsername(String username);
}
3.定义对AdPlan的接口
package com.imooc.ad.dao;
import com.imooc.ad.entity.AdPlan;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface AdPlanRepository extends JpaRepository<AdPlan, Long> {
AdPlan findByIdAndUserId(Long id, Long userId);
List<AdPlan> findAllByIdInAndUserId(List<Long> ids, Long userId);
AdPlan findByUserIdAndPlanName(Long userI