<?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.zehong.system.mapper.TDeliveryRecordMapper"> <resultMap type="TDeliveryRecord" id="TDeliveryRecordResult"> <result property="deliveryRecordId" column="delivery_record_id" /> <result property="stationId" column="station_id" /> <result property="bottleId" column="bottle_id" /> <result property="deliveryPerson" column="delivery_person" /> <result property="vehicleCode" column="vehicle_code" /> <result property="gasUserId" column="gas_user_id" /> <result property="deliveryAddress" column="delivery_address" /> <result property="deliveryDate" column="delivery_date" /> <result property="createTime" column="create_time" /> <result property="updateTime" column="update_time" /> <result property="isDel" column="is_del" /> <result property="stationName" column="station_name" /> <result property="bottleCode" column="bottle_code" /> <result property="bottleSpecs" column="bottle_specs" /> <result property="bottleStatus" column="bottle_status" /> <result property="gasUserName" column="gas_user_name" /> <result property="gasUserType" column="gas_user_type" /> </resultMap> <sql id="selectTDeliveryRecordVo"> select delivery_record_id, station_id, bottle_id, delivery_person, vehicle_code, gas_user_id, delivery_address, delivery_date, create_time, update_time, is_del, remark from t_delivery_record </sql> <select id="selectTDeliveryRecordList" parameterType="TDeliveryRecord" resultMap="TDeliveryRecordResult"> select a.delivery_record_id, a.station_id, a.bottle_id, a.delivery_person, a.vehicle_code, a.gas_user_id, a.delivery_address, a.delivery_date, a.create_time, a.update_time, a.remark, b.station_name,c.bottle_code,c.bottle_specs,c.bottle_status,a.delivery_address,a.delivery_date,d.gas_user_name,d.gas_user_type from t_delivery_record a left join t_gas_storage_station_info b on a.station_id=b.station_id left join t_gas_bottle_info c on a.bottle_id=c.bottle_id left join t_gas_user_info d on a.gas_user_id=d.gas_user_id <where> <if test="stationId != null "> and a.station_id = #{stationId}</if> <if test="bottleId != null "> and a.bottle_id = #{bottleId}</if> <if test="deliveryPerson != null "> and a.delivery_person = #{deliveryPerson}</if> <if test="vehicleCode != null and vehicleCode != ''"> and a.vehicle_code = #{vehicleCode}</if> <if test="gasUserId != null "> and a.gas_user_id = #{gasUserId}</if> <if test="deliveryAddress != null and deliveryAddress != ''"> and a.delivery_address = #{deliveryAddress}</if> <if test="deliveryDate != null "> and a.delivery_date = #{deliveryDate}</if> </where> order by a.delivery_record_id desc </select> <select id="selectTDeliveryRecordById" parameterType="Long" resultMap="TDeliveryRecordResult"> select a.delivery_record_id, a.station_id, a.bottle_id, a.delivery_person, a.vehicle_code, a.gas_user_id, a.delivery_address, a.delivery_date, a.create_time, a.update_time, a.remark, b.station_name,c.bottle_code,c.bottle_specs,c.bottle_status,a.delivery_address,a.delivery_date,d.gas_user_name,d.gas_user_type from t_delivery_record a left join t_gas_storage_station_info b on a.station_id=b.station_id left join t_gas_bottle_info c on a.bottle_id=c.bottle_id left join t_gas_user_info d on a.gas_user_id=d.gas_user_id where a.delivery_record_id = #{deliveryRecordId} </select> <insert id="insertTDeliveryRecord" parameterType="TDeliveryRecord" useGeneratedKeys="true" keyProperty="deliveryRecordId"> insert into t_delivery_record <trim prefix="(" suffix=")" suffixOverrides=","> <if test="stationId != null">station_id,</if> <if test="bottleId != null">bottle_id,</if> <if test="deliveryPerson != null">delivery_person,</if> <if test="vehicleCode != null">vehicle_code,</if> <if test="gasUserId != null">gas_user_id,</if> <if test="deliveryAddress != null">delivery_address,</if> <if test="deliveryDate != null">delivery_date,</if> <if test="createTime != null">create_time,</if> <if test="updateTime != null">update_time,</if> <if test="isDel != null">is_del,</if> <if test="remark != null">remark,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="stationId != null">#{stationId},</if> <if test="bottleId != null">#{bottleId},</if> <if test="deliveryPerson != null">#{deliveryPerson},</if> <if test="vehicleCode != null">#{vehicleCode},</if> <if test="gasUserId != null">#{gasUserId},</if> <if test="deliveryAddress != null">#{deliveryAddress},</if> <if test="deliveryDate != null">#{deliveryDate},</if> <if test="createTime != null">#{createTime},</if> <if test="updateTime != null">#{updateTime},</if> <if test="isDel != null">#{isDel},</if> <if test="remark != null">#{remark},</if> </trim> </insert> <update id="updateTDeliveryRecord" parameterType="TDeliveryRecord"> update t_delivery_record <trim prefix="SET" suffixOverrides=","> <if test="stationId != null">station_id = #{stationId},</if> <if test="bottleId != null">bottle_id = #{bottleId},</if> <if test="deliveryPerson != null">delivery_person = #{deliveryPerson},</if> <if test="vehicleCode != null">vehicle_code = #{vehicleCode},</if> <if test="gasUserId != null">gas_user_id = #{gasUserId},</if> <if test="deliveryAddress != null">delivery_address = #{deliveryAddress},</if> <if test="deliveryDate != null">delivery_date = #{deliveryDate},</if> <if test="createTime != null">create_time = #{createTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="isDel != null">is_del = #{isDel},</if> <if test="remark != null">remark = #{remark},</if> </trim> where delivery_record_id = #{deliveryRecordId} </update> <delete id="deleteTDeliveryRecordById" parameterType="Long"> delete from t_delivery_record where delivery_record_id = #{deliveryRecordId} </delete> <delete id="deleteTDeliveryRecordByIds" parameterType="String"> delete from t_delivery_record where delivery_record_id in <foreach item="deliveryRecordId" collection="array" open="(" separator="," close=")"> #{deliveryRecordId} </foreach> </delete> </mapper>