<?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="jnpf.cultivate.mapper.TeachingApproveMapper">

    <!-- 旧数据维护: 生成以前带教的审批数据 -->
    <insert id="generateOldApproveData">
        INSERT INTO ftb_cultivate_teaching_approve (
            F_Id,
            F_TeachId,
            F_ApproveStatus,
            F_CreatorUserId,
            F_CreatorTime,
            F_LastModifyUserId,
            F_LastModifyTime
        )
        SELECT
            ROW_NUMBER() OVER (ORDER BY t.F_Id) + 1000000000 AS F_Id,
                t.F_Id AS F_TeachId,
            1 AS F_ApproveStatus,
            t.F_CreatorUserId,
            t.F_CreatorTime,
            t.F_CreatorUserId AS F_LastModifyUserId,
            t.F_CreatorTime AS F_LastModifyTime
        FROM ftb_cultivate_teaching_record t
        WHERE t.F_Type = 1 AND t.F_DeleteMark = 0
    </insert>
</mapper>