<?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.xjrsoft.module.workflow.mapper.XjrWorkflowExtraMapper">
    <select id="myApproveRecord" parameterType="com.xjrsoft.module.workflow.dto.MyExaminePageDto" resultType="com.xjrsoft.module.workflow.vo.PendingTaskVo">
        SELECT t.id,
        t.serial_number,
        t.process_name,
        t.task_id,
        t.task_name,
        t.task_key,
        (select MAX(t1.current_progress) FROM xjr_workflow_extra t1 where t1.process_id = t.process_id) as current_progress,
        t.schema_id,
        t.schema_name,
        t.process_id,
        t.start_user_id,
        t.start_user_name,
        t.start_time,
        t.end_time,
        t.launch_time,
        t.approve_user_ids
        FROM xjr_workflow_extra t
        WHERE 1 = 1
        <if test="dto.taskIds != null and dto.taskIds.size() > 0">
            and t.task_id in
            <foreach item="taskId" index="index" collection="dto.taskIds" open="(" close=")" separator=",">
                #{taskId}
            </foreach>
        </if>
        <if test="dto.keyword != null and dto.keyword != ''">
            and (t.task_name like concat('%',#{dto.keyword}, '%')
            or t.process_name like concat('%',#{dto.keyword}, '%')
            or t.schema_name like concat('%',#{dto.keyword}, '%')
            or t.start_user_name like concat('%',#{dto.keyword}, '%')
            )
        </if>
    order by t.start_time DESC
    </select>

</mapper>