feat: ASW-61 Environment 管理接口开发

This commit is contained in:
zhangshuai
2024-09-10 15:27:52 +08:00
parent 0c59be48f9
commit 0b08291d7c
9 changed files with 200 additions and 64 deletions

View File

@@ -31,8 +31,7 @@
<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"/>
<result property="userName" column="user_name"/>
</association>
</resultMap>
@@ -46,19 +45,12 @@
uu.id AS uu_id,
uu.name AS uu_name,
uu.user_name AS uu_user_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
uu.user_name AS uu_user_name
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
@@ -74,6 +66,10 @@
<if test="params.workspaceId != null and params.workspaceId != ''">
AND ew.workspace_id = #{params.workspaceId}
</if>
<if test="params.currentUserId != null and params.currentUserId != ''">
AND e.create_user_id = #{params.currentUserId}
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
@@ -87,14 +83,15 @@
cu.id AS cu_id,
cu.name AS cu_name,
cu.user_name AS cu_user_name,
uu.id AS uu_id,
uu.name AS uu_name,
uu.user_name AS uu_user_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
u.user_name AS u_user_name
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

View File

@@ -0,0 +1,43 @@
<?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.EnvironmentSessionDao">
<resultMap id="session" type="net.geedge.asw.module.environment.entity.EnvironmentSessionEntity">
<result property="id" column="id"/>
<result property="envId" column="env_id"/>
<result property="status" column="status"/>
<result property="userId" column="user_id"/>
<result property="startTimestamp" column="start_timestamp"/>
<result property="endTimestamp" column="end_timestamp"/>
<result property="jobId" column="job_id"/>
<result property="workspaceId" column="workspace_id"/>
<association property="user" columnPrefix="u_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="userName" column="user_name"/>
</association>
<association property="workspace" columnPrefix="w_" javaType="net.geedge.asw.module.workspace.entity.WorkspaceEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
</resultMap>
<select id="queryListByUsed" resultMap="session">
SELECT
es.*,
u.id AS u_id,
u.name AS u_name,
u.user_name AS u_user_name,
w.id AS w_id,
w.name AS w_name
FROM environment_session es
LEFT JOIN sys_user u ON es.user_id = u.id
LEFT JOIN workspace w ON es.workspace_id = w.id
<where>
es.status = 1
</where>
</select>
</mapper>