package cn.stylefeng.guns.zjxl.dao;

import cn.stylefeng.guns.zjxl.model.ZjxlCompanyCase;
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;
import org.springframework.web.bind.annotation.RequestMapping;

/***
 * @ClassName: ZjxlCompanyCaseDao
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/2 9:09
 */
public interface ZjxlCompanyCaseDao extends PagingAndSortingRepository<ZjxlCompanyCase, Long>, JpaSpecificationExecutor<ZjxlCompanyCase> {

    @Query("select a from ZjxlCompanyCase a where a.companyId = ?1")
    ZjxlCompanyCase findById(String id);

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

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