123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?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.bz.smart_city.dao.DeviceMapper">
- <update id="deleteBySiteId">
- update sc_device set status = 0,date_update = NOW(),update_by=#{updateBy}
- where status = 1 and site_id = #{siteId}
- </update>
- <update id="deleteBySysId">
- update sc_device set status = 0,date_update = NOW(),update_by=#{updateBy}
- where status = 1 and sys_id = #{sysId}
- </update>
- <insert id="insertList">
- INSERT INTO sc_device(
- id,
- device_no,
- device_type,
- sys_id,
- site_id,
- building_id,
- `floor`,
- loc_desc,
- related_device_no,
- manufacturer_id,
- device_status,
- `status`,
- is_tag,
- x_coordinates,
- y_coordinates,
- create_by,
- update_by,
- date_create,
- date_update,
- plan_id,
- water_meter_no,
- water_meter_file_no,
- customer_id,
- udip_id,
- metercode,
- account_id,
- curr_status,
- new_meter_start,
- device_model
- )VALUES
- <foreach collection="devices" item="device" index="index" separator=",">
- (
- #{device.id,jdbcType=BIGINT},
- #{device.deviceNo,jdbcType=VARCHAR},
- #{device.deviceType,jdbcType=BIGINT},
- #{device.sysId,jdbcType=BIGINT},
- #{device.siteId,jdbcType=BIGINT},
- #{device.buildingId,jdbcType=BIGINT},
- #{device.floor,jdbcType=INTEGER},
- #{device.locDesc,jdbcType=VARCHAR},
- #{device.relatedDeviceNo,jdbcType=BIGINT},
- #{device.manufacturerId,jdbcType=BIGINT},
- #{device.deviceStatus,jdbcType=INTEGER},
- #{device.status,jdbcType=INTEGER},
- #{device.isTag,jdbcType=INTEGER},
- #{device.xCoordinates,jdbcType=DECIMAL},
- #{device.yCoordinates,jdbcType=DECIMAL},
- #{device.createBy,jdbcType=VARCHAR},
- #{device.updateBy,jdbcType=VARCHAR},
- #{device.dateCreate,jdbcType=TIMESTAMP},
- #{device.dateUpdate,jdbcType=TIMESTAMP},
- #{device.planId,jdbcType=INTEGER},
- #{device.waterMeterNo,jdbcType=VARCHAR},
- #{device.waterMeterFileNo,jdbcType=VARCHAR},
- #{device.customerId,jdbcType=INTEGER},
- #{device.udipId,jdbcType=VARCHAR},
- #{device.metercode,jdbcType=VARCHAR},
- #{device.accountId,jdbcType=BIGINT},
- #{device.currStatus,jdbcType=INTEGER},
- #{device.newMeterStart,jdbcType=VARCHAR},
- #{device.deviceModel,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <update id="updateSync">
- update sc_device
- <set>
- <if test="devices.deviceNo != null "> device_no = #{devices.deviceNo,jdbcType=VARCHAR},</if>
- <if test="devices.deviceType != null"> device_model = #{devices.deviceType,jdbcType=INTEGER},</if>
- <if test="devices.locDesc != null">loc_desc = #{devices.locDesc,jdbcType=VARCHAR},</if>
- <if test="devices.waterMeterNo != null">water_meter_no = #{devices.waterMeterNo,jdbcType=VARCHAR},</if>
- <if test="devices.dateCreate != null and devices.dateCreate != ''">date_create = #{devices.dateCreate,jdbcType=VARCHAR},</if>
- <if test="devices.dateUpdate != null and devices.dateUpdate != ''">date_update = #{devices.dateUpdate,jdbcType=VARCHAR},</if>
- <if test="devices.status != null">status = #{devices.status,jdbcType=INTEGER},</if>
- <if test="devices.currStatus != null">curr_status = #{devices.currStatus,jdbcType=INTEGER},</if>
- <if test="devices.initialData != null">new_meter_start = #{devices.initialData,jdbcType=DECIMAL}</if>
- </set>
- where metercode = #{devices.fileNo,jdbcType=VARCHAR}
- </update>
- <update id="updateMeterCode">
- update sc_device
- set metercode=#{newMeterCode}
- where metercode = #{newMeterCode}
- <if test="customerId != null and customerId != ''"> and customer_id=#{customerId}</if>
- </update>
- <select id="getNoSyncList" resultType="com.bz.smart_city.entity.Device">
- select
- id,
- device_no,
- device_type,
- sys_id,
- site_id,
- building_id,
- `floor`,
- loc_desc,
- related_device_no,
- manufacturer_id,
- device_status,
- `status`,
- is_tag,
- x_coordinates,
- y_coordinates,
- create_by,
- update_by,
- date_create,
- date_update,
- plan_id,
- water_meter_no,
- water_meter_file_no,
- customer_id,
- udip_id,
- curr_status,
- new_meter_start,
- device_model,
- metercode
- from sc_device where curr_status = 0 and metercode is not null
- <if test="siteId != null"> and site_id = #{siteId,jdbcType=INTEGER}</if>
- <if test="customerId != null"> and customer_id = #{customerId,jdbcType=INTEGER}</if>
- </select>
- </mapper>
|