54 lines
2.2 KiB
XML
54 lines
2.2 KiB
XML
<?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.ruoyi.system.mapper.ClientDeviceMapper">
|
|
<resultMap id="ClientDeviceMap" type="com.ruoyi.system.domain.ClientDevice">
|
|
<id property="id" column="id"/>
|
|
<result property="username" column="username"/>
|
|
<result property="deviceId" column="device_id"/>
|
|
<result property="name" column="name"/>
|
|
<result property="os" column="os"/>
|
|
<result property="status" column="status"/>
|
|
<result property="ip" column="ip"/>
|
|
<result property="location" column="location"/>
|
|
<result property="lastActiveAt" column="last_active_at"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
</resultMap>
|
|
|
|
<select id="selectByDeviceId" resultMap="ClientDeviceMap">
|
|
select * from client_device where device_id = #{deviceId}
|
|
</select>
|
|
|
|
<select id="selectByUsername" resultMap="ClientDeviceMap">
|
|
select * from client_device where username = #{username} order by update_time desc
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="com.ruoyi.system.domain.ClientDevice" useGeneratedKeys="true" keyProperty="id">
|
|
insert into client_device(username, device_id, name, os, status, ip, location, last_active_at, create_time, update_time)
|
|
values(#{username}, #{deviceId}, #{name}, #{os}, #{status}, #{ip}, #{location}, #{lastActiveAt}, now(), now())
|
|
</insert>
|
|
|
|
<update id="updateByDeviceId" parameterType="com.ruoyi.system.domain.ClientDevice">
|
|
update client_device
|
|
set username = #{username},
|
|
name = #{name},
|
|
os = #{os},
|
|
status = #{status},
|
|
ip = #{ip},
|
|
location = #{location},
|
|
last_active_at = #{lastActiveAt},
|
|
update_time = now()
|
|
where device_id = #{deviceId}
|
|
</update>
|
|
|
|
<delete id="deleteByDeviceId">
|
|
delete from client_device where device_id = #{deviceId}
|
|
</delete>
|
|
|
|
<select id="countByUsername" resultType="int">
|
|
select count(1) from client_device where username = #{username}
|
|
</select>
|
|
</mapper>
|
|
|
|
|