package com.fdkankan.goods.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fdkankan.goods.entity.CameraDetail;
import com.fdkankan.goods.entity.CameraDetailNumEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 相机子表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2021-12-24
 */
@Mapper
public interface ICameraDetailMapper extends BaseMapper<CameraDetail> {


    @Select("SELECT type as cameraType,count(1) as cameraTypenum FROM t_camera_detail " +
            "WHERE user_id = #{userId} and type = #{type} GROUP BY type ")
    List<CameraDetailNumEntity> selectTypeNum(@Param("userId") Long userId, @Param("type") Integer type);

    @Select("SELECT type as cameraType,count(1) as cameraTypenum FROM t_camera_detail " +
            "WHERE user_id = #{userId}  GROUP BY type ")
    List<CameraDetailNumEntity> selectTypeNumAll(@Param("userId") Long userId);
}
