<?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.cf.imes.module.executor.dal.mysql.orderModuleExtra.OrderModuleExtraMapper">

    <insert id="insertOne" parameterType="com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO">
        INSERT INTO order_module_extra (id, order_id, organ_id, room_id, body_id, type, extra_data)
        VALUES (#{orderModuleExtraDO.id}, #{orderModuleExtraDO.orderId}, #{orderModuleExtraDO.organId}, #{orderModuleExtraDO.roomId}, #{orderModuleExtraDO.bodyId}, #{orderModuleExtraDO.type}, #{orderModuleExtraDO.extraData})
    </insert>

    <select id="selectExtraById" resultType="com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO">
        SELECT id, order_id, organ_id, room_id, body_id, type, extra_data
        FROM order_module_extra
        WHERE order_id = #{orderId}
        <if test="roomId != null">
            AND room_id = #{roomId}
        </if>
        <if test="bodyId != null">
            AND body_id = #{bodyId}
        </if>
    </select>

</mapper>