<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yida.data.school.epidemic.mapper.EpidemicAccessFlowMapper">

    <select id="findAccessFlowList" resultType="com.yida.data.common.core.entity.epidemic.EpidemicAccessFlow">
    SELECT * FROM epidemic_access_flow
    WHERE 1 = 1
    <if test="type != null">
       and `type` = #{type}
    </if>
    <if test="num != null">
        and num = #{num}
    </if>
    <if test="deptId != null">
        and dept_id = #{deptId}
    </if>
    order by id desc
    </select>
    <select id="h5FindAccessFlowList"
            resultType="com.yida.data.common.core.entity.epidemic.EpidemicAccessFlow">
    SELECT
	SUM( num ) as num
    FROM
	`epidemic_access_flow`
    WHERE
	dept_id = #{deptId}
	<if test="type != null">
        and `type` = #{type}
    </if>
	AND `time` LIKE CONCAT('%',#{time},'%')
    </select>
    <select id="findLastOne" resultType="com.yida.data.common.core.entity.epidemic.EpidemicAccessFlow">
        select * from `epidemic_access_flow` where dept_id = #{deptId}
         <if test="type != null">
             and `type` =#{type}
         </if>
         order by `time` desc limit 1
    </select>
</mapper>
