<?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.system.mapper.EduHotWordMapper">

    <select id="findHotWord" resultType="com.yida.data.common.core.entity.system.EduHotWord">
        SELECT
        COUNT( id ) num,
        word,
        `type`
        FROM
        `edu_hot_word`
        WHERE
        word IN ( SELECT DISTINCT word FROM `edu_hot_word` )
        <if test="type != null">
            and `type` = #{type}
        </if>
        <if test="deptId != null">
            and `dept_id` = #{deptId}
        </if>
        GROUP BY
        word,`type`,
		dept_id
        ORDER BY num desc
        LIMIT #{num}
    </select>
</mapper>
