|
|
@@ -1,342 +1,407 @@
|
|
|
<?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.tuoren.forward.mapper.DeviceMapper">
|
|
|
- <resultMap id="BaseResultMap" type="com.tuoren.forward.entity.Device">
|
|
|
- <id column="id" jdbcType="VARCHAR" property="id" />
|
|
|
- <result column="mac" jdbcType="VARCHAR" property="mac" />
|
|
|
- <result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
- <result column="alias" jdbcType="VARCHAR" property="alias" />
|
|
|
- <result column="is_delete" jdbcType="CHAR" property="isDelete" />
|
|
|
- <result column="product_id" jdbcType="VARCHAR" property="productId" />
|
|
|
- <result column="description" jdbcType="VARCHAR" property="description" />
|
|
|
- <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
|
|
|
- <result column="modifytime" jdbcType="TIMESTAMP" property="modifytime" />
|
|
|
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
|
|
|
- <result column="lat" jdbcType="VARCHAR" property="lat" />
|
|
|
- <result column="lng" jdbcType="VARCHAR" property="lng" />
|
|
|
- <result column="address" jdbcType="VARCHAR" property="address" />
|
|
|
- <result column="radius" jdbcType="VARCHAR" property="radius" />
|
|
|
- </resultMap>
|
|
|
- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tuoren.forward.entity.Device">
|
|
|
- <result column="data" jdbcType="LONGVARCHAR" property="data" />
|
|
|
- </resultMap>
|
|
|
+ <resultMap id="BaseResultMap" type="com.tuoren.forward.entity.Device">
|
|
|
+ <id column="id" jdbcType="VARCHAR" property="id"/>
|
|
|
+ <result column="mac" jdbcType="VARCHAR" property="mac"/>
|
|
|
+ <result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
+ <result column="alias" jdbcType="VARCHAR" property="alias"/>
|
|
|
+ <result column="is_delete" jdbcType="CHAR" property="isDelete"/>
|
|
|
+ <result column="sim" jdbcType="VARCHAR" property="sim"/>
|
|
|
+ <result column="product_id" jdbcType="VARCHAR" property="productId"/>
|
|
|
+ <result column="description" jdbcType="VARCHAR" property="description"/>
|
|
|
+ <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
|
|
|
+ <result column="modifytime" jdbcType="TIMESTAMP" property="modifytime"/>
|
|
|
+ <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
|
|
|
+ <result column="lat" jdbcType="VARCHAR" property="lat"/>
|
|
|
+ <result column="lng" jdbcType="VARCHAR" property="lng"/>
|
|
|
+ <result column="address" jdbcType="VARCHAR" property="address"/>
|
|
|
+ <result column="radius" jdbcType="VARCHAR" property="radius"/>
|
|
|
+ </resultMap>
|
|
|
+ <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tuoren.forward.entity.Device">
|
|
|
+ <result column="data" jdbcType="LONGVARCHAR" property="data"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <sql id="Base_Column_List">
|
|
|
- id, mac, name, is_delete, product_id, description, createtime, modifytime, tenant_id
|
|
|
- </sql>
|
|
|
- <sql id="Blob_Column_List">
|
|
|
- data
|
|
|
- </sql>
|
|
|
- <sql id="Base_Column_Relation">
|
|
|
- d.id, d.mac, d.name, d.alias,d.is_delete isDelete, d.product_id productId, d.description, d.createtime, d.modifytime,
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, mac, name, is_delete, sim, product_id, description, createtime, modifytime, tenant_id
|
|
|
+ </sql>
|
|
|
+ <sql id="Blob_Column_List">
|
|
|
+ data
|
|
|
+ </sql>
|
|
|
+ <sql id="Base_Column_Relation">
|
|
|
+ d
|
|
|
+ .
|
|
|
+ id
|
|
|
+ , d.mac, d.name, d.alias,d.is_delete isDelete,d.sim sim,d.product_id productId, d.description, d.createtime, d.modifytime,
|
|
|
d.tenant_id tenantId, d.data
|
|
|
- </sql>
|
|
|
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
|
|
- select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- ,
|
|
|
- <include refid="Blob_Column_List" />
|
|
|
- from device
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </select>
|
|
|
- <select id="selectByMac" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
- select <include refid="Base_Column_List" />
|
|
|
- from device
|
|
|
- where mac = #{mac,jdbcType=VARCHAR}
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="selectByMacOwner" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
- select <include refid="Base_Column_List" />
|
|
|
- from device
|
|
|
- where mac = #{mac,jdbcType=VARCHAR}
|
|
|
- and tenant_id = #{owner}
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="existByMacOwner" parameterType="java.lang.Integer" resultType="java.lang.Integer" >
|
|
|
- select 1
|
|
|
- from device
|
|
|
- where mac = #{mac,jdbcType=VARCHAR}
|
|
|
- and tenant_id = #{owner}
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="select" parameterType="DeviceDto" resultType="DeviceResp">
|
|
|
- select
|
|
|
- <include refid="Base_Column_Relation" />,
|
|
|
- p.name productName,u.username
|
|
|
- from device d
|
|
|
- left join product p on d.product_id = p.id
|
|
|
- left join user u on d.tenant_id = u.id
|
|
|
- <where>
|
|
|
- <if test="keyWord != null and keyWord != ''">
|
|
|
- (
|
|
|
- d.name like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
|
|
|
- or
|
|
|
- d.mac like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="productId != null and productId != ''">
|
|
|
- and d.product_id = #{productId,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- <if test="sort != null and sort != ''">
|
|
|
- order by ${sort}
|
|
|
- <if test="order != null "> ${order}</if>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countProviceDevice" resultType="com.tuoren.forward.entity.resp.CountCategoryResp">
|
|
|
- select pro title,count(1) num from
|
|
|
- (SELECT left(address,2) pro FROM forward.device where address is not null) pro_device
|
|
|
- group by pro
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countOnlineDevice" resultType="com.tuoren.forward.entity.resp.CountResp">
|
|
|
- select count(1) num
|
|
|
- from device where timestampdiff(MINUTE,modifytime,now()) < 60
|
|
|
- </select>
|
|
|
-
|
|
|
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
|
- delete from device
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </delete>
|
|
|
- <insert id="insert" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- insert into device (id, mac, name, alias,
|
|
|
- is_delete, product_id, description,
|
|
|
- createtime, modifytime, tenant_id,
|
|
|
- lat,lng,address,radius,
|
|
|
- data)
|
|
|
- values (#{id,jdbcType=VARCHAR}, #{mac,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR} ,
|
|
|
- #{isDelete,jdbcType=CHAR}, #{productId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
|
|
- #{createtime,jdbcType=TIMESTAMP}, #{modifytime,jdbcType=TIMESTAMP}, #{tenantId,jdbcType=VARCHAR},
|
|
|
- #{lat,jdbcType=VARCHAR},#{lng,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR},
|
|
|
- #{radius,jdbcType=VARCHAR},#{data,jdbcType=LONGVARCHAR})
|
|
|
- </insert>
|
|
|
- <insert id="insertSelective" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- insert into device
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- id,
|
|
|
- </if>
|
|
|
- <if test="mac != null">
|
|
|
- mac,
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- name,
|
|
|
- </if>
|
|
|
- <if test="alias != null">
|
|
|
- alias,
|
|
|
- </if>
|
|
|
- <if test="isDelete != null">
|
|
|
- is_delete,
|
|
|
- </if>
|
|
|
- <if test="productId != null">
|
|
|
- product_id,
|
|
|
- </if>
|
|
|
- <if test="description != null">
|
|
|
- description,
|
|
|
- </if>
|
|
|
- <if test="createtime != null">
|
|
|
- createtime,
|
|
|
- </if>
|
|
|
- <if test="modifytime != null">
|
|
|
- modifytime,
|
|
|
- </if>
|
|
|
- <if test="tenantId != null">
|
|
|
- tenant_id,
|
|
|
- </if>
|
|
|
- <if test="lat != null">
|
|
|
- lat,
|
|
|
- </if>
|
|
|
- <if test="lng != null">
|
|
|
- lng,
|
|
|
- </if>
|
|
|
- <if test="address != null">
|
|
|
- address,
|
|
|
- </if>
|
|
|
- <if test="radius != null">
|
|
|
- radius,
|
|
|
- </if>
|
|
|
- <if test="data != null">
|
|
|
- data,
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- #{id,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="mac != null">
|
|
|
- #{mac,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- #{name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="alias != null">
|
|
|
- #{alias,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="isDelete != null">
|
|
|
- #{isDelete,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="productId != null">
|
|
|
- #{productId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="description != null">
|
|
|
- #{description,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="createtime != null">
|
|
|
- #{createtime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="modifytime != null">
|
|
|
- #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="tenantId != null">
|
|
|
- #{tenantId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lat != null">
|
|
|
- #{lat,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lng != null">
|
|
|
- #{lng,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="address != null">
|
|
|
- #{address,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="radius != null">
|
|
|
- #{radius,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="data != null">
|
|
|
- #{data,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- </insert>
|
|
|
- <update id="updateByPrimaryKeySelective" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- update device
|
|
|
- <set>
|
|
|
- <if test="mac != null">
|
|
|
- mac = #{mac,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- name = #{name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="alias != null">
|
|
|
- alias = #{alias,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="isDelete != null">
|
|
|
- is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="productId != null">
|
|
|
- product_id = #{productId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="description != null">
|
|
|
- description = #{description,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="createtime != null">
|
|
|
- createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="modifytime != null">
|
|
|
- modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="tenantId != null">
|
|
|
- tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lat != null">
|
|
|
- lat = #{lat,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lng != null">
|
|
|
- lng = #{lng,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="address != null">
|
|
|
- address = #{address,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="radius != null">
|
|
|
- radius = #{radius,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="data != null">
|
|
|
- data = #{data,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </update>
|
|
|
- <update id="updateByPrimaryKeySelective2" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- update device
|
|
|
- <set>
|
|
|
- <if test="mac != null">
|
|
|
- mac = #{mac,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- name = #{name,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="alias != null">
|
|
|
- alias = #{alias,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="isDelete != null">
|
|
|
- is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
- </if>
|
|
|
- <if test="productId != null">
|
|
|
- product_id = #{productId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="description != null">
|
|
|
- description = #{description,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="createtime != null">
|
|
|
- createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="modifytime != null">
|
|
|
- modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- </if>
|
|
|
- <if test="tenantId != null">
|
|
|
- tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lat != null">
|
|
|
- lat = #{lat,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="lng != null">
|
|
|
- lng = #{lng,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="address != null">
|
|
|
- address = #{address,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="radius != null">
|
|
|
- radius = #{radius,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="data != null">
|
|
|
- data = #{data,jdbcType=LONGVARCHAR},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </update>
|
|
|
- <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- update device
|
|
|
- set mac = #{mac,jdbcType=VARCHAR},
|
|
|
- name = #{name,jdbcType=VARCHAR},
|
|
|
- alias = #{alias,jdbcType=VARCHAR},
|
|
|
- is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
- product_id = #{productId,jdbcType=VARCHAR},
|
|
|
- description = #{description,jdbcType=VARCHAR},
|
|
|
- createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
- modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
- lat = #{lat,jdbcType=VARCHAR},
|
|
|
- lng = #{lng,jdbcType=VARCHAR},
|
|
|
- address = #{address,jdbcType=VARCHAR},
|
|
|
- radius = #{radius,jdbcType=VARCHAR},
|
|
|
- data = #{data,jdbcType=LONGVARCHAR}
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </update>
|
|
|
- <update id="updateByPrimaryKey" parameterType="com.tuoren.forward.entity.Device">
|
|
|
- update device
|
|
|
- set mac = #{mac,jdbcType=VARCHAR},
|
|
|
- name = #{name,jdbcType=VARCHAR},
|
|
|
- alias = #{alias,jdbcType=VARCHAR},
|
|
|
- is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
- product_id = #{productId,jdbcType=VARCHAR},
|
|
|
- description = #{description,jdbcType=VARCHAR},
|
|
|
- createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
- modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
- lat = #{lat,jdbcType=VARCHAR},
|
|
|
- lng = #{lng,jdbcType=VARCHAR},
|
|
|
- address = #{address,jdbcType=VARCHAR},
|
|
|
- radius = #{radius,jdbcType=VARCHAR}
|
|
|
- where id = #{id,jdbcType=VARCHAR}
|
|
|
- </update>
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ ,
|
|
|
+ <include refid="Blob_Column_List"/>
|
|
|
+ from device
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+ <select id="selectByMac" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from device
|
|
|
+ where mac = #{mac,jdbcType=VARCHAR}
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+ <select id="selectByMacOwner" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from device
|
|
|
+ where mac = #{mac,jdbcType=VARCHAR}
|
|
|
+ and tenant_id = #{owner}
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+ <select id="existByMacOwner" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
|
|
+ select 1
|
|
|
+ from device
|
|
|
+ where mac = #{mac,jdbcType=VARCHAR}
|
|
|
+ and tenant_id = #{owner} limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="blurrySearch" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from device
|
|
|
+ <where>
|
|
|
+ <if test="keyWord != null and keyWord != ''">
|
|
|
+ (
|
|
|
+ sim like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
|
|
|
+ or
|
|
|
+ mac like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="sort != null and sort != ''">
|
|
|
+ order by ${sort}
|
|
|
+ <if test="order != null ">
|
|
|
+ ${order}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countProviceDevice" resultType="com.tuoren.forward.entity.resp.CountCategoryResp">
|
|
|
+ select pro title, count(1) num
|
|
|
+ from (SELECT left (address, 2) pro FROM forward.device where address is not null) pro_device
|
|
|
+ group by pro
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countOnlineDevice" resultType="com.tuoren.forward.entity.resp.CountResp">
|
|
|
+ select count(1) num
|
|
|
+ from device
|
|
|
+ where timestampdiff(MINUTE,modifytime, now()) < 60
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
|
+ delete
|
|
|
+ from device
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ insert into device (id, mac, name, alias,
|
|
|
+ is_delete, sim, product_id, description,
|
|
|
+ createtime, modifytime, tenant_id,
|
|
|
+ lat, lng, address, radius,
|
|
|
+ data)
|
|
|
+ values (#{id,jdbcType=VARCHAR}, #{mac,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR},
|
|
|
+ #{isDelete,jdbcType=CHAR}, #{sim,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR},
|
|
|
+ #{description,jdbcType=VARCHAR},
|
|
|
+ #{createtime,jdbcType=TIMESTAMP}, #{modifytime,jdbcType=TIMESTAMP}, #{tenantId,jdbcType=VARCHAR},
|
|
|
+ #{lat,jdbcType=VARCHAR}, #{lng,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
|
|
+ #{radius,jdbcType=VARCHAR}, #{data,jdbcType=LONGVARCHAR})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ insert into device
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="mac != null">
|
|
|
+ mac,
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name,
|
|
|
+ </if>
|
|
|
+ <if test="alias != null">
|
|
|
+ alias,
|
|
|
+ </if>
|
|
|
+ <if test="isDelete != null">
|
|
|
+ is_delete,
|
|
|
+ </if>
|
|
|
+ <if test="sim != null">
|
|
|
+ sim,
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ product_id,
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ description,
|
|
|
+ </if>
|
|
|
+ <if test="createtime != null">
|
|
|
+ createtime,
|
|
|
+ </if>
|
|
|
+ <if test="modifytime != null">
|
|
|
+ modifytime,
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id,
|
|
|
+ </if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat,
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng,
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address,
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius,
|
|
|
+ </if>
|
|
|
+ <if test="data != null">
|
|
|
+ data,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ #{id,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="mac != null">
|
|
|
+ #{mac,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="alias != null">
|
|
|
+ #{alias,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="isDelete != null">
|
|
|
+ #{isDelete,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="sim != null">
|
|
|
+ #{sim,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ #{productId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createtime != null">
|
|
|
+ #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="modifytime != null">
|
|
|
+ #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ #{tenantId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lat != null">
|
|
|
+ #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="data != null">
|
|
|
+ #{data,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ update device
|
|
|
+ <set>
|
|
|
+ <if test="mac != null">
|
|
|
+ mac = #{mac,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="alias != null">
|
|
|
+ alias = #{alias,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="isDelete != null">
|
|
|
+ is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="sim != null">
|
|
|
+ sim = #{sim,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ product_id = #{productId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createtime != null">
|
|
|
+ createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="modifytime != null">
|
|
|
+ modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="data != null">
|
|
|
+ data = #{data,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByMac" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ update device
|
|
|
+ <set>
|
|
|
+ <if test="name != null">
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="alias != null">
|
|
|
+ alias = #{alias,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="isDelete != null">
|
|
|
+ is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="sim != null">
|
|
|
+ sim = #{sim,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ product_id = #{productId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createtime != null">
|
|
|
+ createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="modifytime != null">
|
|
|
+ modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where mac = #{mac,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKeySelective2" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ update device
|
|
|
+ <set>
|
|
|
+ <if test="mac != null">
|
|
|
+ mac = #{mac,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="alias != null">
|
|
|
+ alias = #{alias,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="isDelete != null">
|
|
|
+ is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="sim != null">
|
|
|
+ sim = #{sim,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ product_id = #{productId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createtime != null">
|
|
|
+ createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="modifytime != null">
|
|
|
+ modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null">
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="data != null">
|
|
|
+ data = #{data,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ update device
|
|
|
+ set mac = #{mac,jdbcType=VARCHAR},
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ alias = #{alias,jdbcType=VARCHAR},
|
|
|
+ is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
+ sim = #{sim,jdbcType=VARCHAR},
|
|
|
+ product_id = #{productId,jdbcType=VARCHAR},
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ data = #{data,jdbcType=LONGVARCHAR}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.tuoren.forward.entity.Device">
|
|
|
+ update device
|
|
|
+ set mac = #{mac,jdbcType=VARCHAR},
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ alias = #{alias,jdbcType=VARCHAR},
|
|
|
+ is_delete = #{isDelete,jdbcType=CHAR},
|
|
|
+ sim = #{sim,jdbcType=VARCHAR},
|
|
|
+ product_id = #{productId,jdbcType=VARCHAR},
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
+ modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ radius = #{radius,jdbcType=VARCHAR}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
</mapper>
|