123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.bosshand.virgo.ringzle.dao.DeviceDao">
- <resultMap type="com.bosshand.virgo.ringzle.model.Device" id="deviceResult">
- <id column="id" property="id"/>
- <result column="deviceId" property="deviceId"/>
- <result column="type" property="type"/>
- <result column="status" property="status"/>
- <result column="isHalt" property="isHalt"/>
- <result column="createDate" property="createDate"/>
- <result column="deviceName" property="deviceName"/>
- <result column="simcardId" property="simcardId"/>
- <result column="lastDeployTime" property="lastDeployTime"/>
- <result column="lastHeartBeat" property="lastHeartBeat"/>
- <result column="longitude" property="longitude"/>
- <result column="latitude" property="latitude"/>
- <result column="organizationId" property="organizationId"/>
- <result column="projectId" property="projectId"/>
- <result column="bimIntegrateId" property="bimIntegrateId"/>
- <result column="elementId" property="elementId"/>
- <result column="equipmentId" property="equipmentId"/>
- </resultMap>
- <insert id="save" parameterType="com.bosshand.virgo.ringzle.model.Device" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO iot_device (deviceId, type, status, isHalt, createDate, deviceName, simcardId, lastDeployTime, lastHeartBeat, longitude,
- latitude, organizationId, projectId, bimIntegrateId, elementId, equipmentId)
- VALUES (#{deviceId}, #{type}, #{status}, #{isHalt}, now(), #{deviceName}, #{simcardId}, #{lastDeployTime}, #{lastHeartBeat}, #{longitude},
- #{latitude}, #{organizationId}, #{projectId}, #{bimIntegrateId}, #{elementId}, #{equipmentId});
- </insert>
- <select id="getList" resultMap="deviceResult">
- select * from iot_device
- <where>
- <if test="id != -1">
- and id =#{id}
- </if>
- <if test="organizationId != 0">
- and organizationId =#{organizationId}
- </if>
- <if test="projectId != 0">
- and projectId =#{projectId}
- </if>
- <if test="type != -1">
- and type =#{type}
- </if>
- <if test="status != -1">
- and status =#{status}
- </if>
- <if test="isHalt != -1">
- and isHalt =#{isHalt}
- </if>
- <if test="deviceName != null">
- and deviceName =#{deviceName}
- </if>
- <if test="simcardId != 0">
- and simcardId =#{simcardId}
- </if>
- <if test="bimIntegrateId != null">
- and bimIntegrateId =#{bimIntegrateId}
- </if>
- <if test="equipmentId != 0">
- and equipmentId =#{equipmentId}
- </if>
- </where>
- </select>
- <select id="getListByElement" resultMap="deviceResult">
- select * from iot_device where projectId =#{projectId} and bimIntegrateId=#{bimIntegrateId} and elementId =#{elementId}
- </select>
- <select id="getDevice" resultMap="deviceResult">
- select * from iot_device where deviceId =#{deviceId}
- </select>
- <update id="update">
- update iot_device
- <trim prefix="set" suffixOverrides=",">
- <if test="deviceId!=null">deviceId=#{deviceId},</if>
- <if test="type!=-1">type=#{type},</if>
- <if test="status==-1">status=#{status},</if>
- <if test="isHalt!=-1">isHalt=#{isHalt},</if>
- <if test="deviceName!=null">deviceName=#{deviceName},</if>
- <if test="simcardId!=0">simcardId=#{simcardId},</if>
- <if test="lastDeployTime!=null">lastDeployTime=#{lastDeployTime},</if>
- <if test="lastHeartBeat!=null">lastHeartBeat=#{lastHeartBeat},</if>
- <if test="longitude!=0">longitude=#{longitude},</if>
- <if test="latitude!=0">latitude=#{latitude},</if>
- <if test="organizationId!=0">organizationId=#{organizationId},</if>
- <if test="projectId!=0">projectId=#{projectId},</if>
- <if test="bimIntegrateId!=null">bimIntegrateId=#{bimIntegrateId},</if>
- <if test="elementId!=null">elementId=#{elementId},</if>
- <if test="equipmentId!=0">equipmentId=#{equipmentId},</if>
- </trim>
- where id=#{id}
- </update>
- <delete id="delete">
- delete FROM iot_device where id=#{id}
- </delete>
- </mapper>
|