<?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.xintong.visualinspection.dao.master.UserCountDao" >
    <resultMap id="BaseResultMap" type="com.xintong.visualinspection.pojo.UserClassCount" >
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="user_id" property="user_id" jdbcType="INTEGER" />
        <result column="class_type" property="class_type" jdbcType="INTEGER" />
        <result column="class_id" property="class_id" jdbcType="INTEGER" />
        <result column="unregular_id" property="unregular_id" jdbcType="INTEGER" />
        <result column="period_id" property="period_id" jdbcType="INTEGER" />
        <result column="create_time" property="create_time" jdbcType="TIMESTAMP" />
        <result column="start_time" property="start_time" jdbcType="TIMESTAMP" />
        <result column="end_time" property="end_time" jdbcType="TIMESTAMP" />
        <result column="check_status" property="check_status" jdbcType="INTEGER" />
    </resultMap>

    <select id="getAll" parameterType="com.xintong.visualinspection.pojo.TeamClass" resultMap="BaseResultMap"   >

        SELECT *
        FROM (select `check_task`.`id` AS `id`, `check_task`.`check_status` AS `check_status` ,`check_task`.`checked_person` AS `user_id`,`check_task`.`class_type` AS `class_type`,`check_task`.`period_id` AS `period_id`,`check_task`.`create_time` AS `create_time`,`check_task`.`user_class_id` AS `class_id`,`check_task`.`user_class_unregular_id` AS `unregular_id`,`check_task`.`start_time` AS `start_time`,`check_task`.`end_time` AS `end_time` from `check_task`) a where a.user_id = #{user_id} and  a.start_time &gt;= #{start_time} and a.end_time &lt;= #{end_time}
    </select>

    <select id="getAllByPeriodId" parameterType="java.lang.Long" resultMap="BaseResultMap"   >

        SELECT *
        FROM v_user_count where period_id = #{period_id}
    </select>

    <select id="getByUserId" parameterType="java.lang.Long" resultMap="BaseResultMap" >
        SELECT *
        FROM v_user_count
        WHERE user_id = #{user_id}
    </select>





</mapper>