package com.sky.ioc.mapper;

import com.sky.ioc.entity.params.IocParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface FitnesMapper {


    @Select("<script>" +
            "SELECT count(1) FROM fitnes where 1=1 " +
            "<if test='warehouse!=null '>" +
            " and warehouse = #{warehouse} " +
            "</if>"+
            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
            " and time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
            "</if>"+
            "</script>")
    Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam,@Param("warehouse") Integer warehouse);

    @Select("<script>" +
            "SELECT count(1) FROM fitnes where 1=1 " +

            "<if test='fitnesType!=null '>" +
            " and fitnes_type = #{fitnesType} " +
            "</if>"+
            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
            " and time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
            "</if>"+
            "</script>")
    Integer getTotalPersonByCompanyIdAndDeptIdAndFitnesType(@Param("iocParam") IocParam iocParam,@Param("fitnesType") Integer fitnesType);
    @Select("<script>" +
            "SELECT count(1) FROM fitnes where 1=1 " +
            "<if test='warehouse!=null '>" +
            " and warehouse = #{warehouse} " +
            "</if>"+
            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
            " and time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
            "</if>"+
            "</script>")
    Integer getTotalPersonByCompanyIdAndDeptIdAndWarehouse(@Param("iocParam") IocParam iocParam,@Param("warehouse") String warehouse);

}
