<?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.jx.mapper.DriveSchoolCarRepairMapper">

    <resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolCarRepair" id="DriveSchoolCarRepairResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="carId"    column="car_id"    />
        <result property="carNo"    column="car_no"    />
        <result property="problem"    column="problem"    />
        <result property="content"    column="content"    />
        <result property="money"    column="money"    />
        <result property="createTime"    column="create_time"    />
        <result property="outTime"    column="out_time"    />
        <result property="creator"    column="creator"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updater"    column="updater"    />
        <result property="carsId"    column="carsId"    />
        <result property="carLong"    column="carLong"    />
        <result property="carRepair"    column="carRepair"    />
        <result property="carRepaired"    column="carRepaired"    />
        <result property="carExchange"    column="carExchange"    />
        <result property="carCheck"    column="carCheck"    />
        <result property="carExpert"    column="carExpert"    />
        <result property="carBian"    column="carBian"    />
        <result property="photo"    column="photo"    />
    </resultMap>

    <sql id="selectDriveSchoolCarRepairVo">
        select id, out_time,carBian,photo,carExpert,carCheck,carExchange,carRepaired,carRepair,carLong,carsId,user_id, car_id,car_no, user_name,problem, content, money, create_time, creator, update_time, updater from drive_school_car_repair
    </sql>

    <select id="selectDriveSchoolCarRepairList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCarRepair" resultMap="DriveSchoolCarRepairResult">
        <include refid="selectDriveSchoolCarRepairVo"/>
        <where>
            deleted = 0
            <if test="entity.userId != null "> and user_id = #{entity.userId}</if>
            <if test="entity.userName != null "> and user_name like concat('%',#{entity.userName},'%')</if>
            <if test="entity.carId != null "> and car_id = #{entity.carId}</if>
            <if test="entity.carNo != null "> and car_no like concat('%',#{entity.carNo},'%')</if>
            <if test="entity.problem != null  and entity.problem != ''"> and problem = #{entity.problem}</if>
            <if test="entity.content != null  and entity.content != ''"> and content = #{entity.content}</if>
            <if test="entity.money != null "> and money = #{entity.money}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectDriveSchoolCarRepairListAll" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCarRepair" resultMap="DriveSchoolCarRepairResult">
        <include refid="selectDriveSchoolCarRepairVo"/>
        <where>
            deleted = 0
            <if test="entity.userId != null "> and user_id = #{entity.userId}</if>
            <if test="entity.userName != null "> and user_name like concat('%',#{entity.userName},'%')</if>
            <if test="entity.carId != null "> and car_id = #{entity.carId}</if>
            <if test="entity.carNo != null "> and car_no like concat('%',#{entity.carNo},'%')</if>
            <if test="entity.problem != null  and entity.problem != ''"> and problem = #{entity.problem}</if>
            <if test="entity.content != null  and entity.content != ''"> and content = #{entity.content}</if>
            <if test="entity.money != null "> and money = #{entity.money}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectDriveSchoolCarRepairById" parameterType="String" resultMap="DriveSchoolCarRepairResult">
        <include refid="selectDriveSchoolCarRepairVo"/>
        where id = #{id}
    </select>

    <insert id="insertDriveSchoolCarRepair" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCarRepair">
        insert into drive_school_car_repair
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="userId != null">user_id,</if>
            <if test="userName != null">user_name,</if>
            <if test="carId != null">car_id,</if>
            <if test="carNo != null">car_no,</if>
            <if test="problem != null and problem != ''">problem,</if>
            <if test="content != null and content != ''">content,</if>
            <if test="money != null">money,</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="carBian != null">carBian,</if>
            <if test="carExpert != null">carExpert,</if>
            <if test="carCheck != null">carCheck,</if>
            <if test="carExchange != null">carExchange,</if>
            <if test="carRepaired != null">carRepaired,</if>
            <if test="carRepair != null">carRepair,</if>
            <if test="carLong != null">carLong,</if>
            <if test="carsId != null">carsId,</if>
            <if test="outTime != null">out_time,</if>
            <if test="photo != null">photo,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="userId != null">#{userId},</if>
            <if test="userName != null">#{userName},</if>
            <if test="carId != null">#{carId},</if>
            <if test="carNo != null">#{carNo},</if>
            <if test="problem != null and problem != ''">#{problem},</if>
            <if test="content != null and content != ''">#{content},</if>
            <if test="money != null">#{money},</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="carBian != null">#{carBian},</if>
            <if test="carExpert != null">#{carExpert},</if>
            <if test="carCheck != null">#{carCheck},</if>
            <if test="carExchange != null">#{carExchange},</if>
            <if test="carRepaired != null">#{carRepaired},</if>
            <if test="carRepair != null">#{carRepair},</if>
            <if test="carLong != null">#{carLong},</if>
            <if test="carsId != null">#{carsId},</if>
            <if test="outTime != null">#{outTime},</if>
            <if test="photo != null">#{photo},</if>
         </trim>
    </insert>

    <update id="updateDriveSchoolCarRepair" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCarRepair">
        update drive_school_car_repair
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="userName != null">user_name = #{userName},</if>
            <if test="carId != null">car_id = #{carId},</if>
            <if test="carNo != null">car_no = #{carNo},</if>
            <if test="problem != null and problem != ''">problem = #{problem},</if>
            <if test="content != null and content != ''">content = #{content},</if>
            <if test="money != null">money = #{money},</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="carsId != null">carsId = #{carsId},</if>
            <if test="carLong != null">carLong = #{carLong},</if>
            <if test="carRepair != null">carRepair = #{carRepair},</if>
            <if test="carRepaired != null">carRepaired = #{carRepaired},</if>
            <if test="carExchange != null">carExchange = #{carExchange},</if>
            <if test="carCheck != null">carCheck = #{carCheck},</if>
            <if test="carExpert != null">carExpert = #{carExpert},</if>
            <if test="carBian != null">carBian = #{carBian},</if>
            <if test="photo != null">photo = #{photo},</if>
            <if test="outTime != null">out_time = #{outTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDriveSchoolCarRepairById" parameterType="Long">
        delete from drive_school_car_repair where id = #{id}
    </delete>

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