select id,
               script_type,
               targetid,
               group_name,
               targetname,
               score,
               prompt,
               targettype,
               targetoptions,
               scriptid,
               branch_flag,
               branch_nextscriptno,
               svyid,
               scriptno,
               next_scriptno,
               script_desc,
               tag,
               next_scriptno,
               sort,
               ismandatory,
               ishide,
               del_flag,
               orgid,
               create_by,
               create_time,
               update_by,
               update_time,
               isupload,
               upload_time,
               pid,
               guid,
               categoryid,
               script_content,
               suitway,
               script_picture,
               script_topic,
               isavailable, language, otherdata, value_type, reply, scoretype
        from svy_lib_template_script
    
    
    
    
        insert into svy_lib_template_script
        
            next_scriptno,
            scriptid,
            script_type,
            scriptno,
            script_desc,
            tag,
            sort,
            ismandatory,
            ishide,
            del_flag,
            orgid,
            create_by,
            create_time,
            update_by,
            update_time,
            isupload,
            upload_time,
            pid,
            guid,
            categoryid,
            script_content,
            suitway,
            isavailable,
            language,
            otherdata,
            value_type,
            reply,
            scoretype,
            score,
            script_picture,
            script_topic,
            svyid,
            branch_flag,
            branch_nextscriptno,
            targetid,
            targetname,
            targettype,
            targetoptions,
            prompt,
            group_name,
        
        
            #{nextScriptno},
            #{scriptid},
            #{scriptType},
            #{scriptno},
            #{scriptDesc},
            #{tag},
            #{sort},
            #{ismandatory},
            #{ishide},
            #{delFlag},
            #{orgid},
            #{createBy},
            #{createTime},
            #{updateBy},
            #{updateTime},
            #{isupload},
            #{uploadTime},
            #{pid},
            #{guid},
            #{categoryid},
            #{scriptContent},
            #{suitway},
            #{isavailable},
            #{language},
            #{otherdata},
            #{valueType},
            #{reply},
            #{scoretype},
            #{score},
            #{scriptPicture},
            #{scriptTopic},
            #{svyid},
            #{branchFlag},
            #{branchNextscriptno},
            #{targetid},
            #{targetname},
            #{targettype},
            #{targetoptions},
            #{prompt},
            #{groupName},
        
    
    
        update svy_lib_template_script
        
            next_scriptno = #{nextScriptno},
            scriptid = #{scriptid},
            script_type = #{scriptType},
            scriptno = #{scriptno},
            script_desc = #{scriptDesc},
            tag = #{tag},
            sort = #{sort},
            ismandatory = #{ismandatory},
            ishide = #{ishide},
            del_flag = #{delFlag},
            orgid = #{orgid},
            create_by = #{createBy},
            create_time = #{createTime},
            update_by = #{updateBy},
            update_time = #{updateTime},
            isupload = #{isupload},
            upload_time = #{uploadTime},
            pid = #{pid},
            guid = #{guid},
            categoryid = #{categoryid},
            script_content = #{scriptContent},
            suitway = #{suitway},
            isavailable = #{isavailable},
            language = #{language},
            otherdata = #{otherdata},
            value_type = #{valueType},
            reply = #{reply},
            scoretype = #{scoretype},
            score = #{score},
            script_picture = #{scriptPicture},
            script_topic = #{scriptTopic},
            svyid = #{svyid},
            branch_flag = #{branchFlag},
            branch_nextscriptno =
                #{branchNextscriptno},
            
            targetid = #{targetid},
            targetname = #{targetname},
            targettype = #{targettype},
            targetoptions = #{targetoptions},
            prompt = #{prompt},
            group_name = #{groupName},
        
        where id = #{id}
    
    
        update svy_lib_template_script
        set del_flag=1
        where id = #{id}
    
    
        delete from svy_lib_template_script where id in
        
            #{id}