<?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.system.mapper.FlowVarInstMapper">

    <resultMap type="FlowVarInst" id="FlowVarInstResult">
        <result property="procInstId"    column="PROC_INST_ID_"    />
        <result property="name"    column="NAME_"    />
        <result property="text"    column="TEXT_"    />
        <result property="createTime"    column="CREATE_TIME_"    />
    </resultMap>

    <sql id="selectFlowVarInstVo">
        select PROC_INST_ID_, NAME_, TEXT_, CREATE_TIME_ from ACT_HI_VARINST
    </sql>

    <select id="selectProcInstByVar" parameterType="FlowVarInst" resultMap="FlowVarInstResult">
        <include refid="selectFlowVarInstVo"/>
        <where>
            NAME_ = 'formId' and TEXT_ = #{param}
        </where>
        order by CREATE_TIME_ asc
    </select>

    <select id="selectVarByProcInsId" parameterType="FlowVarInst" resultMap="FlowVarInstResult">
        <include refid="selectFlowVarInstVo"/>
        <where>
            PROC_INST_ID_ = #{param} and LENGTH(TEXT_) = 19
        </where>
    </select>

</mapper>