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

    <resultMap type="cn.iocoder.yudao.module.inspection.entity.DelInspectionInfo" id="DelInspectionInfoResult">
        <result property="id"    column="id"    />
        <result property="inspectionOrderId"    column="inspection_order_id"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="buyName"    column="buy_name"    />
        <result property="buyPhone"    column="buy_phone"    />
        <result property="userAddress"    column="user_address"    />
        <result property="unitName"    column="unit_name"    />
        <result property="partnerId"    column="partner_id"    />
        <result property="workId"    column="work_id"    />
        <result property="workerName"    column="worker_name"    />
        <result property="workerPhone"    column="worker_phone"    />
        <result property="workerAvatar"    column="worker_avatar"    />
        <result property="categoryId"    column="category_id"    />
        <result property="carNum"    column="car_num"    />
        <result property="carModel"    column="car_model"    />
        <result property="carNature"    column="car_nature"    />
        <result property="carStatus"    column="car_status"    />
        <result property="carIdNo"    column="car_id_no"    />
        <result property="isPass"    column="is_pass"    />
        <result property="isRetrial"    column="is_retrial"    />
        <result property="remark"    column="remark"    />
        <result property="customerSource"    column="customer_source"    />
        <result property="status"    column="status"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="makeCert"    column="make_cert"    />
        <result property="year"    column="year"    />
        <result property="month"    column="month"    />
        <result property="day"    column="day"    />
        <result property="createTime"    column="create_time"    />
        <result property="creator"    column="creator"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updater"    column="updater"    />
        <result property="nextMaintenanceDate"    column="next_maintenance_date"    />
        <result property="nextInspectionDate"    column="next_inspection_date"    />
        <result property="otherPhone"    column="other_phone"    />
        <result property="driverLicenesImg"    column="driver_licenes_img"    />
        <result property="isPayOnline"    column="is_pay_online"    />
        <result property="isPickCar"    column="is_pick_car"    />
    </resultMap>

    <sql id="selectDelInspectionInfoVo">
        select id, inspection_order_id, user_id, user_name, buy_name, buy_phone, user_address, unit_name, partner_id, work_id, worker_name, worker_phone, worker_avatar, category_id, car_num, car_model, car_nature, car_status, car_id_no, is_pass, is_retrial, remark, customer_source, status, start_time, end_time, make_cert, year, month, day, create_time, creator, update_time, updater, next_maintenance_date, next_inspection_date, other_phone, driver_licenes_img, is_pay_online, is_pick_car from del_inspection_info
    </sql>

    <select id="selectDelInspectionInfoList" parameterType="cn.iocoder.yudao.module.inspection.entity.DelInspectionInfo" resultMap="DelInspectionInfoResult">
        <include refid="selectDelInspectionInfoVo"/>
        <where>
            <if test="vo.inspectionOrderId != null "> and inspection_order_id = #{vo.inspectionOrderId}</if>
            <if test="vo.userId != null "> and user_id = #{vo.userId}</if>
            <if test="vo.userName != null  and userName != ''"> and user_name like concat('%', #{vo.userName}, '%')</if>
            <if test="vo.buyName != null  and buyName != ''"> and buy_name like concat('%', #{vo.buyName}, '%')</if>
            <if test="vo.buyPhone != null  and buyPhone != ''"> and buy_phone = #{vo.buyPhone}</if>
            <if test="vo.userAddress != null  and userAddress != ''"> and user_address = #{vo.userAddress}</if>
            <if test="vo.unitName != null  and unitName != ''"> and unit_name like concat('%', #{vo.unitName}, '%')</if>
            <if test="vo.partnerId != null "> and partner_id = #{vo.partnerId}</if>
            <if test="vo.workId != null "> and work_id = #{vo.workId}</if>
            <if test="vo.workerName != null  and workerName != ''"> and worker_name like concat('%', #{vo.workerName}, '%')</if>
            <if test="vo.workerPhone != null  and workerPhone != ''"> and worker_phone = #{vo.workerPhone}</if>
            <if test="vo.workerAvatar != null  and workerAvatar != ''"> and worker_avatar = #{vo.workerAvatar}</if>
            <if test="vo.categoryId != null "> and category_id = #{vo.categoryId}</if>
            <if test="vo.carNum != null  and carNum != ''"> and car_num = #{vo.carNum}</if>
            <if test="vo.carModel != null  and carModel != ''"> and car_model = #{vo.carModel}</if>
            <if test="vo.carNature != null  and carNature != ''"> and car_nature = #{vo.carNature}</if>
            <if test="vo.carStatus != null  and carStatus != ''"> and car_status = #{vo.carStatus}</if>
            <if test="vo.carIdNo != null  and carIdNo != ''"> and car_id_no = #{vo.carIdNo}</if>
            <if test="vo.isPass != null  and isPass != ''"> and is_pass = #{vo.isPass}</if>
            <if test="vo.isRetrial != null  and isRetrial != ''"> and is_retrial = #{vo.isRetrial}</if>
            <if test="vo.customerSource != null  and customerSource != ''"> and customer_source = #{vo.customerSource}</if>
            <if test="vo.status != null  and status != ''"> and status = #{vo.status}</if>
            <if test="vo.startTime != null "> and start_time = #{vo.startTime}</if>
            <if test="vo.endTime != null "> and end_time = #{vo.endTime}</if>
            <if test="vo.makeCert != null  and makeCert != ''"> and make_cert = #{vo.makeCert}</if>
            <if test="vo.year != null  and year != ''"> and year = #{vo.year}</if>
            <if test="vo.month != null  and month != ''"> and month = #{vo.month}</if>
            <if test="vo.day != null  and day != ''"> and day = #{vo.day}</if>
            <if test="vo.nextMaintenanceDate != null "> and next_maintenance_date = #{vo.nextMaintenanceDate}</if>
            <if test="vo.nextInspectionDate != null "> and next_inspection_date = #{vo.nextInspectionDate}</if>
            <if test="vo.otherPhone != null  and otherPhone != ''"> and other_phone = #{vo.otherPhone}</if>
            <if test="vo.driverLicenesImg != null  and driverLicenesImg != ''"> and driver_licenes_img = #{vo.driverLicenesImg}</if>
            <if test="vo.isPayOnline != null  and isPayOnline != ''"> and is_pay_online = #{vo.isPayOnline}</if>
            <if test="vo.isPickCar != null  and isPickCar != ''"> and is_pick_car = #{vo.isPickCar}</if>
        </where>
    </select>

    <select id="selectDelInspectionInfoById" parameterType="Long" resultMap="DelInspectionInfoResult">
        <include refid="selectDelInspectionInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertDelInspectionInfo" parameterType="cn.iocoder.yudao.module.inspection.entity.DelInspectionInfo" >
        insert into del_inspection_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="inspectionOrderId != null">inspection_order_id,</if>
            <if test="userId != null">user_id,</if>
            <if test="userName != null">user_name,</if>
            <if test="buyName != null">buy_name,</if>
            <if test="buyPhone != null">buy_phone,</if>
            <if test="userAddress != null">user_address,</if>
            <if test="unitName != null">unit_name,</if>
            <if test="partnerId != null">partner_id,</if>
            <if test="workId != null">work_id,</if>
            <if test="workerName != null">worker_name,</if>
            <if test="workerPhone != null">worker_phone,</if>
            <if test="workerAvatar != null">worker_avatar,</if>
            <if test="categoryId != null">category_id,</if>
            <if test="carNum != null">car_num,</if>
            <if test="carModel != null">car_model,</if>
            <if test="carNature != null">car_nature,</if>
            <if test="carStatus != null">car_status,</if>
            <if test="carIdNo != null">car_id_no,</if>
            <if test="isPass != null">is_pass,</if>
            <if test="isRetrial != null">is_retrial,</if>
            <if test="remark != null">remark,</if>
            <if test="customerSource != null">customer_source,</if>
            <if test="status != null">status,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="makeCert != null">make_cert,</if>
            <if test="year != null">year,</if>
            <if test="month != null">month,</if>
            <if test="day != null">day,</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>
            <if test="nextMaintenanceDate != null">next_maintenance_date,</if>
            <if test="nextInspectionDate != null">next_inspection_date,</if>
            <if test="otherPhone != null">other_phone,</if>
            <if test="driverLicenesImg != null">driver_licenes_img,</if>
            <if test="isPayOnline != null">is_pay_online,</if>
            <if test="isPickCar != null">is_pick_car,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="inspectionOrderId != null">#{inspectionOrderId},</if>
            <if test="userId != null">#{userId},</if>
            <if test="userName != null">#{userName},</if>
            <if test="buyName != null">#{buyName},</if>
            <if test="buyPhone != null">#{buyPhone},</if>
            <if test="userAddress != null">#{userAddress},</if>
            <if test="unitName != null">#{unitName},</if>
            <if test="partnerId != null">#{partnerId},</if>
            <if test="workId != null">#{workId},</if>
            <if test="workerName != null">#{workerName},</if>
            <if test="workerPhone != null">#{workerPhone},</if>
            <if test="workerAvatar != null">#{workerAvatar},</if>
            <if test="categoryId != null">#{categoryId},</if>
            <if test="carNum != null">#{carNum},</if>
            <if test="carModel != null">#{carModel},</if>
            <if test="carNature != null">#{carNature},</if>
            <if test="carStatus != null">#{carStatus},</if>
            <if test="carIdNo != null">#{carIdNo},</if>
            <if test="isPass != null">#{isPass},</if>
            <if test="isRetrial != null">#{isRetrial},</if>
            <if test="remark != null">#{remark},</if>
            <if test="customerSource != null">#{customerSource},</if>
            <if test="status != null">#{status},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="makeCert != null">#{makeCert},</if>
            <if test="year != null">#{year},</if>
            <if test="month != null">#{month},</if>
            <if test="day != null">#{day},</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>
            <if test="nextMaintenanceDate != null">#{nextMaintenanceDate},</if>
            <if test="nextInspectionDate != null">#{nextInspectionDate},</if>
            <if test="otherPhone != null">#{otherPhone},</if>
            <if test="driverLicenesImg != null">#{driverLicenesImg},</if>
            <if test="isPayOnline != null">#{isPayOnline},</if>
            <if test="isPickCar != null">#{isPickCar},</if>
         </trim>
    </insert>

    <update id="updateDelInspectionInfo" parameterType="cn.iocoder.yudao.module.inspection.entity.DelInspectionInfo">
        update del_inspection_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="inspectionOrderId != null">inspection_order_id = #{inspectionOrderId},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="userName != null">user_name = #{userName},</if>
            <if test="buyName != null">buy_name = #{buyName},</if>
            <if test="buyPhone != null">buy_phone = #{buyPhone},</if>
            <if test="userAddress != null">user_address = #{userAddress},</if>
            <if test="unitName != null">unit_name = #{unitName},</if>
            <if test="partnerId != null">partner_id = #{partnerId},</if>
            <if test="workId != null">work_id = #{workId},</if>
            <if test="workerName != null">worker_name = #{workerName},</if>
            <if test="workerPhone != null">worker_phone = #{workerPhone},</if>
            <if test="workerAvatar != null">worker_avatar = #{workerAvatar},</if>
            <if test="categoryId != null">category_id = #{categoryId},</if>
            <if test="carNum != null">car_num = #{carNum},</if>
            <if test="carModel != null">car_model = #{carModel},</if>
            <if test="carNature != null">car_nature = #{carNature},</if>
            <if test="carStatus != null">car_status = #{carStatus},</if>
            <if test="carIdNo != null">car_id_no = #{carIdNo},</if>
            <if test="isPass != null">is_pass = #{isPass},</if>
            <if test="isRetrial != null">is_retrial = #{isRetrial},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="customerSource != null">customer_source = #{customerSource},</if>
            <if test="status != null">status = #{status},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="makeCert != null">make_cert = #{makeCert},</if>
            <if test="year != null">year = #{year},</if>
            <if test="month != null">month = #{month},</if>
            <if test="day != null">day = #{day},</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>
            <if test="nextMaintenanceDate != null">next_maintenance_date = #{nextMaintenanceDate},</if>
            <if test="nextInspectionDate != null">next_inspection_date = #{nextInspectionDate},</if>
            <if test="otherPhone != null">other_phone = #{otherPhone},</if>
            <if test="driverLicenesImg != null">driver_licenes_img = #{driverLicenesImg},</if>
            <if test="isPayOnline != null">is_pay_online = #{isPayOnline},</if>
            <if test="isPickCar != null">is_pick_car = #{isPickCar},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDelInspectionInfoById" parameterType="Long">
        delete from del_inspection_info where id = #{id}
    </delete>

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