<?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.sqx.modules.taskCenter.dao.TaskCenterRecordDao">


    <select id="countTaskNum" resultType="Integer">
        SELECT
        count(*)
        FROM
        task_center_record record
        WHERE
        record.user_id = #{userId}
        AND record.task_id = #{taskId}
        <if test="time !=null and time != ''">
            and create_time > #{time}
        </if>
    </select>


    <select id="countTaskNumByUserIds" resultType="com.sqx.modules.taskCenter.entity.TaskCenterRecord">
        SELECT
        record.id
        FROM
        task_center_record record
        WHERE
        record.user_id in
        <foreach collection="userId" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
        AND record.task_id = #{taskId}
        <if test="time !=null and time != ''">
            and create_time > #{time}
        </if>
        limit 1
    </select>

</mapper>