All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper.xml Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
<?xml version="1.0" encoding="UTF-8" ?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper">
    <select id="queryByDefineName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        select pd.*,u.user_name,p.name as project_name,t.tenant_code,t.tenant_name,q.queue,q.queue_name
        from t_ds_process_definition pd
        JOIN t_ds_user u ON pd.user_id = u.id
        JOIN  t_ds_project p ON pd.project_id = p.id
        JOIN  t_ds_tenant t ON t.id = u.tenant_id
        JOIN t_ds_queue q ON t.queue_id = q.id
        WHERE p.id = #{projectId}
        and pd.name = #{processDefinitionName}
    </select>
    <select id="queryDefineListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        SELECT td.*,sc.schedule_release_state,tu.user_name
        FROM t_ds_process_definition td
        left join (select process_definition_id,release_state as schedule_release_state from t_ds_schedules group by process_definition_id,release_state) sc on sc.process_definition_id = td.id
        left join t_ds_user tu on  td.user_id = tu.id
        where td.project_id = #{projectId}
        <if test=" searchVal != null and searchVal != ''">
            and td.name like concat('%', #{searchVal}, '%')
        </if>
        <if test=" userId != 0">
            and td.user_id = #{userId}
        </if>
        order by sc.schedule_release_state desc,td.update_time desc
    </select>

    <select id="queryAllDefinitionList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        select *
        from t_ds_process_definition
        where project_id = #{projectId}
        order by create_time desc
    </select>
    <select id="queryDefinitionListByTenant" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        select *
        from t_ds_process_definition
        where tenant_id = #{tenantId}
    </select>
    <select id="queryDefinitionListByIdList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        select *
        from t_ds_process_definition
        where id in
        <foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
            #{i}
        </foreach>
    </select>
    <select id="countDefinitionGroupByUser" resultType="org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser">
        SELECT td.user_id as user_id, tu.user_name as user_name, count(0) as count
        FROM t_ds_process_definition td
        JOIN t_ds_user tu on tu.id=td.user_id
        where 1 = 1
        <if test="projectIds != null and projectIds.length != 0">
            and td.project_id in
            <foreach collection="projectIds" index="index" item="i" open="(" separator="," close=")">
                #{i}
            </foreach>
        </if>
        group by td.user_id,tu.user_name
    </select>
    <select id="queryByDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
        SELECT
            pd.*, u.user_name,
            p.name AS project_name
        FROM
            t_ds_process_definition pd,
            t_ds_user u,
            t_ds_project p
        WHERE
            pd.user_id = u.id AND pd.project_id = p.id
        AND pd.id = #{processDefineId}
    </select>
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy