<?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.yida.data.form.apply.mapper.CoreApplyFormApprovalProcessMapper">

    <!-- 查询表单对应的审核流程 -->
    <select id="selectApplyFormApprovalProcess"
            resultType="com.yida.data.common.core.entity.applyForm.CoreApprovalProcess">
        SELECT
            ap.*
        FROM
            core_apply_form_approval_process p
        INNER JOIN core_approval_process ap ON p.approval_process_id = ap.id
        WHERE
            p.del_flag = 0
          AND ap.del_flag = 0
          AND p.apply_form_id = #{applyFormId}
        ORDER BY
            p.sort
    </select>

    <!-- 查询表单对应的审核流程页面数据 -->
    <select id="listFormApprovalProcess"
            resultType="com.yida.data.customForm.vo.apply.ApplyFormProcessSelectVO">
        SELECT
            ap.id as approvalProcessId,
            ap.*
        FROM
            core_apply_form_approval_process p
                INNER JOIN core_approval_process ap ON p.approval_process_id = ap.id
        WHERE
            p.del_flag = 0
          AND ap.del_flag = 0
          AND p.apply_form_id = #{formId}
        ORDER BY
            p.sort
    </select>

</mapper>
