feat: ASW-97 playbook接口开发

This commit is contained in:
zhangshuai
2024-10-10 11:30:40 +08:00
parent dc45c3d62e
commit a10e37bbd1
11 changed files with 261 additions and 22 deletions

View File

@@ -0,0 +1,85 @@
<?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.runner.dao.PlaybookDao">
<resultMap type="net.geedge.asw.module.runner.entity.PlaybookEntity" id="playbook">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="tags" column="tags"/>
<result property="path" column="path"/>
<result property="description" column="description"/>
<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="c_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
<association property="updateUser" columnPrefix="u_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
</resultMap>
<select id="queryInfo" resultMap="playbook">
SELECT
pb.*,
cu.id AS c_id,
cu.name AS c_name,
uu.id AS u_id,
uu.name AS u_name
FROM
playbook pb
LEFT JOIN sys_user cu ON pb.create_user_id = cu.id
LEFT JOIN sys_user uu ON pb.update_user_id = uu.id
<where>
<if test="id != null and id != ''">
AND pb.id = #{id}
</if>
<if test="workspaceId != null and workspaceId != ''">
AND pb.workspace_id = #{workspaceId}
</if>
</where>
</select>
<select id="queryList" resultMap="playbook">
SELECT
pb.*,
cu.id AS c_id,
cu.name AS c_name,
uu.id AS u_id,
uu.name AS u_name
FROM
playbook pb
LEFT JOIN sys_user cu ON pb.create_user_id = cu.id
LEFT JOIN sys_user uu ON pb.update_user_id = uu.id
<where>
<if test="params.ids != null and params.ids != ''">
pb.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}, pb.name) OR locate(#{params.q}, pb.description) )
</if>
<if test="workspaceId != null and workspaceId != ''">
AND pb.workspace_id = #{workspaceId}
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY pb.id
</if>
</select>
</mapper>