<?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.zcloud.domain.persistence.mapper.ProjectTaskScoreInfoMapper">
    <select id="getListByUserIdList" resultType="com.zcloud.domain.persistence.dataobject.ProjectTaskScoreInfoDO">
        select ts.*
            from project_task_score_info ts
            left join project_task pt on pt.project_task_id = ts.project_task_id
            left join user u on ts.user_id=u.id
            where pt.delete_enum = 'false'
            and ts.delete_enum = 'false'
            and pt.execute_status != 4
            and ts.user_id in
            <foreach collection="userIdList" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        group by pt.id
    </select>
    <select id="getListByTaskId" resultType="com.zcloud.domain.persistence.dataobject.ProjectTaskScoreInfoDO">
        select ts.*, d.name as departmentName, u.name as userName,c.corp_name as corpinfoName,c.id as corpinfoId
        from project_task_score_info ts
                 left join department d on ts.department_id = d.id
                 left join corp_info c on d.corpinfo_id = c.id
                 left join user u on ts.user_id = u.id
        where ts.delete_enum = 'false'
          and ts.project_task_id=#{projectTaskId}
        group by ts.id
        order by ts.create_time desc
    </select>
</mapper>

