<?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.mcwl.resource.mapper.WorkFlowVersionMapper">


    <insert id="addWorkFlowVersion">
        INSERT INTO work_flow_version (version_name,version_description,file_path,image_paths,hide_gen_info,del_flag,
                                       work_flow_id,file_name,file_size,file_hash)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.versionName}, #{item.versionDescription}, #{item.filePath}, #{item.imagePaths},#{item.hideGenInfo},
             0,#{workFlow.id},#{item.fileName},#{item.fileSize},#{item.fileHash})
        </foreach>
    </insert>
    <update id="updateWorkFlowVersion">
--         update work_flow_version
    </update>
    <update id="updateByName">
        update work_flow_version set audit_status = #{auditStatus},
                                     audit_text = #{auditText}
        where version_name = #{versionName} and work_flow_id = #{workFlowId}
    </update>

    <select id="selectByFileName" resultType="com.mcwl.resource.domain.WorkFlowVersion">
        select key_rate,is_encrypt from work_flow_version where file_name = #{name}
    </select>

    <select id="selectByHash" resultType="com.mcwl.resource.domain.WorkFlowVersion">
        select * from work_flow_version where file_hash = #{hashCode}
    </select>
</mapper>
