feat:ASW-56 device 我的设备 接口开发
1.调整 device 接口 path 2.调整 device 替换成 environment
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
<?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="net.geedge.asw.module.device.dao.DeviceDao">
|
||||
<resultMap id="deviceResult" type="net.geedge.asw.module.device.entity.DeviceEntity">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="platform" column="platform"/>
|
||||
<result property="param" column="param"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="lastHealthCheck" column="last_health_check"/>
|
||||
<result property="createTimestamp" column="create_timestamp"/>
|
||||
<result property="updateTimestamp" column="update_timestamp"/>
|
||||
<result property="createUserId" column="create_user_id"/>
|
||||
<result property="updateUserId" column="update_user_id"/>
|
||||
<result property="workspaceId" column="workspace_id"/>
|
||||
|
||||
<association property="createUser" columnPrefix="cu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="updateUser" columnPrefix="uu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="useUser" columnPrefix="u_" javaType="cn.hutool.json.JSONObject">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="startTimestamp" column="start_timestamp"/>
|
||||
<result property="endTimestamp" column="end_timestamp"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryList" resultMap="deviceResult">
|
||||
SELECT
|
||||
d.*,
|
||||
|
||||
cu.id AS cu_id,
|
||||
cu.name AS cu_name,
|
||||
|
||||
uu.id AS uu_id,
|
||||
uu.name AS uu_name,
|
||||
|
||||
log.user_id AS u_id,
|
||||
u.name AS u_name,
|
||||
log.start_timestamp AS u_start_timestamp,
|
||||
log.end_timestamp AS u_end_timestamp
|
||||
FROM device d
|
||||
LEFT JOIN sys_user cu ON d.create_user_id = cu.id
|
||||
LEFT JOIN sys_user uu ON d.update_user_id = uu.id
|
||||
LEFT JOIN device_log log ON d.id = log.device_id
|
||||
LEFT JOIN sys_user u ON log.user_id = u.id
|
||||
|
||||
<where>
|
||||
<if test="params.ids != null and params.ids != ''">
|
||||
d.id in
|
||||
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.q != null and params.q != ''">
|
||||
AND ( locate(#{params.q}, d.name) OR locate(#{params.q}, d.description) )
|
||||
</if>
|
||||
|
||||
<if test="params.workspaceId != null and params.workspaceId != ''">
|
||||
AND d.workspace_id = #{params.workspaceId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
<if test="params.orderBy == null or params.orderBy == ''">
|
||||
ORDER BY d.create_timestamp
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
129
src/main/resources/db/mapper/device/EnvironmentMapper.xml
Normal file
129
src/main/resources/db/mapper/device/EnvironmentMapper.xml
Normal file
@@ -0,0 +1,129 @@
|
||||
<?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="net.geedge.asw.module.environment.dao.EnvironmentDao">
|
||||
<resultMap id="deviceResult" type="net.geedge.asw.module.environment.entity.EnvironmentEntity">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="location" column="location"/>
|
||||
<result property="platform" column="platform"/>
|
||||
<result property="param" column="param"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="lastHealthCheck" column="last_health_check"/>
|
||||
<result property="createTimestamp" column="create_timestamp"/>
|
||||
<result property="updateTimestamp" column="update_timestamp"/>
|
||||
<result property="createUserId" column="create_user_id"/>
|
||||
<result property="updateUserId" column="update_user_id"/>
|
||||
|
||||
<association property="createUser" columnPrefix="cu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="updateUser" columnPrefix="uu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="useUser" columnPrefix="u_" javaType="cn.hutool.json.JSONObject">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="startTimestamp" column="start_timestamp"/>
|
||||
<result property="endTimestamp" column="end_timestamp"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryList" resultMap="deviceResult">
|
||||
SELECT
|
||||
e.*,
|
||||
|
||||
cu.id AS cu_id,
|
||||
cu.name AS cu_name,
|
||||
|
||||
uu.id AS uu_id,
|
||||
uu.name AS uu_name,
|
||||
|
||||
es.user_id AS u_id,
|
||||
u.name AS u_name,
|
||||
es.start_timestamp AS u_start_timestamp,
|
||||
es.end_timestamp AS u_end_timestamp
|
||||
FROM environment e
|
||||
LEFT JOIN sys_user cu ON e.create_user_id = cu.id
|
||||
LEFT JOIN sys_user uu ON e.update_user_id = uu.id
|
||||
LEFT JOIN environment_session es ON e.id = es.env_id
|
||||
LEFT JOIN environment_workspace ew ON e.id = ew.env_id
|
||||
LEFT JOIN sys_user u ON es.user_id = u.id
|
||||
|
||||
<where>
|
||||
<if test="params.ids != null and params.ids != ''">
|
||||
e.id in
|
||||
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.q != null and params.q != ''">
|
||||
AND ( locate(#{params.q}, e.name) OR locate(#{params.q}, e.description) )
|
||||
</if>
|
||||
|
||||
<if test="params.workspaceId != null and params.workspaceId != ''">
|
||||
AND ew.workspace_id = #{params.workspaceId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
<if test="params.orderBy == null or params.orderBy == ''">
|
||||
ORDER BY e.create_timestamp
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="mySession" resultMap="deviceResult">
|
||||
SELECT
|
||||
e.*,
|
||||
|
||||
cu.id AS cu_id,
|
||||
cu.name AS cu_name,
|
||||
|
||||
uu.id AS uu_id,
|
||||
uu.name AS uu_name,
|
||||
|
||||
es.user_id AS u_id,
|
||||
u.name AS u_name,
|
||||
es.start_timestamp AS u_start_timestamp,
|
||||
es.end_timestamp AS u_end_timestamp
|
||||
FROM environment e
|
||||
LEFT JOIN sys_user cu ON e.create_user_id = cu.id
|
||||
LEFT JOIN sys_user uu ON e.update_user_id = uu.id
|
||||
LEFT JOIN environment_workspace ew ON e.id = ew.env_id
|
||||
LEFT JOIN environment_session es ON e.id = es.env_id
|
||||
LEFT JOIN sys_user u ON es.user_id = u.id
|
||||
|
||||
<where>
|
||||
|
||||
es.status = 1
|
||||
|
||||
<if test="params.ids != null and params.ids != ''">
|
||||
AND e.id in
|
||||
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.q != null and params.q != ''">
|
||||
AND ( locate(#{params.q}, e.name) OR locate(#{params.q}, e.description) )
|
||||
</if>
|
||||
|
||||
<if test="params.workspaceId != null and params.workspaceId != ''">
|
||||
AND ew.workspace_id = #{params.workspaceId}
|
||||
</if>
|
||||
|
||||
<if test="params.currentUserId != null and params.currentUserId != ''">
|
||||
AND es.user_id = #{params.currentUserId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
<if test="params.orderBy == null or params.orderBy == ''">
|
||||
ORDER BY e.create_timestamp
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user