<?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.fjhx.mapper.example.ExampleInfoMapper">

    <select id="getWaitingProcessingPage" resultType="java.util.Map">
        SELECT pi.`code`            flowCode,
               pi.module_name       moduleName,
               ei.title             flowTitle,
               ei.create_user       createUser,
               ei.create_time       createTime,
               ei.id                flowId,
               ei.flow_link_no      flowLinkNo,
               ei.process_tenant_id processTenantId
        FROM example_info ei
                 LEFT JOIN process_info pi ON ei.process_info_id = pi.id
            ${ew.customSqlSegment}
    </select>

    <select id="getDone" resultType="java.util.LinkedHashMap">
        select ei.id,
               ei.title,
               ei.flow_link_no      flowLinkNo,
               pi.flow_name         name,
               ei.create_time       createTime,
               ei.create_user       createUser,
               ei.update_user       updateUser,
               ei.process_node_id   processNodeId,
               ei.process_node_code processNodeCode,
               ei.handle_result     handleResult,
               ei.complete,
               pi.code
        from example_info ei
                 inner join
             (
                 select distinct ed.example_info_id
                 from example_details ed
                 where ed.create_user = #{userId}
                   and ed.del_flag = 0
             ) t on ei.id = t.example_info_id
                 inner join process_info pi on pt.process_info_id = pi.id
            ${ew.customSqlSegment}
    </select>

</mapper>
