<?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.newfiber.api.pc.dao.PondingDeviceMapper"> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.entity.PondingDevice"> <id column="id" property="id" /> <result column="device_id" property="deviceId" /> <result column="device_name" property="deviceName" /> <result column="use_type" property="useType" /> <result column="use_param" property="useParam" /> <result column="manage_id" property="manageId" /> <result column="msg_id" property="msgId" /> <result column="send_device_id" property="sendDeviceId" /> <result column="collect_type" property="collectType" /> <result column="enabled" property="enabled" /> <result column="lat" property="lat" /> <result column="lon" property="lon" /> <result column="install_time" property="installTime" /> <result column="address" property="address" /> <result column="number" property="number" /> <result column="status" property="status" /> <result column="index_code" property="indexCode" /> </resultMap> <sql id="Base_Column_List"> id, device_id, device_name, use_type, use_param, manage_id, msg_id, send_device_id, collect_type, enabled, lat, lon, install_time, address, number,index_code </sql> <sql id="Base_Column_List_Ext"> pd.id, device_id, device_name, use_type, use_param, manage_id, msg_id, send_device_id, collect_type, enabled, lat, lon, install_time, address, number,cr.index_code,cr.status as status </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from ponding_device where id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from ponding_device where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.newfiber.api.pc.model.entity.PondingDevice"> insert into ponding_device (id, device_id, device_name, use_type, use_param, manage_id, msg_id, send_device_id, collect_type, enabled, lat, lon, install_time, address, number ) values (#{id,jdbcType=BIGINT}, #{deviceId,jdbcType=BIGINT}, #{deviceName,jdbcType=VARCHAR}, #{useType,jdbcType=VARCHAR}, #{useParam,jdbcType=TINYINT}, #{manageId,jdbcType=BIGINT}, #{msgId,jdbcType=BIGINT}, #{sendDeviceId,jdbcType=BIGINT}, #{collectType,jdbcType=TINYINT}, #{enabled,jdbcType=VARCHAR}, #{lat,jdbcType=VARCHAR}, #{lon,jdbcType=VARCHAR}, #{installTime,jdbcType=TIMESTAMP}, #{address,jdbcType=VARCHAR}, #{number,jdbcType=BIGINT} ) </insert> <insert id="insertSelective" parameterType="com.newfiber.api.pc.model.entity.PondingDevice"> insert into ponding_device <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="deviceId != null"> device_id, </if> <if test="deviceName != null"> device_name, </if> <if test="useType != null"> use_type, </if> <if test="useParam != null"> use_param, </if> <if test="manageId != null"> manage_id, </if> <if test="msgId != null"> msg_id, </if> <if test="sendDeviceId != null"> send_device_id, </if> <if test="collectType != null"> collect_type, </if> <if test="enabled != null"> enabled, </if> <if test="lat != null"> lat, </if> <if test="lon != null"> lon, </if> <if test="installTime != null"> install_time, </if> <if test="address != null"> address, </if> <if test="number != null"> number, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, </if> <if test="deviceId != null"> #{deviceId,jdbcType=BIGINT}, </if> <if test="deviceName != null"> #{deviceName,jdbcType=VARCHAR}, </if> <if test="useType != null"> #{useType,jdbcType=VARCHAR}, </if> <if test="useParam != null"> #{useParam,jdbcType=TINYINT}, </if> <if test="manageId != null"> #{manageId,jdbcType=BIGINT}, </if> <if test="msgId != null"> #{msgId,jdbcType=BIGINT}, </if> <if test="sendDeviceId != null"> #{sendDeviceId,jdbcType=BIGINT}, </if> <if test="collectType != null"> #{collectType,jdbcType=TINYINT}, </if> <if test="enabled != null"> #{enabled,jdbcType=VARCHAR}, </if> <if test="lat != null"> #{lat,jdbcType=VARCHAR}, </if> <if test="lon != null"> #{lon,jdbcType=VARCHAR}, </if> <if test="installTime != null"> #{installTime,jdbcType=TIMESTAMP}, </if> <if test="address != null"> #{address,jdbcType=VARCHAR}, </if> <if test="number != null"> #{number,jdbcType=BIGINT}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.newfiber.api.pc.model.entity.PondingDevice"> update ponding_device <set> <if test="deviceId != null"> device_id = #{deviceId,jdbcType=BIGINT}, </if> <if test="deviceName != null"> device_name = #{deviceName,jdbcType=VARCHAR}, </if> <if test="useType != null"> use_type = #{useType,jdbcType=VARCHAR}, </if> <if test="useParam != null"> use_param = #{useParam,jdbcType=TINYINT}, </if> <if test="manageId != null"> manage_id = #{manageId,jdbcType=BIGINT}, </if> <if test="msgId != null"> msg_id = #{msgId,jdbcType=BIGINT}, </if> <if test="sendDeviceId != null"> send_device_id = #{sendDeviceId,jdbcType=BIGINT}, </if> <if test="collectType != null"> collect_type = #{collectType,jdbcType=TINYINT}, </if> <if test="enabled != null"> enabled = #{enabled,jdbcType=VARCHAR}, </if> <if test="lat != null"> lat = #{lat,jdbcType=VARCHAR}, </if> <if test="lon != null"> lon = #{lon,jdbcType=VARCHAR}, </if> <if test="installTime != null"> install_time = #{installTime,jdbcType=TIMESTAMP}, </if> <if test="address != null"> address = #{address,jdbcType=VARCHAR}, </if> <if test="number != null"> number = #{number,jdbcType=BIGINT}, </if> </set> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.newfiber.api.pc.model.entity.PondingDevice"> update ponding_device set device_id = #{deviceId,jdbcType=BIGINT}, device_name = #{deviceName,jdbcType=VARCHAR}, use_type = #{useType,jdbcType=VARCHAR}, use_param = #{useParam,jdbcType=TINYINT}, manage_id = #{manageId,jdbcType=BIGINT}, msg_id = #{msgId,jdbcType=BIGINT}, send_device_id = #{sendDeviceId,jdbcType=BIGINT}, collect_type = #{collectType,jdbcType=TINYINT}, enabled = #{enabled,jdbcType=VARCHAR}, lat = #{lat,jdbcType=VARCHAR}, lon = #{lon,jdbcType=VARCHAR}, install_time = #{installTime,jdbcType=TIMESTAMP}, address = #{address,jdbcType=VARCHAR}, number = #{number,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT} </update> <select id="selectAll" resultMap="BaseResultMap"> select <include refid="Base_Column_List_Ext"/> FROM `ponding_device` pd LEFT JOIN camera_resource cr on pd.index_code = cr.index_code </select> <select id="selectOne" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> FROM `ponding_device` where device_id = #{deviceId} </select> </mapper>