<?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.TEmergencyDeviceMapper"> <resultMap type="TEmergencyDevice" id="TEmergencyDeviceResult"> <result property="id" column="id" /> <result property="deviceType" column="device_type" /> <result property="deviceName" column="device_name" /> <result property="longitude" column="longitude" /> <result property="latitude" column="latitude" /> <result property="contacts" column="contacts" /> <result property="phone" column="phone" /> <result property="address" column="address" /> <result property="introduce" column="introduce" /> <result property="createTime" column="create_time" /> <result property="updateTime" column="update_time" /> <result property="isDel" column="is_del" /> </resultMap> <sql id="selectTEmergencyDeviceVo"> select id, device_type, device_name, longitude, latitude, contacts, phone, address, introduce, create_time, update_time, is_del from t_emergency_device </sql> <select id="selectTEmergencyDeviceList" parameterType="TEmergencyDevice" resultMap="TEmergencyDeviceResult"> <include refid="selectTEmergencyDeviceVo"/> <where> <if test="deviceType != null "> and device_type = #{deviceType}</if> <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if> <if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if> <if test="address != null and address != ''"> and address = #{address}</if> </where> </select> <select id="selectTEmergencyDeviceById" parameterType="String" resultMap="TEmergencyDeviceResult"> <include refid="selectTEmergencyDeviceVo"/> where id = #{id} </select> <insert id="insertTEmergencyDevice" parameterType="TEmergencyDevice"> insert into t_emergency_device <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="deviceType != null">device_type,</if> <if test="deviceName != null">device_name,</if> <if test="longitude != null">longitude,</if> <if test="latitude != null">latitude,</if> <if test="contacts != null">contacts,</if> <if test="phone != null">phone,</if> <if test="address != null">address,</if> <if test="introduce != null">introduce,</if> <if test="createTime != null">create_time,</if> <if test="updateTime != null">update_time,</if> <if test="isDel != null">is_del,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="deviceType != null">#{deviceType},</if> <if test="deviceName != null">#{deviceName},</if> <if test="longitude != null">#{longitude},</if> <if test="latitude != null">#{latitude},</if> <if test="contacts != null">#{contacts},</if> <if test="phone != null">#{phone},</if> <if test="address != null">#{address},</if> <if test="introduce != null">#{introduce},</if> <if test="createTime != null">#{createTime},</if> <if test="updateTime != null">#{updateTime},</if> <if test="isDel != null">#{isDel},</if> </trim> </insert> <update id="updateTEmergencyDevice" parameterType="TEmergencyDevice"> update t_emergency_device <trim prefix="SET" suffixOverrides=","> <if test="deviceType != null">device_type = #{deviceType},</if> <if test="deviceName != null">device_name = #{deviceName},</if> <if test="longitude != null">longitude = #{longitude},</if> <if test="latitude != null">latitude = #{latitude},</if> <if test="contacts != null">contacts = #{contacts},</if> <if test="phone != null">phone = #{phone},</if> <if test="address != null">address = #{address},</if> <if test="introduce != null">introduce = #{introduce},</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> </trim> where id = #{id} </update> <delete id="deleteTEmergencyDeviceById" parameterType="String"> delete from t_emergency_device where id = #{id} </delete> <delete id="deleteTEmergencyDeviceByIds" parameterType="String"> delete from t_emergency_device where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>