<?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.ruoyi.platform.mapper.AssetWorkflowDao">
    <insert id="insert">
        insert into asset_workflow(workflow_id, workflow_name, asset_id, asset_version, type)
        values (#{assetWorkflow.workflowId}, #{assetWorkflow.workflowName}, #{assetWorkflow.assetId},
                #{assetWorkflow.assetVersion},
                #{assetWorkflow.type})
    </insert>

    <update id="deleteByWorkFlowId">
        update asset_workflow
        set state = 0
        where workflow_id = #{workflowId}
    </update>

    <select id="getAssetWorkflow" resultType="com.ruoyi.platform.domain.AssetWorkflow">
        select * from asset_workflow
        where asset_id = #{assetId}
        and state = 1
        and type = #{type}
        <if test="assetVersion != null and assetVersion != ''">
            and asset_version = #{assetVersion}
        </if>
    </select>
</mapper>

