|
@@ -0,0 +1,425 @@
|
|
|
+<?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.zcxk.zoniot.data.migrate.dao.DeviceMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.zcxk.zoniot.data.migrate.model.Device">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table sc_device-->
|
|
|
+ <id column="id" jdbcType="BIGINT" property="id" />
|
|
|
+ <result column="device_no" jdbcType="VARCHAR" property="deviceNo" />
|
|
|
+ <result column="device_type" jdbcType="INTEGER" property="deviceType" />
|
|
|
+ <result column="site_id" jdbcType="INTEGER" property="siteId" />
|
|
|
+ <result column="sys_id" jdbcType="INTEGER" property="sysId" />
|
|
|
+ <result column="building_id" jdbcType="INTEGER" property="buildingId" />
|
|
|
+ <result column="building_unit" jdbcType="VARCHAR" property="buildingUnit" />
|
|
|
+ <result column="floor" jdbcType="INTEGER" property="floor" />
|
|
|
+ <result column="loc_desc" jdbcType="VARCHAR" property="locDesc" />
|
|
|
+ <result column="customer_id" jdbcType="INTEGER" property="customerId" />
|
|
|
+ <result column="related_device_no" jdbcType="BIGINT" property="relatedDeviceNo" />
|
|
|
+ <result column="water_meter_no" jdbcType="VARCHAR" property="waterMeterNo" />
|
|
|
+ <result column="water_meter_file_no" jdbcType="VARCHAR" property="waterMeterFileNo" />
|
|
|
+ <result column="manufacturer_id" jdbcType="INTEGER" property="manufacturerId" />
|
|
|
+ <result column="device_status" jdbcType="CHAR" property="deviceStatus" />
|
|
|
+ <result column="last_receive_time" jdbcType="TIMESTAMP" property="lastReceiveTime" />
|
|
|
+ <result column="status" jdbcType="BOOLEAN" property="status" />
|
|
|
+ <result column="is_tag" jdbcType="CHAR" property="isTag" />
|
|
|
+ <result column="x_coordinates" jdbcType="DECIMAL" property="xCoordinates" />
|
|
|
+ <result column="y_coordinates" jdbcType="DECIMAL" property="yCoordinates" />
|
|
|
+ <result column="plan_id" jdbcType="INTEGER" property="planId" />
|
|
|
+ <result column="udip_id" jdbcType="VARCHAR" property="udipId" />
|
|
|
+ <result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
|
|
+ <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
|
|
+ <result column="date_create" jdbcType="TIMESTAMP" property="dateCreate" />
|
|
|
+ <result column="date_update" jdbcType="TIMESTAMP" property="dateUpdate" />
|
|
|
+ <result column="metercode" jdbcType="VARCHAR" property="metercode" />
|
|
|
+ <result column="account_id" jdbcType="BIGINT" property="accountId" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id, device_no, device_type, site_id, sys_id, building_id, building_unit, `floor`,
|
|
|
+ loc_desc, customer_id, related_device_no, water_meter_no, water_meter_file_no, manufacturer_id,
|
|
|
+ device_status, last_receive_time, `status`, is_tag, x_coordinates, y_coordinates,
|
|
|
+ plan_id, udip_id, create_by, update_by, date_create, date_update, metercode, account_id
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from sc_device
|
|
|
+ where id = #{id,jdbcType=BIGINT}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from sc_device
|
|
|
+ where id = #{id,jdbcType=BIGINT}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.zcxk.zoniot.data.migrate.model.Device">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into sc_device (id, device_no, device_type,
|
|
|
+ site_id, sys_id, building_id,
|
|
|
+ building_unit, `floor`, loc_desc,
|
|
|
+ customer_id, related_device_no, water_meter_no,
|
|
|
+ water_meter_file_no, manufacturer_id, device_status,
|
|
|
+ last_receive_time, `status`, is_tag,
|
|
|
+ x_coordinates, y_coordinates, plan_id,
|
|
|
+ udip_id, create_by, update_by,
|
|
|
+ date_create, date_update, metercode,
|
|
|
+ account_id)
|
|
|
+ values (#{id,jdbcType=BIGINT}, #{deviceNo,jdbcType=VARCHAR}, #{deviceType,jdbcType=INTEGER},
|
|
|
+ #{siteId,jdbcType=INTEGER}, #{sysId,jdbcType=INTEGER}, #{buildingId,jdbcType=INTEGER},
|
|
|
+ #{buildingUnit,jdbcType=VARCHAR}, #{floor,jdbcType=INTEGER}, #{locDesc,jdbcType=VARCHAR},
|
|
|
+ #{customerId,jdbcType=INTEGER}, #{relatedDeviceNo,jdbcType=BIGINT}, #{waterMeterNo,jdbcType=VARCHAR},
|
|
|
+ #{waterMeterFileNo,jdbcType=VARCHAR}, #{manufacturerId,jdbcType=INTEGER}, #{deviceStatus,jdbcType=CHAR},
|
|
|
+ #{lastReceiveTime,jdbcType=TIMESTAMP}, #{status,jdbcType=BOOLEAN}, #{isTag,jdbcType=CHAR},
|
|
|
+ #{xCoordinates,jdbcType=DECIMAL}, #{yCoordinates,jdbcType=DECIMAL}, #{planId,jdbcType=INTEGER},
|
|
|
+ #{udipId,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR},
|
|
|
+ #{dateCreate,jdbcType=TIMESTAMP}, #{dateUpdate,jdbcType=TIMESTAMP}, #{metercode,jdbcType=VARCHAR},
|
|
|
+ #{accountId,jdbcType=BIGINT})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.zcxk.zoniot.data.migrate.model.Device">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into sc_device
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="deviceNo != null">
|
|
|
+ device_no,
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null">
|
|
|
+ device_type,
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ site_id,
|
|
|
+ </if>
|
|
|
+ <if test="sysId != null">
|
|
|
+ sys_id,
|
|
|
+ </if>
|
|
|
+ <if test="buildingId != null">
|
|
|
+ building_id,
|
|
|
+ </if>
|
|
|
+ <if test="buildingUnit != null">
|
|
|
+ building_unit,
|
|
|
+ </if>
|
|
|
+ <if test="floor != null">
|
|
|
+ `floor`,
|
|
|
+ </if>
|
|
|
+ <if test="locDesc != null">
|
|
|
+ loc_desc,
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null">
|
|
|
+ customer_id,
|
|
|
+ </if>
|
|
|
+ <if test="relatedDeviceNo != null">
|
|
|
+ related_device_no,
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterNo != null">
|
|
|
+ water_meter_no,
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterFileNo != null">
|
|
|
+ water_meter_file_no,
|
|
|
+ </if>
|
|
|
+ <if test="manufacturerId != null">
|
|
|
+ manufacturer_id,
|
|
|
+ </if>
|
|
|
+ <if test="deviceStatus != null">
|
|
|
+ device_status,
|
|
|
+ </if>
|
|
|
+ <if test="lastReceiveTime != null">
|
|
|
+ last_receive_time,
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status`,
|
|
|
+ </if>
|
|
|
+ <if test="isTag != null">
|
|
|
+ is_tag,
|
|
|
+ </if>
|
|
|
+ <if test="xCoordinates != null">
|
|
|
+ x_coordinates,
|
|
|
+ </if>
|
|
|
+ <if test="yCoordinates != null">
|
|
|
+ y_coordinates,
|
|
|
+ </if>
|
|
|
+ <if test="planId != null">
|
|
|
+ plan_id,
|
|
|
+ </if>
|
|
|
+ <if test="udipId != null">
|
|
|
+ udip_id,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by,
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ date_create,
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ date_update,
|
|
|
+ </if>
|
|
|
+ <if test="metercode != null">
|
|
|
+ metercode,
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ account_id,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ #{id,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="deviceNo != null">
|
|
|
+ #{deviceNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null">
|
|
|
+ #{deviceType,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ #{siteId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="sysId != null">
|
|
|
+ #{sysId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="buildingId != null">
|
|
|
+ #{buildingId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="buildingUnit != null">
|
|
|
+ #{buildingUnit,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="floor != null">
|
|
|
+ #{floor,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="locDesc != null">
|
|
|
+ #{locDesc,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null">
|
|
|
+ #{customerId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="relatedDeviceNo != null">
|
|
|
+ #{relatedDeviceNo,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterNo != null">
|
|
|
+ #{waterMeterNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterFileNo != null">
|
|
|
+ #{waterMeterFileNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="manufacturerId != null">
|
|
|
+ #{manufacturerId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="deviceStatus != null">
|
|
|
+ #{deviceStatus,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lastReceiveTime != null">
|
|
|
+ #{lastReceiveTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ #{status,jdbcType=BOOLEAN},
|
|
|
+ </if>
|
|
|
+ <if test="isTag != null">
|
|
|
+ #{isTag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="xCoordinates != null">
|
|
|
+ #{xCoordinates,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="yCoordinates != null">
|
|
|
+ #{yCoordinates,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="planId != null">
|
|
|
+ #{planId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="udipId != null">
|
|
|
+ #{udipId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ #{createBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ #{updateBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ #{dateCreate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ #{dateUpdate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="metercode != null">
|
|
|
+ #{metercode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ #{accountId,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.zcxk.zoniot.data.migrate.model.Device">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update sc_device
|
|
|
+ <set>
|
|
|
+ <if test="deviceNo != null">
|
|
|
+ device_no = #{deviceNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="deviceType != null">
|
|
|
+ device_type = #{deviceType,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="siteId != null">
|
|
|
+ site_id = #{siteId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="sysId != null">
|
|
|
+ sys_id = #{sysId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="buildingId != null">
|
|
|
+ building_id = #{buildingId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="buildingUnit != null">
|
|
|
+ building_unit = #{buildingUnit,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="floor != null">
|
|
|
+ `floor` = #{floor,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="locDesc != null">
|
|
|
+ loc_desc = #{locDesc,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null">
|
|
|
+ customer_id = #{customerId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="relatedDeviceNo != null">
|
|
|
+ related_device_no = #{relatedDeviceNo,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterNo != null">
|
|
|
+ water_meter_no = #{waterMeterNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="waterMeterFileNo != null">
|
|
|
+ water_meter_file_no = #{waterMeterFileNo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="manufacturerId != null">
|
|
|
+ manufacturer_id = #{manufacturerId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="deviceStatus != null">
|
|
|
+ device_status = #{deviceStatus,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lastReceiveTime != null">
|
|
|
+ last_receive_time = #{lastReceiveTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status` = #{status,jdbcType=BOOLEAN},
|
|
|
+ </if>
|
|
|
+ <if test="isTag != null">
|
|
|
+ is_tag = #{isTag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="xCoordinates != null">
|
|
|
+ x_coordinates = #{xCoordinates,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="yCoordinates != null">
|
|
|
+ y_coordinates = #{yCoordinates,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="planId != null">
|
|
|
+ plan_id = #{planId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="udipId != null">
|
|
|
+ udip_id = #{udipId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by = #{createBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by = #{updateBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ date_create = #{dateCreate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ date_update = #{dateUpdate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="metercode != null">
|
|
|
+ metercode = #{metercode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ account_id = #{accountId,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=BIGINT}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.zcxk.zoniot.data.migrate.model.Device">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update sc_device
|
|
|
+ set device_no = #{deviceNo,jdbcType=VARCHAR},
|
|
|
+ device_type = #{deviceType,jdbcType=INTEGER},
|
|
|
+ site_id = #{siteId,jdbcType=INTEGER},
|
|
|
+ sys_id = #{sysId,jdbcType=INTEGER},
|
|
|
+ building_id = #{buildingId,jdbcType=INTEGER},
|
|
|
+ building_unit = #{buildingUnit,jdbcType=VARCHAR},
|
|
|
+ `floor` = #{floor,jdbcType=INTEGER},
|
|
|
+ loc_desc = #{locDesc,jdbcType=VARCHAR},
|
|
|
+ customer_id = #{customerId,jdbcType=INTEGER},
|
|
|
+ related_device_no = #{relatedDeviceNo,jdbcType=BIGINT},
|
|
|
+ water_meter_no = #{waterMeterNo,jdbcType=VARCHAR},
|
|
|
+ water_meter_file_no = #{waterMeterFileNo,jdbcType=VARCHAR},
|
|
|
+ manufacturer_id = #{manufacturerId,jdbcType=INTEGER},
|
|
|
+ device_status = #{deviceStatus,jdbcType=CHAR},
|
|
|
+ last_receive_time = #{lastReceiveTime,jdbcType=TIMESTAMP},
|
|
|
+ `status` = #{status,jdbcType=BOOLEAN},
|
|
|
+ is_tag = #{isTag,jdbcType=CHAR},
|
|
|
+ x_coordinates = #{xCoordinates,jdbcType=DECIMAL},
|
|
|
+ y_coordinates = #{yCoordinates,jdbcType=DECIMAL},
|
|
|
+ plan_id = #{planId,jdbcType=INTEGER},
|
|
|
+ udip_id = #{udipId,jdbcType=VARCHAR},
|
|
|
+ create_by = #{createBy,jdbcType=VARCHAR},
|
|
|
+ update_by = #{updateBy,jdbcType=VARCHAR},
|
|
|
+ date_create = #{dateCreate,jdbcType=TIMESTAMP},
|
|
|
+ date_update = #{dateUpdate,jdbcType=TIMESTAMP},
|
|
|
+ metercode = #{metercode,jdbcType=VARCHAR},
|
|
|
+ account_id = #{accountId,jdbcType=BIGINT}
|
|
|
+ where id = #{id,jdbcType=BIGINT}
|
|
|
+ </update>
|
|
|
+ <select id="findByDeviceId" resultType="com.zcxk.zoniot.smartcity.common.dto.DeviceDTO">
|
|
|
+ SELECT
|
|
|
+ d.id,
|
|
|
+ d.sys_id as channel_id,
|
|
|
+ d.device_no ,
|
|
|
+ d.device_type as device_type_id,
|
|
|
+ d.site_id ,
|
|
|
+ d.`status`,
|
|
|
+ d.device_status,
|
|
|
+ d.building_id ,
|
|
|
+ b.`name` as building_name,
|
|
|
+ d.customer_id,
|
|
|
+ d.loc_desc,
|
|
|
+ d.x_coordinates,
|
|
|
+ d.y_coordinates,
|
|
|
+ t.manufacturer_id,
|
|
|
+ m.`name` as manufacturer_name,
|
|
|
+ t.equipment_type as device_type_name,
|
|
|
+ t.model as model,
|
|
|
+ c.id as community_id,
|
|
|
+ c.`name` as community_name,
|
|
|
+ pa.id as province_id,
|
|
|
+ pa.`name` as province_name,
|
|
|
+ ca.id as city_id ,
|
|
|
+ ca.`name` as city_name,
|
|
|
+ ra.id as region_id,
|
|
|
+ ra.`name` as region_name,
|
|
|
+ d.date_update,
|
|
|
+ d.date_create
|
|
|
+ FROM
|
|
|
+ sc_device d
|
|
|
+ left join sc_building b on (b.id = d.building_id)
|
|
|
+ left join sc_community c on (c.id = b.community)
|
|
|
+ left join sc_device_type t on (t.id = d.device_type)
|
|
|
+ left join sc_device_manufacturer m on (t.manufacturer_id = m.id)
|
|
|
+ left join sc_area pa on (pa.id = b.province)
|
|
|
+ left join sc_area ca on (ca.id = b.city)
|
|
|
+ left join sc_area ra on (ra.id = b.region)
|
|
|
+ WHERE d.id = #{deviceId,jdbcType=BIGINT}
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+ <select id="getDeviceIdList" resultType="java.lang.Long">
|
|
|
+ select
|
|
|
+ id
|
|
|
+ from
|
|
|
+ sc_device
|
|
|
+ where
|
|
|
+ status = 1
|
|
|
+ and device_type != 19
|
|
|
+ <!-- 光电直读表不在迁移范围内 -->
|
|
|
+ </select>
|
|
|
+</mapper>
|