Browse Source

[Improvement-11662][dao] fix foreach null items in mapper.xml

3.1.0-release
SongTao Zhuang 2 years ago committed by GitHub
parent
commit
6a5367fd57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertPluginInstanceMapper.xml
  2. 17
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
  3. 7
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
  4. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapper.xml
  5. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml
  6. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml
  7. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertPluginInstanceMapper.xml

@ -36,11 +36,13 @@
select select
<include refid="baseSql"/> <include refid="baseSql"/>
from t_ds_alert_plugin_instance from t_ds_alert_plugin_instance
<if test="ids != null and ids.size() != 0">
where id in where id in
<foreach item="item" index="index" collection="ids" <foreach item="item" index="index" collection="ids"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if>
</select> </select>
<select id="queryByInstanceNamePage" resultType="org.apache.dolphinscheduler.dao.entity.AlertPluginInstance"> <select id="queryByInstanceNamePage" resultType="org.apache.dolphinscheduler.dao.entity.AlertPluginInstance">

17
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

@ -40,19 +40,23 @@
<if test="host != null and host != ''"> <if test="host != null and host != ''">
and host=#{host} and host=#{host}
</if> </if>
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
order by id asc order by id asc
</select> </select>
<select id="queryNeedFailoverProcessInstanceHost" resultType="String"> <select id="queryNeedFailoverProcessInstanceHost" resultType="String">
select distinct host select distinct host
from t_ds_process_instance from t_ds_process_instance
<if test="states != null and states.length != 0">
where state in where state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
</select> </select>
<select id="queryTopNProcessInstance" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> <select id="queryTopNProcessInstance" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
@ -77,10 +81,12 @@
<if test="tenantId != -1"> <if test="tenantId != -1">
and tenant_id =#{tenantId} and tenant_id =#{tenantId}
</if> </if>
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
order by id asc order by id asc
</select> </select>
@ -92,10 +98,12 @@
<if test="workerGroupName != ''"> <if test="workerGroupName != ''">
and worker_group =#{workerGroupName} and worker_group =#{workerGroupName}
</if> </if>
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
order by id asc order by id asc
</select> </select>
@ -134,10 +142,13 @@
<update id="setFailoverByHostAndStateArray"> <update id="setFailoverByHostAndStateArray">
update t_ds_process_instance update t_ds_process_instance
set host=null set host=null
where host =#{host} and state in where host =#{host}
<if test="states != null and states.length != 0">
and state in
<foreach collection="states" index="index" item="i" open="(" close=")" separator=","> <foreach collection="states" index="index" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
</update> </update>
<update id="updateProcessInstanceByState"> <update id="updateProcessInstanceByState">
update t_ds_process_instance update t_ds_process_instance
@ -225,10 +236,12 @@
<include refid="baseSql"/> <include refid="baseSql"/>
from t_ds_process_instance from t_ds_process_instance
where process_definition_code=#{processDefinitionCode} where process_definition_code=#{processDefinitionCode}
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
order by id asc order by id asc
</select> </select>
<select id="queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> <select id="queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
@ -237,10 +250,12 @@
from t_ds_process_instance from t_ds_process_instance
where process_definition_code=#{processDefinitionCode} where process_definition_code=#{processDefinitionCode}
and process_definition_version = #{processDefinitionVersion} and process_definition_version = #{processDefinitionVersion}
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" item="i" open="(" close=")" separator=","> <foreach collection="states" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
and next_process_instance_id=0 and next_process_instance_id=0
and id <![CDATA[ < ]]> #{id} and id <![CDATA[ < ]]> #{id}
order by id desc order by id desc

7
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml

@ -129,10 +129,13 @@
</select> </select>
<delete id="deleteIds" parameterType="java.lang.Integer"> <delete id="deleteIds" parameterType="java.lang.Integer">
delete from t_ds_resources where id in delete from t_ds_resources
<if test="resIds != null and resIds.length != 0">
where id in
<foreach collection="resIds" item="i" open="(" close=")" separator=","> <foreach collection="resIds" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
</delete> </delete>
<select id="listChildren" resultType="java.lang.Integer"> <select id="listChildren" resultType="java.lang.Integer">
@ -170,10 +173,12 @@
<property name="alias" value="r"/> <property name="alias" value="r"/>
</include> </include>
from t_ds_resources r from t_ds_resources r
<if test="resIds != null and resIds.length != 0">
where r.id in where r.id in
<foreach collection="resIds" item="i" open="(" close=")" separator=","> <foreach collection="resIds" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
</select> </select>
<select id="existResourceByUser" resultType="java.lang.Boolean"> <select id="existResourceByUser" resultType="java.lang.Boolean">

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapper.xml

@ -51,9 +51,11 @@
<if test="userId != 0"> <if test="userId != 0">
and user_id = #{userId} and user_id = #{userId}
</if> </if>
<if test="resIds != null and resIds.length != 0">
and resources_id in and resources_id in
<foreach collection="resIds" item="i" open="(" close=")" separator=","> <foreach collection="resIds" item="i" open="(" close=")" separator=",">
#{i} #{i}
</foreach> </foreach>
</if>
</delete> </delete>
</mapper> </mapper>

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml

@ -75,10 +75,12 @@
select select
<include refid="baseSql"/> <include refid="baseSql"/>
from t_ds_schedules from t_ds_schedules
<if test="processDefinitionCodeList != null and processDefinitionCodeList.size() != 0">
where process_definition_code in where process_definition_code in
<foreach collection="processDefinitionCodeList" item="code" index="index" open="(" close=")" separator=","> <foreach collection="processDefinitionCodeList" item="code" index="index" open="(" close=")" separator=",">
#{code} #{code}
</foreach> </foreach>
</if>
</select> </select>
<select id="queryReleaseSchedulerListByProcessDefinitionCode" <select id="queryReleaseSchedulerListByProcessDefinitionCode"

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml

@ -34,10 +34,12 @@
update t_ds_task_instance update t_ds_task_instance
set state = #{destStatus} set state = #{destStatus}
where host = #{host} where host = #{host}
<if test="states != null and states.length != 0">
and state in and state in
<foreach collection="states" index="index" item="i" open="(" separator="," close=")"> <foreach collection="states" index="index" item="i" open="(" separator="," close=")">
#{i} #{i}
</foreach> </foreach>
</if>
</update> </update>
<select id="queryTaskByProcessIdAndState" resultType="java.lang.Integer"> <select id="queryTaskByProcessIdAndState" resultType="java.lang.Integer">
select id select id

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml

@ -118,10 +118,12 @@
<select id="selectByIds" resultType="org.apache.dolphinscheduler.dao.entity.User"> <select id="selectByIds" resultType="org.apache.dolphinscheduler.dao.entity.User">
select * select *
from t_ds_user from t_ds_user
<if test="ids != null and ids.size() != 0">
where id in where id in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")"> <foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</if>
</select> </select>
<select id="queryAuthedUserListByProjectId" resultType="org.apache.dolphinscheduler.dao.entity.User"> <select id="queryAuthedUserListByProjectId" resultType="org.apache.dolphinscheduler.dao.entity.User">
select select

Loading…
Cancel
Save