济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

90 lines
4.3 KiB

<?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.zc.business.mapper.DcVehiclesMapper">
<resultMap type="DcVehicles" id="DcVehiclesResult">
<result property="id" column="id" />
<result property="organizationId" column="organization_id" />
<result property="vehiclePlate" column="vehicle_plate" />
<result property="vehicleType" column="vehicle_type" />
<result property="vehicleStatus" column="vehicle_status" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="organizationName" column="organization_name" />
</resultMap>
<sql id="selectDcVehiclesVo">
select v.id, v.organization_id, v.vehicle_plate,
organization.organization_name,
v.vehicle_type, v.vehicle_status,
v.remark, v.create_time, v.update_time from dc_vehicles as v
left join dc_organization as organization on organization.id=v.organization_id
</sql>
<select id="selectDcVehiclesList" parameterType="DcVehicles" resultMap="DcVehiclesResult">
<include refid="selectDcVehiclesVo"/>
<where>
<if test="organizationId != null "> and organization_id = #{organizationId}</if>
<if test="vehiclePlate != null and vehiclePlate != ''"> and vehicle_plate = #{vehiclePlate}</if>
<if test="vehicleType != null "> and vehicle_type = #{vehicleType}</if>
<if test="vehicleStatus != null "> and vehicle_status = #{vehicleStatus}</if>
</where>
</select>
<select id="selectDcVehiclesById" parameterType="Long" resultMap="DcVehiclesResult">
<include refid="selectDcVehiclesVo"/>
where id = #{id}
</select>
<insert id="insertDcVehicles" parameterType="DcVehicles">
insert into dc_vehicles
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="organizationId != null">organization_id,</if>
<if test="vehiclePlate != null and vehiclePlate != ''">vehicle_plate,</if>
<if test="vehicleType != null">vehicle_type,</if>
<if test="vehicleStatus != null">vehicle_status,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="organizationId != null">#{organizationId},</if>
<if test="vehiclePlate != null and vehiclePlate != ''">#{vehiclePlate},</if>
<if test="vehicleType != null">#{vehicleType},</if>
<if test="vehicleStatus != null">#{vehicleStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcVehicles" parameterType="DcVehicles">
update dc_vehicles
<trim prefix="SET" suffixOverrides=",">
<if test="organizationId != null">organization_id = #{organizationId},</if>
<if test="vehiclePlate != null and vehiclePlate != ''">vehicle_plate = #{vehiclePlate},</if>
<if test="vehicleType != null">vehicle_type = #{vehicleType},</if>
<if test="vehicleStatus != null">vehicle_status = #{vehicleStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcVehiclesById" parameterType="Long">
delete from dc_vehicles where id = #{id}
</delete>
<delete id="deleteDcVehiclesByIds" parameterType="String">
delete from dc_vehicles where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>