package cn.ysk.cashier.repository.shop;

import javax.persistence.Tuple;
import cn.ysk.cashier.pojo.TbShopUserDutyDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author lyf
 */
public interface TbShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail,Integer> {


    @Query(value = "SELECT " +
            "sum( num ), " +
            "product_id " +
            "FROM " +
            "tb_shop_user_duty_detail " +
            "WHERE " +
            "product_id IN :ids " +
            "GROUP BY " +
            "product_id",nativeQuery = true)
    List<Object[]> searchUUserDutyDetail(@Param("ids") List<Integer> ids);
}
