<?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.payment.mapper.OrderInfoDetailMapper">

    <resultMap type="cn.iocoder.yudao.module.payment.entity.OrderInfoDetail" id="OrderInfoDetailResult">
        <result property="id"    column="id"    />
        <result property="orderId"    column="order_id"    />
        <result property="detailInfo"    column="detail_info"    />
        <result property="recordTime"    column="record_time"    />
        <result property="recordMoney"    column="record_money"    />
        <result property="recordType"    column="record_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="creator"    column="creator"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updater"    column="updater"    />
    </resultMap>

    <sql id="selectOrderInfoDetailVo">
        select id, order_id, detail_info, record_time, record_money, record_type, dept_id, create_time, creator, update_time, updater from order_info_detail
    </sql>

    <select id="selectOrderInfoDetailList" parameterType="cn.iocoder.yudao.module.payment.entity.OrderInfoDetail" resultMap="OrderInfoDetailResult">
        <include refid="selectOrderInfoDetailVo"/>
        <where>
            <if test="orderId != null "> and order_id = #{orderId}</if>
            <if test="detailInfo != null  and detailInfo != ''"> and detail_info = #{detailInfo}</if>
            <if test="recordTime != null "> and record_time = #{recordTime}</if>
            <if test="recordMoney != null "> and record_money = #{recordMoney}</if>
            <if test="recordType != null  and recordType != ''"> and record_type = #{recordType}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
        </where>
    </select>

    <select id="selectOrderInfoDetailById" parameterType="Long" resultMap="OrderInfoDetailResult">
        <include refid="selectOrderInfoDetailVo"/>
        where id = #{id}
    </select>

    <insert id="insertOrderInfoDetail" parameterType="cn.iocoder.yudao.module.payment.entity.OrderInfoDetail">
        insert into order_info_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="orderId != null">order_id,</if>
            <if test="detailInfo != null">detail_info,</if>
            <if test="recordTime != null">record_time,</if>
            <if test="recordMoney != null">record_money,</if>
            <if test="recordType != null">record_type,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="creator != null">creator,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updater != null">updater,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="orderId != null">#{orderId},</if>
            <if test="detailInfo != null">#{detailInfo},</if>
            <if test="recordTime != null">#{recordTime},</if>
            <if test="recordMoney != null">#{recordMoney},</if>
            <if test="recordType != null">#{recordType},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="creator != null">#{creator},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updater != null">#{updater},</if>
         </trim>
    </insert>

    <update id="updateOrderInfoDetail" parameterType="cn.iocoder.yudao.module.payment.entity.OrderInfoDetail">
        update order_info_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="orderId != null">order_id = #{orderId},</if>
            <if test="detailInfo != null">detail_info = #{detailInfo},</if>
            <if test="recordTime != null">record_time = #{recordTime},</if>
            <if test="recordMoney != null">record_money = #{recordMoney},</if>
            <if test="recordType != null">record_type = #{recordType},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="creator != null">creator = #{creator},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updater != null">updater = #{updater},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteOrderInfoDetailById" parameterType="Long">
        delete from order_info_detail where id = #{id}
    </delete>

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