<?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.InspectionPickCarMapper">

    <resultMap type="cn.iocoder.yudao.module.inspection.entity.InspectionPickCar" id="InspectionPickCarResult">
        <result property="id"    column="id"    />
        <result property="partnerId"    column="partner_id"    />
        <result property="goodsTitle"    column="goods_title"    />
        <result property="userId"    column="user_id"    />
        <result property="orderId"    column="order_id"    />
        <result property="userPhone"    column="user_phone"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="adressDetail"    column="adress_detail"    />
        <result property="appointmentDay"    column="appointment_day"    />
        <result property="appointmentTime"    column="appointment_time"    />
        <result property="distance"    column="distance"    />
        <result property="needPrice"    column="need_price"    />
        <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="selectInspectionPickCarVo">
        select id, partner_id, goods_title, user_id, order_id, user_phone, longitude, latitude, adress_detail, appointment_day, appointment_time, distance, need_price, create_time, creator, update_time, updater from inspection_pick_car
    </sql>

    <select id="selectInspectionPickCarList" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionPickCar" resultMap="InspectionPickCarResult">
        <include refid="selectInspectionPickCarVo"/>
        <where>
            <if test="partnerId != null "> and partner_id = #{partnerId}</if>
            <if test="goodsTitle != null  and goodsTitle != ''"> and goods_title = #{goodsTitle}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="orderId != null "> and order_id = #{orderId}</if>
            <if test="userPhone != null  and userPhone != ''"> and user_phone = #{userPhone}</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="adressDetail != null  and adressDetail != ''"> and adress_detail = #{adressDetail}</if>
            <if test="appointmentDay != null  and appointmentDay != ''"> and appointment_day = #{appointmentDay}</if>
            <if test="appointmentTime != null  and appointmentTime != ''"> and appointment_time = #{appointmentTime}</if>
            <if test="distance != null "> and distance = #{distance}</if>
            <if test="needPrice != null "> and need_price = #{needPrice}</if>
        </where>
    </select>

    <select id="selectInspectionPickCarById" parameterType="Long" resultMap="InspectionPickCarResult">
        <include refid="selectInspectionPickCarVo"/>
        where id = #{id}
    </select>

    <insert id="insertInspectionPickCar" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionPickCar" useGeneratedKeys="true" keyProperty="id">
        insert into inspection_pick_car
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="partnerId != null">partner_id,</if>
            <if test="goodsTitle != null">goods_title,</if>
            <if test="userId != null">user_id,</if>
            <if test="orderId != null">order_id,</if>
            <if test="userPhone != null">user_phone,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="adressDetail != null">adress_detail,</if>
            <if test="appointmentDay != null">appointment_day,</if>
            <if test="appointmentTime != null">appointment_time,</if>
            <if test="distance != null">distance,</if>
            <if test="needPrice != null">need_price,</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="partnerId != null">#{partnerId},</if>
            <if test="goodsTitle != null">#{goodsTitle},</if>
            <if test="userId != null">#{userId},</if>
            <if test="orderId != null">#{orderId},</if>
            <if test="userPhone != null">#{userPhone},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="adressDetail != null">#{adressDetail},</if>
            <if test="appointmentDay != null">#{appointmentDay},</if>
            <if test="appointmentTime != null">#{appointmentTime},</if>
            <if test="distance != null">#{distance},</if>
            <if test="needPrice != null">#{needPrice},</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="updateInspectionPickCar" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionPickCar">
        update inspection_pick_car
        <trim prefix="SET" suffixOverrides=",">
            <if test="partnerId != null">partner_id = #{partnerId},</if>
            <if test="goodsTitle != null">goods_title = #{goodsTitle},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="orderId != null">order_id = #{orderId},</if>
            <if test="userPhone != null">user_phone = #{userPhone},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="adressDetail != null">adress_detail = #{adressDetail},</if>
            <if test="appointmentDay != null">appointment_day = #{appointmentDay},</if>
            <if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
            <if test="distance != null">distance = #{distance},</if>
            <if test="needPrice != null">need_price = #{needPrice},</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="deleteInspectionPickCarById" parameterType="Long">
        delete from inspection_pick_car where id = #{id}
    </delete>

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