<?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.BusDeviceRunningMapper">
    
    <resultMap type="BusDeviceRunning" id="BusDeviceRunningResult">
        <result property="id"    column="id"    />
        <result property="json"    column="json"    />
    </resultMap>

    <sql id="selectBusDeviceRunningVo">
        select id, json from bus_device_running
    </sql>

    <select id="selectBusDeviceRunningList" parameterType="BusDeviceRunning" resultMap="BusDeviceRunningResult">
        <include refid="selectBusDeviceRunningVo"/>
        <where>  
            <if test="json != null  and json != ''"> and json = #{json}</if>
        </where>
    </select>
    
    <select id="selectBusDeviceRunningById" parameterType="Long" resultMap="BusDeviceRunningResult">
        <include refid="selectBusDeviceRunningVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBusDeviceRunning" parameterType="BusDeviceRunning">
        insert into bus_device_running
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="json != null">json,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="json != null">#{json},</if>
         </trim>
    </insert>

    <update id="updateBusDeviceRunning" parameterType="BusDeviceRunning">
        update bus_device_running
        <trim prefix="SET" suffixOverrides=",">
            <if test="json != null">json = #{json},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBusDeviceRunningById" parameterType="Long">
        delete from bus_device_running where id = #{id}
    </delete>

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