Skip to content

Commit

Permalink
[Bug] application mybatis Mapper bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys committed Oct 14, 2023
1 parent 1b1596c commit c44d808
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@

public interface ApplicationMapper extends BaseMapper<Application> {

IPage<Application> page(Page<Application> page, @Param("application") Application application);
IPage<Application> page(Page<Application> page, @Param("app") Application application);

Application getApp(@Param("application") Application application);
Application getApp(@Param("app") Application application);

void persistMetrics(@Param("application") Application application);
void persistMetrics(@Param("app") Application application);

List<Application> getByTeamId(@Param("teamId") Long teamId);

List<Application> getProbeApps();

boolean mapping(@Param("application") Application appParam);
boolean mapping(@Param("app") Application appParam);

List<String> getRecentK8sNamespace(@Param("limitSize") Integer limit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void subscribeJobStatusChange(FlinkJobStatusChangeEvent event) {
}
// update application record
setByJobStatusCV(app, jobStatus);
applicationInfoService.persistMetrics(app);
applicationManageService.persistMetrics(app);

// email alerts when necessary
FlinkAppStateEnum state = app.getStateEnum();
Expand Down Expand Up @@ -148,7 +148,7 @@ public void subscribeMetricsChange(FlinkClusterMetricChangeEvent event) {
app.setTotalSlot(metrics.totalSlot());
app.setAvailableSlot(metrics.availableSlot());

applicationInfoService.persistMetrics(app);
applicationManageService.persistMetrics(app);
}

@SuppressWarnings("UnstableApiUsage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,43 +136,43 @@
left join t_flink_project p
on t.project_id = p.id
<where>
t.team_id = #{application.teamId}
<if test="application.jobType != null and application.jobType != ''">
and t.job_type = #{application.jobType}
t.team_id = #{app.teamId}
<if test="app.jobType != null and app.jobType != ''">
and t.job_type = #{app.jobType}
</if>
<if test="application.jobTypeArray != null and application.jobTypeArray.length>0">
<if test="app.jobTypeArray != null and app.jobTypeArray.length>0">
and t.job_type in
<foreach item="item" index="index" collection="application.jobTypeArray" open="(" close=")" separator=",">
<foreach item="item" index="index" collection="app.jobTypeArray" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="application.executionMode != null and application.executionMode != ''">
and t.execution_mode = #{application.executionMode}
<if test="app.executionMode != null and app.executionMode != ''">
and t.execution_mode = #{app.executionMode}
</if>
<if test="application.jobName != null and application.jobName != ''">
and t.job_name like '%${application.jobName}%'
<if test="app.jobName != null and app.jobName != ''">
and t.job_name like '%${app.jobName}%'
</if>
<if test="application.projectName != null and application.projectName != ''">
and p.name like '%${application.projectName}%'
<if test="app.projectName != null and app.projectName != ''">
and p.name like '%${app.projectName}%'
</if>
<if test="application.appId != null and application.appId != ''">
and t.app_id = #{application.appId}
<if test="app.appId != null and app.appId != ''">
and t.app_id = #{app.appId}
</if>
<if test="application.state != null and application.state != ''">
and t.state = #{application.state}
<if test="app.state != null and app.state != ''">
and t.state = #{app.state}
</if>

<if test="application.userId != null and application.userId != ''">
and t.user_id = #{application.userId}
<if test="app.userId != null and app.userId != ''">
and t.user_id = #{app.userId}
</if>
<if test="application.stateArray != null and application.stateArray.length>0">
<if test="app.stateArray != null and app.stateArray.length>0">
and t.state in
<foreach item="item" index="index" collection="application.stateArray" open="(" close=")" separator=",">
<foreach item="item" index="index" collection="app.stateArray" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="application.tags != null and application.tags != ''">
and t.tags like '%${application.tags}%'
<if test="app.tags != null and app.tags != ''">
and t.tags like '%${app.tags}%'
</if>
</where>
</select>
Expand All @@ -181,32 +181,32 @@
select t.*, p.name as projectName
from t_flink_app t left join t_flink_project p
on t.project_id = p.id
where t.id = #{application.id}
where t.id = #{app.id}
</select>

<update id="persistMetrics" parameterType="org.apache.streampark.console.core.entity.Application">
update t_flink_app
<set>
<if test="application.jobId != null and application.jobId != ''">
job_id=#{application.jobId},
<if test="app.jobId != null and app.jobId != ''">
job_id=#{app.jobId},
</if>
<if test="application.tracking != null">
tracking=#{application.tracking},
<if test="app.tracking != null">
tracking=#{app.tracking},
</if>
<if test="application.optionState != null">
option_state=#{application.optionState},
<if test="app.optionState != null">
option_state=#{app.optionState},
</if>
<if test="application.startTime != null">
start_time=#{application.startTime},
<if test="app.startTime != null">
start_time=#{app.startTime},
</if>
<if test="application.endTime != null">
end_time=#{application.endTime},
<if test="app.endTime != null">
end_time=#{app.endTime},
</if>
<if test="application.duration != null">
duration=#{application.duration},
<if test="app.duration != null">
duration=#{app.duration},
</if>
<choose>
<when test="@org.apache.streampark.console.core.enums.FlinkAppState@isEndState(application.state)">
<when test="@org.apache.streampark.console.core.enums.FlinkAppStateEnum@isEndState(app.state)">
total_tm=null,
total_slot=null,
total_task=null,
Expand All @@ -215,29 +215,29 @@
tm_memory=null,
</when>
<otherwise>
<if test="application.totalTM != null">
total_tm=#{application.totalTM},
<if test="app.totalTM != null">
total_tm=#{app.totalTM},
</if>
<if test="application.totalSlot != null">
total_slot=#{application.totalSlot},
<if test="app.totalSlot != null">
total_slot=#{app.totalSlot},
</if>
<if test="application.totalTask != null">
total_task=#{application.totalTask},
<if test="app.totalTask != null">
total_task=#{app.totalTask},
</if>
<if test="application.availableSlot != null">
available_slot=#{application.availableSlot},
<if test="app.availableSlot != null">
available_slot=#{app.availableSlot},
</if>
<if test="application.jmMemory != null">
jm_memory=#{application.jmMemory},
<if test="app.jmMemory != null">
jm_memory=#{app.jmMemory},
</if>
<if test="application.tmMemory != null">
tm_memory=#{application.tmMemory},
<if test="app.tmMemory != null">
tm_memory=#{app.tmMemory},
</if>
</otherwise>
</choose>
state=#{application.state}
state=#{app.state}
</set>
where id=#{application.id}
where id=#{app.id}
</update>

<select id="getByTeamId" resultType="org.apache.streampark.console.core.entity.Application" parameterType="java.lang.Long">
Expand Down Expand Up @@ -273,17 +273,17 @@
<update id="mapping" parameterType="org.apache.streampark.console.core.entity.Application">
update t_flink_app
<set>
<if test="application.jobId != null">
job_id=#{application.jobId},
<if test="app.jobId != null">
job_id=#{app.jobId},
</if>
<if test="application.appId != null">
app_id=#{application.appId},
<if test="app.appId != null">
app_id=#{app.appId},
</if>
end_time=null,
state=14,
tracking=1
</set>
where id=#{application.id}
where id=#{app.id}
</update>

<select id="getRecentK8sNamespace" resultType="java.lang.String" parameterType="java.lang.Integer">
Expand Down

0 comments on commit c44d808

Please sign in to comment.