<?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="cn.edu.whu.boot.statistics.mapper.BasicStatMapper">


    <select id="getTasks" resultType="String">
        select task_name from task
    </select>

    <select id="getTaskXmlName" resultType="String">
        SELECT file_name FROM "xml"
        WHERE id = (SELECT xml_id FROM task WHERE task_name = #{tskName})
    </select>

    <select id="getTaskDBName" resultType="String">
        SELECT database_name FROM task WHERE task_name = #{tskName}
    </select>

    <select id="stat" resultType="HashMap">
        SELECT ${groupField}, AVG(${statField}), MAX(${statField}), MIN(${statField}), COUNT(${statField}), SUM(${statField}) FROM ${tblName} GROUP BY ${groupField}
    </select>

</mapper>