<?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.flowable.mapper.WfRoamHistoricalMapper">

    <resultMap type="WfRoamHistorical" id="WfRoamHistoricalResult">
        <result property="roamHistoricalId"    column="roam_historical_id"    />
        <result property="businessId"    column="business_id"    />
        <result property="processId"    column="process_id"    />
        <result property="businessProcessType"    column="business_process_type"    />
        <result property="data"    column="data"    />
    </resultMap>

    <sql id="selectWfRoamHistoricalVo">
        select roam_historical_id, business_id, process_id, business_process_type, data from wf_roam_historical
    </sql>

    <select id="selectWfRoamHistoricalList" parameterType="WfRoamHistorical" resultMap="WfRoamHistoricalResult">
        <include refid="selectWfRoamHistoricalVo"/>
        <where>
            <if test="roamHistoricalId != null  and roamHistoricalId != ''"> and roam_historical_id = #{roamHistoricalId}</if>
            <if test="businessId != null  and businessId != ''"> and business_id = #{businessId}</if>
            <if test="processId != null  and processId != ''"> and process_id = #{processId}</if>
            <if test="businessProcessType != null  and businessProcessType != ''"> and business_process_type = #{businessProcessType}</if>
        </where>
    </select>

    <select id="selectWfRoamHistoricalByRoamHistoricalId" parameterType="String" resultMap="WfRoamHistoricalResult">
        <include refid="selectWfRoamHistoricalVo"/>
        where roam_historical_id = #{roamHistoricalId}
    </select>

    <insert id="insertWfRoamHistorical" parameterType="WfRoamHistorical">
        insert into wf_roam_historical
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="roamHistoricalId != null and roamHistoricalId != ''">roam_historical_id,</if>
            <if test="businessId != null">business_id,</if>
            <if test="processId != null">process_id,</if>
            <if test="businessProcessType != null">business_process_type,</if>
            <if test="data != null">data,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="roamHistoricalId != null and roamHistoricalId != ''">#{roamHistoricalId},</if>
            <if test="businessId != null">#{businessId},</if>
            <if test="processId != null">#{processId},</if>
            <if test="businessProcessType != null">#{businessProcessType},</if>
            <if test="data != null">#{data},</if>
        </trim>
    </insert>

    <update id="updateWfRoamHistorical" parameterType="WfRoamHistorical">
        update wf_roam_historical
        <trim prefix="SET" suffixOverrides=",">
            <if test="businessId != null">business_id = #{businessId},</if>
            <if test="processId != null">process_id = #{processId},</if>
            <if test="businessProcessType != null">business_process_type = #{businessProcessType},</if>
            <if test="data != null">data = #{data},</if>
        </trim>
        where roam_historical_id = #{roamHistoricalId}
    </update>

    <delete id="deleteWfRoamHistoricalByRoamHistoricalId" parameterType="String">
        delete from wf_roam_historical where roam_historical_id = #{roamHistoricalId}
    </delete>

    <delete id="deleteWfRoamHistoricalByRoamHistoricalIds" parameterType="String">
        delete from wf_roam_historical where roam_historical_id in
        <foreach item="roamHistoricalId" collection="array" open="(" separator="," close=")">
            #{roamHistoricalId}
        </foreach>
    </delete>
</mapper>
