package com.yihu.jw.base.dao.equipment;

import com.yihu.jw.entity.equipment.WlyyUserAreaDO;
import com.yihu.jw.entity.equipment.WlyyUserEquipmentDO;
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 java.util.List;

public interface WlyyUserEquipmentDao extends PagingAndSortingRepository<WlyyUserEquipmentDO, String>, JpaSpecificationExecutor<WlyyUserEquipmentDO> {

    @Modifying
    @Query("delete from WlyyUserEquipmentDO p where p.userId=?1 and del=1 ")
    void deleteByUserId(String userId);

    @Query("select id from WlyyUserEquipmentDO where userId = ?1 and del=1 ")
    List<WlyyUserEquipmentDO> findAllByUserId(String userId);
}
