<?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.project.business.mapper.TjElevatorFloorParaMapper">

    <resultMap type="TjElevatorFloorPara" id="TjElevatorFloorParaResult">
        <result property="id" column="id"/>
        <result property="elevatorId" column="elevator_id"/>
        <result property="floorDisplay" column="floor_display"/>
        <result property="floorHeight" column="floor_height"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectTjElevatorFloorParaVo">
        select id,
               elevator_id,
               floor_display,
               floor_height,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               remark
        from tj_elevator_floor_para
    </sql>

    <select id="selectTjElevatorFloorParaList" parameterType="TjElevatorFloorPara"
        resultMap="TjElevatorFloorParaResult">
        <include refid="selectTjElevatorFloorParaVo"/>
        <where>
            <if test="elevatorId != null ">and elevator_id = #{elevatorId}</if>
            <if test="floorDisplay != null  and floorDisplay != ''">and floor_display = #{floorDisplay}</if>
            <if test="floorHeight != null  and floorHeight != ''">and floor_height = #{floorHeight}</if>
        </where>
    </select>

    <select id="selectTjElevatorFloorParaById" parameterType="Long" resultMap="TjElevatorFloorParaResult">
        <include refid="selectTjElevatorFloorParaVo"/>
        where id = #{id}
    </select>

    <insert id="insertTjElevatorFloorPara" parameterType="TjElevatorFloorPara" useGeneratedKeys="true" keyProperty="id">
        insert into tj_elevator_floor_para
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="elevatorId != null">elevator_id,</if>
            <if test="floorDisplay != null and floorDisplay != ''">floor_display,</if>
            <if test="floorHeight != null">floor_height,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="elevatorId != null">#{elevatorId},</if>
            <if test="floorDisplay != null and floorDisplay != ''">#{floorDisplay},</if>
            <if test="floorHeight != null">#{floorHeight},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateTjElevatorFloorPara" parameterType="TjElevatorFloorPara">
        update tj_elevator_floor_para
        <trim prefix="SET" suffixOverrides=",">
            <if test="elevatorId != null">elevator_id = #{elevatorId},</if>
            <if test="floorDisplay != null and floorDisplay != ''">floor_display = #{floorDisplay},</if>
            <if test="floorHeight != null">floor_height = #{floorHeight},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTjElevatorFloorParaById" parameterType="Long">
        delete
        from tj_elevator_floor_para
        where id = #{id}
    </delete>

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