Files
sczx_web/ruoyi-admin/src/main/resources/mapper/operation/ZcCarMapper.xml
19173159168 987e80d657 bug修复
2025-09-27 00:19:05 +08:00

244 lines
14 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.ruoyi.operation.mapper.ZcCarMapper">
<resultMap type="ZcCar" id="ZcCarResult">
<result property="id" column="id" />
<result property="vin" column="vin" />
<result property="licensePlate" column="license_plate" />
<result property="brandId" column="brand_id" />
<result property="brandName" column="brand_name" />
<result property="modelId" column="model_id" />
<result property="modelName" column="model_name" />
<result property="batteryType" column="battery_type" />
<result property="weight" column="weight" />
<result property="maxSpeed" column="max_speed" />
<result property="lotNumber" column="lot_number" />
<result property="purchaseDate" column="purchase_date" />
<result property="purchasePrice" column="purchase_price" />
<result property="belongType" column="belong_type" />
<result property="images" column="images" />
<result property="brsStatus" column="brs_status" />
<result property="iotStatus" column="iot_status" />
<result property="iotCode" column="iot_code" />
<result property="operatorId" column="operator_id" />
<result property="operatorName" column="operator_name" />
<result property="storeId" column="store_id" />
<result property="storeName" column="store_name" />
<result property="packageId" column="package_id" />
<result property="packageName" column="package_name" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<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" />
<result property="extend1" column="extend1" />
<result property="extend2" column="extend2" />
<result property="extend3" column="extend3" />
<result property="extend4" column="extend4" />
<result property="extend5" column="extend5" />
</resultMap>
<sql id="selectZcCarVo">
select id, vin, license_plate, brand_id, brand_name, model_id, model_name, battery_type, weight, max_speed, lot_number, purchase_date, purchase_price, belong_type, images, brs_status, iot_status, iot_code, operator_id, operator_name, store_id, store_name, package_id, package_name, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3, extend4, extend5 from zc_car
</sql>
<select id="selectZcCarList" parameterType="ZcCar" resultMap="ZcCarResult">
<include refid="selectZcCarVo"/>
<where>
del_flag = 0
<if test="vin != null and vin != ''"> and vin like concat('%', #{vin}, '%')</if>
<if test="licensePlate != null and licensePlate != ''"> and license_plate like concat('%', #{licensePlate}, '%')</if>
<if test="brandId != null "> and brand_id = #{brandId}</if>
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
<if test="modelId != null "> and model_id = #{modelId}</if>
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
<if test="batteryType != null and batteryType != ''"> and battery_type = #{batteryType}</if>
<if test="weight != null and weight != ''"> and weight = #{weight}</if>
<if test="maxSpeed != null and maxSpeed != ''"> and max_speed = #{maxSpeed}</if>
<if test="lotNumber != null and lotNumber != ''"> and lot_number = #{lotNumber}</if>
<if test="purchaseDate != null "> and purchase_date = #{purchaseDate}</if>
<if test="purchasePrice != null "> and purchase_price = #{purchasePrice}</if>
<if test="belongType != null and belongType != ''"> and belong_type = #{belongType}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="brsStatus != null and brsStatus != ''"> and brs_status = #{brsStatus}</if>
<if test="iotStatus != null and iotStatus != ''"> and iot_status = #{iotStatus}</if>
<if test="iotCode != null and iotCode != ''"> and iot_code = #{iotCode}</if>
<if test="operatorId != null "> and operator_id = #{operatorId}</if>
<if test="operatorName != null and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
<if test="storeId != null "> and store_id = #{storeId}</if>
<if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
<if test="packageId != null "> and package_id = #{packageId}</if>
<if test="packageName != null and packageName != ''"> and package_name like concat('%', #{packageName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by update_time desc
</select>
<select id="selectZcCarById" parameterType="Long" resultMap="ZcCarResult">
<include refid="selectZcCarVo"/>
where id = #{id}
</select>
<select id="checkVinUnique" resultType="com.ruoyi.operation.domain.ZcCar">
SELECT * FROM zc_car WHERE del_flag = 0 AND vin = #{vin}
</select>
<select id="checkLicensePlateUnique" resultType="com.ruoyi.operation.domain.ZcCar">
SELECT * FROM zc_car WHERE del_flag = 0 AND license_plate = #{licensePlate} limit 1
</select>
<select id="checkLotNumberUnique" resultType="com.ruoyi.operation.domain.ZcCar">
SELECT * FROM zc_car WHERE del_flag = 0 AND lot_number = #{lotNumber} limit 1
</select>
<insert id="insertZcCar" parameterType="ZcCar" useGeneratedKeys="true" keyProperty="id">
insert into zc_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vin != null">vin,</if>
<if test="licensePlate != null">license_plate,</if>
<if test="brandId != null">brand_id,</if>
<if test="brandName != null">brand_name,</if>
<if test="modelId != null">model_id,</if>
<if test="modelName != null">model_name,</if>
<if test="batteryType != null">battery_type,</if>
<if test="weight != null">weight,</if>
<if test="maxSpeed != null">max_speed,</if>
<if test="lotNumber != null">lot_number,</if>
<if test="purchaseDate != null">purchase_date,</if>
<if test="purchasePrice != null">purchase_price,</if>
<if test="belongType != null">belong_type,</if>
<if test="images != null">images,</if>
<if test="brsStatus != null">brs_status,</if>
<if test="iotStatus != null">iot_status,</if>
<if test="iotCode != null">iot_code,</if>
<if test="operatorId != null">operator_id,</if>
<if test="operatorName != null">operator_name,</if>
<if test="storeId != null">store_id,</if>
<if test="storeName != null">store_name,</if>
<if test="packageId != null">package_id,</if>
<if test="packageName != null">package_name,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</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>
<if test="extend1 != null">extend1,</if>
<if test="extend2 != null">extend2,</if>
<if test="extend3 != null">extend3,</if>
<if test="extend4 != null">extend4,</if>
<if test="extend5 != null">extend5,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vin != null">#{vin},</if>
<if test="licensePlate != null">#{licensePlate},</if>
<if test="brandId != null">#{brandId},</if>
<if test="brandName != null">#{brandName},</if>
<if test="modelId != null">#{modelId},</if>
<if test="modelName != null">#{modelName},</if>
<if test="batteryType != null">#{batteryType},</if>
<if test="weight != null">#{weight},</if>
<if test="maxSpeed != null">#{maxSpeed},</if>
<if test="lotNumber != null">#{lotNumber},</if>
<if test="purchaseDate != null">#{purchaseDate},</if>
<if test="purchasePrice != null">#{purchasePrice},</if>
<if test="belongType != null">#{belongType},</if>
<if test="images != null">#{images},</if>
<if test="brsStatus != null">#{brsStatus},</if>
<if test="iotStatus != null">#{iotStatus},</if>
<if test="iotCode != null">#{iotCode},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="operatorName != null">#{operatorName},</if>
<if test="storeId != null">#{storeId},</if>
<if test="storeName != null">#{storeName},</if>
<if test="packageId != null">#{packageId},</if>
<if test="packageName != null">#{packageName},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</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>
<if test="extend1 != null">#{extend1},</if>
<if test="extend2 != null">#{extend2},</if>
<if test="extend3 != null">#{extend3},</if>
<if test="extend4 != null">#{extend4},</if>
<if test="extend5 != null">#{extend5},</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO zc_car (vin, license_plate, brand_name,
model_name, lot_number, purchase_date,
purchase_price, belong_type, iot_code,
operator_id, operator_name,
store_id, store_name,
create_by, create_time, update_time, remark)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.vin}, #{item.licensePlate}, #{item.brandName}
#{item.modelName}, #{item.lotNumber}, #{item.purchaseDate}
#{item.purchasePrice}, #{item.belongType}, #{item.iotCode}
#{item.operatorId}, #{item.operatorName},
#{item.storeId}, #{item.storeName},
#{item.createBy}, #{item.createTime}, #{item.updateTime},#{item.remark})
</foreach>
</insert>
<update id="updateZcCar" parameterType="ZcCar">
update zc_car
<trim prefix="SET" suffixOverrides=",">
<if test="vin != null">vin = #{vin},</if>
<if test="licensePlate != null">license_plate = #{licensePlate},</if>
<if test="brandId != null">brand_id = #{brandId},</if>
<if test="brandName != null">brand_name = #{brandName},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="modelName != null">model_name = #{modelName},</if>
<if test="batteryType != null">battery_type = #{batteryType},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="maxSpeed != null">max_speed = #{maxSpeed},</if>
<if test="lotNumber != null">lot_number = #{lotNumber},</if>
<if test="purchaseDate != null">purchase_date = #{purchaseDate},</if>
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
<if test="belongType != null">belong_type = #{belongType},</if>
<if test="images != null">images = #{images},</if>
<if test="brsStatus != null and brsStatus != ''">brs_status = #{brsStatus},</if>
<if test="iotStatus != null">iot_status = #{iotStatus},</if>
<if test="iotCode != null">iot_code = #{iotCode},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="operatorName != null">operator_name = #{operatorName},</if>
<if test="storeId != null">store_id = #{storeId},</if>
<if test="storeName != null">store_name = #{storeName},</if>
<if test="packageId != null">package_id = #{packageId},</if>
<if test="packageName != null">package_name = #{packageName},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</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>
<if test="extend1 != null">extend1 = #{extend1},</if>
<if test="extend2 != null">extend2 = #{extend2},</if>
<if test="extend3 != null">extend3 = #{extend3},</if>
<if test="extend4 != null">extend4 = #{extend4},</if>
<if test="extend5 != null">extend5 = #{extend5},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZcCarById" parameterType="Long">
delete from zc_car where id = #{id}
</delete>
<delete id="deleteZcCarByIds" parameterType="String">
update zc_car set del_flag ='2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>