147 lines
8.2 KiB
XML
147 lines
8.2 KiB
XML
<?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="com.muyu.authentication.mapper.VehicleMapper">
|
|
|
|
<resultMap type="com.muyu.many.domain.Vehicle" id="VehicleResult">
|
|
<result property="id" column="id" />
|
|
<result property="vin" column="vin" />
|
|
<result property="brand" column="brand" />
|
|
<result property="model" column="model" />
|
|
<result property="productionDate" column="production_date" />
|
|
<result property="bodyType" column="body_type" />
|
|
<result property="color" column="color" />
|
|
<result property="engineCapacity" column="engine_capacity" />
|
|
<result property="fuelType" column="fuel_type" />
|
|
<result property="transmission" column="transmission" />
|
|
<result property="driveType" column="drive_type" />
|
|
<result property="mileage" column="mileage" />
|
|
<result property="registrationDate" column="registration_date" />
|
|
<result property="licenseNumber" column="license_number" />
|
|
<result property="holder" column="holder" />
|
|
<result property="vehicleType" column="vehicle_type" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectVehicleVo">
|
|
select id, vin, brand, model, production_date, body_type, color, engine_capacity, fuel_type, transmission, drive_type, mileage, registration_date, license_number, holder, vehicle_type, create_by, create_time, update_by, update_time, remark from vehicle
|
|
</sql>
|
|
|
|
<select id="selectVehicleList" parameterType="com.muyu.many.domain.Vehicle" resultMap="VehicleResult">
|
|
<include refid="selectVehicleVo"/>
|
|
<where>
|
|
<if test="vin != null and vin != ''"> and vin = #{vin}</if>
|
|
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
|
<if test="model != null and model != ''"> and model = #{model}</if>
|
|
<if test="productionDate != null "> and production_date = #{productionDate}</if>
|
|
<if test="bodyType != null and bodyType != ''"> and body_type = #{bodyType}</if>
|
|
<if test="color != null and color != ''"> and color = #{color}</if>
|
|
<if test="engineCapacity != null "> and engine_capacity = #{engineCapacity}</if>
|
|
<if test="fuelType != null and fuelType != ''"> and fuel_type = #{fuelType}</if>
|
|
<if test="transmission != null and transmission != ''"> and transmission = #{transmission}</if>
|
|
<if test="driveType != null and driveType != ''"> and drive_type = #{driveType}</if>
|
|
<if test="mileage != null "> and mileage = #{mileage}</if>
|
|
<if test="registrationDate != null "> and registration_date = #{registrationDate}</if>
|
|
<if test="licenseNumber != null and licenseNumber != ''"> and license_number = #{licenseNumber}</if>
|
|
<if test="holder != null and holder != ''"> and holder = #{holder}</if>
|
|
<if test="vehicleType != null and vehicleType != ''"> and vehicle_type = #{vehicleType}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectVehicleById" parameterType="Long" resultMap="VehicleResult">
|
|
<include refid="selectVehicleVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertVehicle" parameterType="com.muyu.many.domain.Vehicle" useGeneratedKeys="true" keyProperty="id">
|
|
insert into vehicle
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="vin != null">vin,</if>
|
|
<if test="brand != null">brand,</if>
|
|
<if test="model != null">model,</if>
|
|
<if test="productionDate != null">production_date,</if>
|
|
<if test="bodyType != null">body_type,</if>
|
|
<if test="color != null">color,</if>
|
|
<if test="engineCapacity != null">engine_capacity,</if>
|
|
<if test="fuelType != null">fuel_type,</if>
|
|
<if test="transmission != null">transmission,</if>
|
|
<if test="driveType != null">drive_type,</if>
|
|
<if test="mileage != null">mileage,</if>
|
|
<if test="registrationDate != null">registration_date,</if>
|
|
<if test="licenseNumber != null">license_number,</if>
|
|
<if test="holder != null">holder,</if>
|
|
<if test="vehicleType != null">vehicle_type,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="vin != null">#{vin},</if>
|
|
<if test="brand != null">#{brand},</if>
|
|
<if test="model != null">#{model},</if>
|
|
<if test="productionDate != null">#{productionDate},</if>
|
|
<if test="bodyType != null">#{bodyType},</if>
|
|
<if test="color != null">#{color},</if>
|
|
<if test="engineCapacity != null">#{engineCapacity},</if>
|
|
<if test="fuelType != null">#{fuelType},</if>
|
|
<if test="transmission != null">#{transmission},</if>
|
|
<if test="driveType != null">#{driveType},</if>
|
|
<if test="mileage != null">#{mileage},</if>
|
|
<if test="registrationDate != null">#{registrationDate},</if>
|
|
<if test="licenseNumber != null">#{licenseNumber},</if>
|
|
<if test="holder != null">#{holder},</if>
|
|
<if test="vehicleType != null">#{vehicleType},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateVehicle" parameterType="com.muyu.many.domain.Vehicle">
|
|
update vehicle
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="vin != null">vin = #{vin},</if>
|
|
<if test="brand != null">brand = #{brand},</if>
|
|
<if test="model != null">model = #{model},</if>
|
|
<if test="productionDate != null">production_date = #{productionDate},</if>
|
|
<if test="bodyType != null">body_type = #{bodyType},</if>
|
|
<if test="color != null">color = #{color},</if>
|
|
<if test="engineCapacity != null">engine_capacity = #{engineCapacity},</if>
|
|
<if test="fuelType != null">fuel_type = #{fuelType},</if>
|
|
<if test="transmission != null">transmission = #{transmission},</if>
|
|
<if test="driveType != null">drive_type = #{driveType},</if>
|
|
<if test="mileage != null">mileage = #{mileage},</if>
|
|
<if test="registrationDate != null">registration_date = #{registrationDate},</if>
|
|
<if test="licenseNumber != null">license_number = #{licenseNumber},</if>
|
|
<if test="holder != null">holder = #{holder},</if>
|
|
<if test="vehicleType != null">vehicle_type = #{vehicleType},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteVehicleById" parameterType="Long">
|
|
delete from vehicle where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteVehicleByIds" parameterType="String">
|
|
delete from vehicle where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|