feat: ASW-8 新增 Runner 相关接口

This commit is contained in:
shizhendong
2024-07-16 17:38:32 +08:00
parent 5a4c15b00a
commit 79146845b9
15 changed files with 478 additions and 3 deletions

View File

@@ -26,6 +26,7 @@
<association property="pkg" columnPrefix="pkg_" javaType="net.geedge.asw.module.app.entity.PackageEntity">
<id property="id" column="id"/>
<result property="platform" column="platform"/>
<result property="identifier" column="identifier"/>
<result property="version" column="version"/>
<result property="logo" column="logo"/>
</association>
@@ -56,6 +57,7 @@
pkg.platform AS pkg_platform,
pkg.version AS pkg_version,
pkg.logo AS pkg_logo,
pkg.identifier AS pkg_identifier,
app.id AS app_id,
app.name AS app_name,
@@ -121,4 +123,26 @@
</if>
</select>
<select id="getPendingJobByPlatform" resultMap="jobResultMap">
SELECT
job.*,
pkg.id AS pkg_id,
pkg.platform AS pkg_platform,
pkg.identifier AS pkg_identifier,
pkg.version AS pkg_version,
pb.id AS pb_id,
pb.name AS pb_name
FROM
job job
LEFT JOIN package pkg ON job.package_id = pkg.id
LEFT JOIN playbook pb ON job.playbook_id = pb.id
WHERE
job.status = 'pending' and pkg.platform = #{platform}
ORDER BY job.create_timestamp ASC
LIMIT 1
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?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.RunnerDao">
<select id="queryList" resultType="net.geedge.asw.module.runner.entity.RunnerEntity">
SELECT
*
FROM
runner
<where>
<if test="params.workspaceId != null and params.workspaceId != ''">
workspace_id = #{params.workspaceId}
</if>
<if test="params.q != null and params.q != ''">
AND locate(#{params.q}, description)
</if>
<if test="params.tags != null and params.tags != ''">
AND <foreach item="item" collection="params.tags.split(',')" separator="OR" index="" open="(" close=")">
locate(#{item}, tags)
</foreach>
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY id
</if>
</select>
</mapper>