<?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="cn.iocoder.yudao.module.inspection.mapper.InspectionHomePartnerMapper">



    <select id="selectInspectionHomePartnerList" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionHomePartner" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionHomePartner">
        select * from inspection_home_goods
        <where>
            <if test="goodsId != null "> and goods_id = #{goodsId}</if>
            <if test="orderNum != null "> and order_num = #{orderNum}</if>
            <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
        </where>
    </select>

    <select id="selectInspectionHomePartnerById" parameterType="Long"  resultType="cn.iocoder.yudao.module.inspection.entity.InspectionHomePartner">
            select * from inspection_home_goods
        where id = #{id}
    </select>

    <insert id="insertInspectionHomePartner" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionHomePartner">
        insert into inspection_home_goods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="goodsId != null">goods_id,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="reason != null">reason,</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="goodsId != null">#{goodsId},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="reason != null">#{reason},</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="updateInspectionHomePartner" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionHomePartner">
        update inspection_home_goods
        <trim prefix="SET" suffixOverrides=",">
            <if test="goodsId != null">goods_id = #{goodsId},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="reason != null">reason = #{reason},</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="deleteInspectionHomePartnerById" parameterType="Long">
        delete from inspection_home_goods where goods_id = #{id}
    </delete>

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