emis-service/emis-biz/src/main/resources/mapper/EmisTmsCarMapper.xml
2024-06-21 11:43:12 +08:00

241 lines
15 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.xdadan.erp.emis.mapper.EmisTmsCarMapper">
<resultMap type="EmisTmsCar" id="EmisTmsCarResult">
<result property="id" column="id" />
<result property="carNo" column="car_no" />
<result property="carBrand" column="car_brand" />
<result property="carBodyColor" column="car_body_color" />
<result property="carPlateColor" column="car_plate_color" />
<result property="carBelong" column="car_belong" />
<result property="fuelType" column="fuel_type" />
<result property="oilWear" column="oil_wear" />
<result property="oilCard" column="oil_card" />
<result property="driverCode" column="driver_code" />
<result property="driverName" column="driver_name" />
<result property="carType" column="car_type" />
<result property="ratedWeight" column="rated_weight" />
<result property="ratedVolume" column="rated_volume" />
<result property="ratedManned" column="rated_manned" />
<result property="carriageLong" column="carriage_long" />
<result property="carriageWidth" column="carriage_width" />
<result property="carriageHigh" column="carriage_high" />
<result property="carriageWeight" column="carriage_weight" />
<result property="blValid" column="bl_valid" />
<result property="orderNum" column="order_num" />
<result property="country" column="country" />
</resultMap>
<sql id="selectEmisTmsCarVo">
select id, car_no, car_brand, car_body_color, car_plate_color, car_belong, fuel_type, oil_wear, oil_card, driver_code, driver_name, car_type, rated_weight, rated_volume, rated_manned, carriage_long, carriage_width, carriage_high, carriage_weight, bl_valid, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, country from emis_tms_car
</sql>
<select id="selectEmisTmsCarList" parameterType="EmisTmsCar" resultMap="EmisTmsCarResult">
<include refid="selectEmisTmsCarVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="carNo != null and carNo != ''"> and car_no like concat('%', #{carNo}, '%')</if>
<if test="carBrand != null and carBrand != ''"> and car_brand like concat('%', #{carBrand}, '%')</if>
<if test="carBodyColor != null and carBodyColor != ''"> and car_body_color like concat('%', #{carBodyColor}, '%')</if>
<if test="carPlateColor != null and carPlateColor != ''"> and car_plate_color like concat('%', #{carPlateColor}, '%')</if>
<if test="carBelong != null and carBelong != ''"> and car_belong like concat('%', #{carBelong}, '%')</if>
<if test="fuelType != null and fuelType != ''"> and fuel_type like concat('%', #{fuelType}, '%')</if>
<if test="oilWear != null "> and oil_wear = #{oilWear}</if>
<if test="oilCard != null and oilCard != ''"> and oil_card like concat('%', #{oilCard}, '%')</if>
<if test="driverCode != null and driverCode != ''"> and driver_code like concat('%', #{driverCode}, '%')</if>
<if test="driverName != null and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
<if test="carType != null and carType != ''"> and car_type like concat('%', #{carType}, '%')</if>
<if test="ratedWeight != null "> and rated_weight = #{ratedWeight}</if>
<if test="ratedVolume != null "> and rated_volume = #{ratedVolume}</if>
<if test="ratedManned != null "> and rated_manned = #{ratedManned}</if>
<if test="carriageLong != null "> and carriage_long = #{carriageLong}</if>
<if test="carriageWidth != null "> and carriage_width = #{carriageWidth}</if>
<if test="carriageHigh != null "> and carriage_high = #{carriageHigh}</if>
<if test="carriageWeight != null "> and carriage_weight = #{carriageWeight}</if>
<if test="blValid != null and blValid != ''"> and bl_valid like concat('%', #{blValid}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="country != null and country != ''"> and country like concat('%', #{country}, '%')</if>
<if test="searchValue != null and searchValue != ''">
AND car_no like concat('%', #{searchValue}, '%')
</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisTmsCar" resultType="int">
select count(1) from emis_tms_car
where del_flag='0'
and id = #{id}
and car_no = #{carNo}
and car_brand = #{carBrand}
and car_body_color = #{carBodyColor}
and car_plate_color = #{carPlateColor}
and car_belong = #{carBelong}
and fuel_type = #{fuelType}
and oil_wear = #{oilWear}
and oil_card = #{oilCard}
and driver_code = #{driverCode}
and driver_name = #{driverName}
and car_type = #{carType}
and rated_weight = #{ratedWeight}
and rated_volume = #{ratedVolume}
and rated_manned = #{ratedManned}
and carriage_long = #{carriageLong}
and carriage_width = #{carriageWidth}
and carriage_high = #{carriageHigh}
and carriage_weight = #{carriageWeight}
and bl_valid = #{blValid}
and order_num = #{orderNum}
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
and country = #{country}
limit 1
</select>
<select id="selectEmisTmsCarById" parameterType="Long" resultMap="EmisTmsCarResult">
select id, car_no, car_brand, car_body_color, car_plate_color, car_belong, fuel_type, oil_wear, oil_card, driver_code, driver_name, car_type, rated_weight, rated_volume, rated_manned, carriage_long, carriage_width, carriage_high, carriage_weight, bl_valid, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, country
from emis_tms_car a
where a.id = #{id}
</select>
<insert id="insertEmisTmsCar" parameterType="EmisTmsCar" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="carNo != null and carNo != ''">car_no,</if>
<if test="carBrand != null and carBrand != ''">car_brand,</if>
<if test="carBodyColor != null and carBodyColor != ''">car_body_color,</if>
<if test="carPlateColor != null and carPlateColor != ''">car_plate_color,</if>
<if test="carBelong != null and carBelong != ''">car_belong,</if>
<if test="fuelType != null and fuelType != ''">fuel_type,</if>
<if test="oilWear != null">oil_wear,</if>
<if test="oilCard != null and oilCard != ''">oil_card,</if>
<if test="driverCode != null and driverCode != ''">driver_code,</if>
<if test="driverName != null and driverName != ''">driver_name,</if>
<if test="carType != null and carType != ''">car_type,</if>
<if test="ratedWeight != null">rated_weight,</if>
<if test="ratedVolume != null">rated_volume,</if>
<if test="ratedManned != null">rated_manned,</if>
<if test="carriageLong != null">carriage_long,</if>
<if test="carriageWidth != null">carriage_width,</if>
<if test="carriageHigh != null">carriage_high,</if>
<if test="carriageWeight != null">carriage_weight,</if>
<if test="blValid != null and blValid != ''">bl_valid,</if>
<if test="orderNum != null">order_num,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
<if test="country != null and country != ''">country,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="carNo != null and carNo != ''">#{carNo},</if>
<if test="carBrand != null and carBrand != ''">#{carBrand},</if>
<if test="carBodyColor != null and carBodyColor != ''">#{carBodyColor},</if>
<if test="carPlateColor != null and carPlateColor != ''">#{carPlateColor},</if>
<if test="carBelong != null and carBelong != ''">#{carBelong},</if>
<if test="fuelType != null and fuelType != ''">#{fuelType},</if>
<if test="oilWear != null">#{oilWear},</if>
<if test="oilCard != null and oilCard != ''">#{oilCard},</if>
<if test="driverCode != null and driverCode != ''">#{driverCode},</if>
<if test="driverName != null and driverName != ''">#{driverName},</if>
<if test="carType != null and carType != ''">#{carType},</if>
<if test="ratedWeight != null">#{ratedWeight},</if>
<if test="ratedVolume != null">#{ratedVolume},</if>
<if test="ratedManned != null">#{ratedManned},</if>
<if test="carriageLong != null">#{carriageLong},</if>
<if test="carriageWidth != null">#{carriageWidth},</if>
<if test="carriageHigh != null">#{carriageHigh},</if>
<if test="carriageWeight != null">#{carriageWeight},</if>
<if test="blValid != null and blValid != ''">#{blValid},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
<if test="country != null and country != ''">#{country},</if>
</trim>
</insert>
<update id="updateEmisTmsCar" parameterType="EmisTmsCar">
update emis_tms_car
<trim prefix="SET" suffixOverrides=",">
<if test="carNo != null and carNo != ''">car_no = #{carNo},</if>
<if test="carBrand != null and carBrand != ''">car_brand = #{carBrand},</if>
<if test="carBodyColor != null and carBodyColor != ''">car_body_color = #{carBodyColor},</if>
<if test="carPlateColor != null and carPlateColor != ''">car_plate_color = #{carPlateColor},</if>
<if test="carBelong != null and carBelong != ''">car_belong = #{carBelong},</if>
<if test="fuelType != null and fuelType != ''">fuel_type = #{fuelType},</if>
<if test="oilWear != null">oil_wear = #{oilWear},</if>
<if test="oilCard != null and oilCard != ''">oil_card = #{oilCard},</if>
<if test="driverCode != null and driverCode != ''">driver_code = #{driverCode},</if>
<if test="driverName != null and driverName != ''">driver_name = #{driverName},</if>
<if test="carType != null and carType != ''">car_type = #{carType},</if>
<if test="ratedWeight != null">rated_weight = #{ratedWeight},</if>
<if test="ratedVolume != null">rated_volume = #{ratedVolume},</if>
<if test="ratedManned != null">rated_manned = #{ratedManned},</if>
<if test="carriageLong != null">carriage_long = #{carriageLong},</if>
<if test="carriageWidth != null">carriage_width = #{carriageWidth},</if>
<if test="carriageHigh != null">carriage_high = #{carriageHigh},</if>
<if test="carriageWeight != null">carriage_weight = #{carriageWeight},</if>
<if test="blValid != null and blValid != ''">bl_valid = #{blValid},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
<if test="country != null and country != ''">country = #{country},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTmsCarById" parameterType="Long">
delete from emis_tms_car where id = #{id}
</delete>
<delete id="deleteEmisTmsCarByIds" parameterType="String">
delete from emis_tms_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>