package cn.stylefeng.guns.zjxl.dao;

import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/***
 * @ClassName: ZjxlBannerDao
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/10/30 17:28
 */
public interface ZjxlBannerDao extends PagingAndSortingRepository<ZjxlBanner, Long>, JpaSpecificationExecutor<ZjxlBanner> {

    @Query("select p from ZjxlBanner p where p.bannerId = ?1")
    ZjxlBanner findById(String id);

    @Modifying
    @Query("delete from ZjxlBanner p where p.bannerId = ?1")
    int deleteById(String id);

    @Modifying
    @Query("update ZjxlBanner a set a.bannerIsLine = ?2 where a.bannerId = ?1")
    int updateIsLine(String id, Integer isLine);
}
