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

    <resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolInsurance" id="DriveSchoolInsuranceResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="userNames"    column="user_names"    />
        <result property="carId"    column="car_id"    />
        <result property="company"    column="company"    />
        <result property="content"    column="content"    />
        <result property="carNo"    column="car_no"    />
        <result property="money"    column="money"    />
        <result property="insuranceTime"    column="insurance_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="creator"    column="creator"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updater"    column="updater"    />
        <result property="attachments"    column="attachments"    />
    </resultMap>

    <sql id="selectDriveSchoolInsuranceVo">
        select id, user_names, user_id, car_id, user_name,car_no,company, content, money, insurance_time, create_time, creator, update_time, updater, attachments from drive_school_insurance
    </sql>

    <select id="selectDriveSchoolInsuranceList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolInsurance" resultMap="DriveSchoolInsuranceResult">
        <include refid="selectDriveSchoolInsuranceVo"/>
        <where>
            deleted = 0
            <if test="entity.userId != null "> and user_id = #{entity.userId}</if>
            <if test="entity.userName != null "> and user_name = #{entity.userName}</if>
            <if test="entity.carId != null "> and car_id = #{entity.carId}</if>
            <if test="entity.carNo != null "> and car_no = #{entity.carNo}</if>
            <if test="entity.company != null  and entity.company != ''"> and company = #{entity.company}</if>
            <if test="entity.content != null  and entity.content != ''"> and content = #{entity.content}</if>
            <if test="entity.money != null "> and money = #{entity.money}</if>
            <if test="entity.insuranceTime != null "> and insurance_time = #{entity.insuranceTime}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectDriveSchoolInsuranceById" parameterType="Long" resultMap="DriveSchoolInsuranceResult">
        <include refid="selectDriveSchoolInsuranceVo"/>
        where id = #{id}
    </select>



    <delete id="deleteDriveSchoolInsuranceById" parameterType="Long">
        delete from drive_school_insurance where id = #{id}
    </delete>

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