<?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.FlowDeployMapper">
    

    <select id="selectDeployList" resultType="com.ruoyi.system.domain.FlowProcDefDto">

        SELECT
            rp.id_ as id,
            rp.deployment_id_ as deploymentId,
            rd.name_ as name,
            rd.category_ as category,
            rp.key_ as flowKey,
            rp.version_ as version,
            rp.suspension_state_ as suspensionState,
            rd.deploy_time_  as deploymentTime
        FROM
            ACT_RE_PROCDEF rp
                LEFT JOIN ACT_RE_DEPLOYMENT rd ON rp.deployment_id_ = rd.id_
        <where>
            <if test="name != null and name != ''">
               and rd.name_ like concat('%', #{name}, '%')
            </if>
        </where>
        order by rd.id_ asc
    </select>

    <select id="selectDeployListById" resultType="com.ruoyi.system.domain.FlowProcDefDto">

        SELECT
            rp.id_ as id,
            rp.DEPLOYMENT_ID_ as deploymentId,
            rd.NAME_ as name,
            rd.CATEGORY_ as category,
            rp.KEY_ as flowKey,
            rp.VERSION_ as version,
            rp.SUSPENSION_STATE_ as suspensionState,
            rd.DEPLOY_TIME_  as deploymentTime
        FROM
            ACT_RE_PROCDEF rp
                LEFT JOIN ACT_RE_DEPLOYMENT rd ON rp.DEPLOYMENT_ID_ = rd.ID_
        where rd.ID_ = #{param}
        order by rd.ID_ asc
    </select>


</mapper>