提交 fe521723 编写于 作者: Q qiaozhanwei 提交者: lgcareer

table name modify (#945)

* add ConnectionFactoryTest and ConnectionFactory read datasource from appliction.yml

* .escheduler_env.sh to dolphinscheduler_env.sh

* dao yml assembly to conf directory

* table name modify
上级 4ea0466b
......@@ -2,8 +2,8 @@
<!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.AccessTokenMapper">
<select id="selectAccessTokenPage" resultType="org.apache.dolphinscheduler.dao.entity.AccessToken">
select * from t_escheduler_access_token t
left join t_escheduler_user u on t.user_id = u.id
select * from t_ds_access_token t
left join t_ds_user u on t.user_id = u.id
where 1 = 1
<if test="userName != null and userName != ''">
and u.user_name like concat ('%', #{userName}, '%')
......
......@@ -2,7 +2,7 @@
<!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.AlertGroupMapper">
<select id="queryAlertGroupPage" resultType="org.apache.dolphinscheduler.dao.entity.AlertGroup">
select * from t_escheduler_alertgroup
select * from t_ds_alertgroup
where 1 = 1
<if test="groupName != null and groupName != ''">
and group_name like concat('%', #{groupName}, '%')
......@@ -10,21 +10,21 @@
order by update_time desc
</select>
<select id="queryByGroupName" resultType="org.apache.dolphinscheduler.dao.entity.AlertGroup">
select * from t_escheduler_alertgroup
select * from t_ds_alertgroup
where group_name=#{groupName}
</select>
<select id="queryByUserId" resultType="org.apache.dolphinscheduler.dao.entity.AlertGroup">
select * from t_escheduler_alertgroup t
left join t_escheduler_relation_user_alertgroup r on t.id=r.alertgroup_id
select * from t_ds_alertgroup t
left join t_ds_relation_user_alertgroup r on t.id=r.alertgroup_id
where r.user_id=#{userId}
</select>
<select id="queryByAlertType" resultType="org.apache.dolphinscheduler.dao.entity.AlertGroup">
select * from t_escheduler_alertgroup
select * from t_ds_alertgroup
where group_type=#{alertType}
</select>
<select id="queryAllGroupList" resultType="org.apache.dolphinscheduler.dao.entity.AlertGroup">
select *
from t_escheduler_alertgroup
from t_ds_alertgroup
order by update_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.AlertMapper">
<select id="listAlertByStatus" resultType="org.apache.dolphinscheduler.dao.entity.Alert">
select *
from t_escheduler_alert
from t_ds_alert
where alert_status = #{alertStatus}
</select>
</mapper>
\ No newline at end of file
......@@ -2,15 +2,15 @@
<!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.CommandMapper">
<select id="getOneToRun" resultType="org.apache.dolphinscheduler.dao.entity.Command">
select command.* from t_escheduler_command command
join t_escheduler_process_definition definition on command.process_definition_id = definition.id
select command.* from t_ds_command command
join t_ds_process_definition definition on command.process_definition_id = definition.id
where definition.release_state = 1 AND definition.flag = 1
order by update_time asc
limit 1
</select>
<select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount">
select cmd.command_type as state, count(1) as count
from t_escheduler_command cmd, t_escheduler_process_definition process
from t_ds_command cmd, t_ds_process_definition process
where cmd.process_definition_id = process.id
<if test="projectIdArray != null and projectIdArray.length != 0">
and process.project_id in
......
......@@ -3,15 +3,15 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.DataSourceMapper">
<select id="queryDataSourceByType" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select *
from t_escheduler_datasource
from t_ds_datasource
where type=#{type}
<if test="userId != 0">
and id in
(select datasource_id
from t_escheduler_relation_datasource_user
from t_ds_relation_datasource_user
where user_id=#{userId}
union select id as datasource_id
from t_escheduler_datasource
from t_ds_datasource
where user_id=#{userId}
)
</if>
......@@ -20,15 +20,15 @@
<select id="selectPaging" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select *
from t_escheduler_datasource
from t_ds_datasource
where 1 =1
<if test="userId != 0">
and id in
(select datasource_id
from t_escheduler_relation_datasource_user
from t_ds_relation_datasource_user
where user_id=#{userId}
union select id as datasource_id
from t_escheduler_datasource
from t_ds_datasource
where user_id=#{userId}
)
</if>
......@@ -39,22 +39,22 @@
</select>
<select id="queryDataSourceByName" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select *
from t_escheduler_datasource
from t_ds_datasource
where name=#{name}
</select>
<select id="queryAuthedDatasource" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select datasource.*
from t_escheduler_datasource datasource, t_escheduler_relation_datasource_user rel
from t_ds_datasource datasource, t_ds_relation_datasource_user rel
where datasource.id = rel.datasource_id AND rel.user_id = #{userId}
</select>
<select id="queryDatasourceExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select *
from t_escheduler_datasource
from t_ds_datasource
where user_id <![CDATA[ <> ]]> #{userId}
</select>
<select id="listAllDataSourceByType" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select *
from t_escheduler_datasource
from t_ds_datasource
where type = #{type}
</select>
......
......@@ -2,12 +2,12 @@
<!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.DataSourceUserMapper">
<delete id="deleteByUserId">
delete from t_escheduler_datasource_user
delete from t_ds_datasource_user
where user_id = #{userId}
</delete>
<delete id="deleteByDatasourceId">
delete from t_escheduler_datasource_user
delete from t_ds_datasource_user
where datasource_id = #{datasourceId}
</delete>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper">
<select id="countCommandState" resultType="org.apache.dolphinscheduler.dao.entity.CommandCount">
select cmd.command_type as commandType, count(1) as count
from t_escheduler_error_command cmd, t_escheduler_process_definition process
from t_ds_error_command cmd, t_ds_process_definition process
where cmd.process_definition_id = process.id
<if test="projectIdArray != null and projectIdArray.length != 0">
and process.project_id in
......
......@@ -3,18 +3,18 @@
<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_escheduler_process_definition pd
JOIN t_escheduler_user u ON pd.user_id = u.id
JOIN t_escheduler_project p ON pd.project_id = p.id
JOIN t_escheduler_tenant t ON t.id = u.tenant_id
JOIN t_escheduler_queue q ON t.queue_id = q.id
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
FROM t_escheduler_process_definition td
left join (select process_definition_id,release_state as schedule_release_state from t_escheduler_schedules group by process_definition_id,release_state) sc on sc.process_definition_id = td.id
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
where td.project_id = #{projectId}
<if test=" searchVal != null and searchVal != ''">
and td.name like concat('%', #{searchVal}, '%')
......@@ -26,13 +26,13 @@
</select>
<select id="queryAllDefinitionList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
select *
from t_escheduler_process_definition
from t_ds_process_definition
where project_id = #{projectId}
order by create_time desc
</select>
<select id="queryDefinitionListByIdList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
select *
from t_escheduler_process_definition
from t_ds_process_definition
where id in
<foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
#{i}
......@@ -40,8 +40,8 @@
</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_escheduler_process_definition td
JOIN t_escheduler_user tu on tu.id=td.user_id
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
......
......@@ -3,24 +3,24 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapMapper">
<delete id="deleteByParentProcessId">
delete
from t_escheduler_relation_process_instance
from t_ds_relation_process_instance
where parent_process_instance_id=#{parentProcessId}
</delete>
<select id="queryByParentId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap">
select *
from t_escheduler_relation_process_instance
from t_ds_relation_process_instance
where parent_process_instance_id = #{parentProcessId}
and parent_task_instance_id = #{parentTaskId}
</select>
<select id="queryBySubProcessId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap">
select *
from t_escheduler_relation_process_instance
from t_ds_relation_process_instance
where process_instance_id = #{subProcessId}
</select>
<select id="querySubIdListByParentId" resultType="java.lang.Integer">
select process_instance_id
from t_escheduler_process_instance_map
from t_ds_process_instance_map
where parent_process_instance_id = #{parentInstanceId}
</select>
</mapper>
\ No newline at end of file
......@@ -3,12 +3,12 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper">
<select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select inst.*
from t_escheduler_process_instance inst
from t_ds_process_instance inst
where inst.id = #{processId}
</select>
<select id="queryByHostAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select *
from t_escheduler_process_instance
from t_ds_process_instance
where 1=1
<if test="host != null and host != ''">
and host=#{host}
......@@ -21,8 +21,8 @@
</select>
<select id="queryProcessInstanceListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select instance.*
from t_escheduler_process_instance instance
join t_escheduler_process_definition define ON instance.process_definition_id = define.id
from t_ds_process_instance instance
join t_ds_process_definition define ON instance.process_definition_id = define.id
where 1=1
and instance.is_sub_process=0
and define.project_id = #{projectId}
......@@ -47,7 +47,7 @@
order by instance.start_time desc
</select>
<update id="setFailoverByHostAndStateArray">
update t_escheduler_process_instance
update t_ds_process_instance
set host=null
where host =#{host} and state in
<foreach collection="states" index="index" item="i" open="(" close=")" separator=",">
......@@ -55,15 +55,15 @@
</foreach>
</update>
<update id="updateProcessInstanceByState">
update t_escheduler_process_instance
update t_ds_process_instance
set state = #{destState}
where state = #{originState}
</update>
<select id="countInstanceStateByUser" resultType="org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount">
select t.state, count(0) as count
from t_escheduler_process_instance t
join t_escheduler_process_definition d on d.id=t.process_definition_id
join t_escheduler_project p on p.id=d.project_id
from t_ds_process_instance t
join t_ds_process_definition d on d.id=t.process_definition_id
join t_ds_project p on p.id=d.project_id
where 1 = 1
and t.is_sub_process = 0
<if test="startTime != null and endTime != null">
......@@ -79,13 +79,13 @@
</select>
<select id="queryByProcessDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select *
from t_escheduler_process_instance
from t_ds_process_instance
where process_definition_id=#{processDefinitionId}
order by start_time desc limit #{size}
</select>
<select id="queryLastSchedulerProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select *
from t_escheduler_process_instance
from t_ds_process_instance
where process_definition_id=#{processDefinitionId}
<if test="startTime!=null and endTime != null ">
and schedule_time between #{startTime} and #{endTime}
......@@ -94,7 +94,7 @@
</select>
<select id="queryLastRunningProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select *
from t_escheduler_process_instance
from t_ds_process_instance
where 1=1
<if test="states !=null and states.length != 0">
and state in
......@@ -110,7 +110,7 @@
</select>
<select id="queryLastManualProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select *
from t_escheduler_process_instance
from t_ds_process_instance
where process_definition_id=#{processDefinitionId}
and schedule_time is null
<if test="startTime!=null and endTime != null ">
......
......@@ -3,28 +3,28 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProjectMapper">
<select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select p.*,u.user_name as user_name
from t_escheduler_project
join t_escheduler_user u on p.user_id = u.id
from t_ds_project
join t_ds_user u on p.user_id = u.id
where p.id = #{projectId}
</select>
<select id="queryByName" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select p.* u.user_name as user_name
from t_escheduler_project
join t_escheduler_user u on p.user_id = u.id
from t_ds_project
join t_ds_user u on p.user_id = u.id
where p.name = #{projectName}
and p.flag = 1
</select>
<select id="queryProjectListPaging" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select p.*, u.user_name as user_name,
(SELECT COUNT(*) FROM t_escheduler_process_definition AS def WHERE def.project_id = p.id) AS def_count,
(SELECT COUNT(*) FROM t_escheduler_process_definition def, t_escheduler_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count,
from t_escheduler_project p
join t_escheduler_user u on u.id=p.user_id
(SELECT COUNT(*) FROM t_ds_process_definition AS def WHERE def.project_id = p.id) AS def_count,
(SELECT COUNT(*) FROM t_ds_process_definition def, t_ds_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count,
from t_ds_project p
join t_ds_user u on u.id=p.user_id
where 1=1
<if test="userId != 0">
and p.id in
(select project_id from t_escheduler_relation_project_user where user_id=#{userId}
union select id as project_id from t_escheduler_project where user_id=#{userId})
(select project_id from t_ds_relation_project_user where user_id=#{userId}
union select id as project_id from t_ds_project where user_id=#{userId})
)
</if>
<if test="searchName!=null and searchName != ''">
......@@ -36,10 +36,10 @@
<select id="queryAllProjectListPaging" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select p.*, u.user_name as user_name,
(SELECT COUNT(*) FROM t_escheduler_process_definition AS def WHERE def.project_id = p.id) AS def_count,
(SELECT COUNT(*) FROM t_escheduler_process_definition def, t_escheduler_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count,
from t_escheduler_project p
join t_escheduler_user u on u.id=p.user_id
(SELECT COUNT(*) FROM t_ds_process_definition AS def WHERE def.project_id = p.id) AS def_count,
(SELECT COUNT(*) FROM t_ds_process_definition def, t_ds_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count,
from t_ds_project p
join t_ds_user u on u.id=p.user_id
where p.flag=1
<if test="searchName!=null and searchName != ''">
and p.name like concat('%', #{searchName}, '%')
......@@ -48,17 +48,17 @@
</select>
<select id="queryAuthedProjectListByUserId" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select p.*
from t_escheduler_project p,t_escheduler_relation_project_user rel
from t_ds_project p,t_ds_relation_project_user rel
where p.id = rel.project_id and p.flag=1 and rel.user_id= #{userId}
</select>
<select id="queryProjectExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select *
from t_escheduler_project
from t_ds_project
where flag=1 and user_id <![CDATA[ <> ]]> #{userId}
</select>
<select id="queryProjectCreatedByUser" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select *
from t_escheduler_project
from t_ds_project
where user_id = #{userId}
</select>
......
......@@ -2,7 +2,7 @@
<!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.ProjectUserMapper">
<delete id="deleteProjectRelation">
delete from t_escheduler_relation_project_user
delete from t_ds_relation_project_user
where 1=1
and user_id = #{userId}
<if test="projectId != 0 ">
......@@ -11,7 +11,7 @@
</delete>
<select id="queryProjectRelation" resultType="org.apache.dolphinscheduler.dao.entity.ProjectUser">
select *
from t_escheduler_relation_project_user
from t_ds_relation_project_user
where project_id = #{projectId}
and user_id = #{userId}
limit 1
......
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.QueueMapper">
<select id="queryQueuePaging" resultType="org.apache.dolphinscheduler.dao.entity.Queue">
select *
from t_escheduler_queue
from t_ds_queue
where 1= 1
<if test="searchVal != null and searchVal != ''">
and queue_name like concat('%', #{searchVal}, '%')
......@@ -12,7 +12,7 @@
</select>
<select id="queryAllQueueList" resultType="org.apache.dolphinscheduler.dao.entity.Queue">
select *
from t_escheduler_queue
from t_ds_queue
where 1=1
<if test="queue != null and queue != ''">
and queue = #{queue}
......
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ResourceMapper">
<select id="queryResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select *
from t_escheduler_resources
from t_ds_resources
where 1= 1
<if test="alias != null and alias != ''">
and alias = #{alias}
......@@ -17,21 +17,21 @@
</select>
<select id="queryResourceListAuthored" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select *
from t_escheduler_resources
from t_ds_resources
where 1 = 1
<if test="type != -1">
and `type`=#{type}
</if>
and id in (select resources_id from t_escheduler_relation_resources_user where user_id=#{userId}
union select id as resources_id from t_escheduler_resources where user_id=#{userId})
and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId}
union select id as resources_id from t_ds_resources where user_id=#{userId})
</select>
<select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select *
from t_escheduler_resources
from t_ds_resources
where `type`=#{type}
<if test="userId != 0">
and id in (select resources_id from t_escheduler_relation_resources_user where user_id=#{userId}
union select id as resources_id from t_escheduler_resources where user_id=#{userId})
and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId}
union select id as resources_id from t_ds_resources where user_id=#{userId})
</if>
<if test="searchVal != null and searchVal != ''">
and alias like concat('%', #{searchVal}, '%')
......@@ -40,17 +40,17 @@
</select>
<select id="queryAuthorizedResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select r.*
from t_escheduler_resources r,t_escheduler_relation_resources_user rel
from t_ds_resources r,t_ds_relation_resources_user rel
where r.id = rel.resources_id AND rel.user_id = #{userId}
</select>
<select id="queryResourceExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select *
from t_escheduler_resources
from t_ds_resources
where user_id <![CDATA[ <> ]]> #{userId}
</select>
<select id="queryTenantCodeByResourceName" resultType="java.lang.String">
select tenant_code
from t_escheduler_tenant t, t_escheduler_user u, t_escheduler_resources res
from t_ds_tenant t, t_ds_user u, t_ds_resources res
where t.id = u.tenant_id and u.id = res.user_id and res.type=0
and res.alias= #{resName}
</select>
......
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper">
<delete id="deleteResourceUser">
delete
from t_escheduler_relation_resources_user
from t_ds_relation_resources_user
where 1 = 1
<if test="userId != 0">
and user_id = #{userId}
......
......@@ -3,10 +3,10 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ScheduleMapper">
<select id="queryByProcessDefineIdPaging" resultType="org.apache.dolphinscheduler.dao.entity.Schedule">
select p_f.name as process_definition_name, p.name as project_name,u.user_name,s.*
from t_escheduler_schedules s
join t_escheduler_process_definition p_f on s.process_definition_id = p_f.id
join t_escheduler_project as p on p_f.project_id = p.id
join t_escheduler_user as u on s.user_id = u.id
from t_ds_schedules s
join t_ds_process_definition p_f on s.process_definition_id = p_f.id
join t_ds_project as p on p_f.project_id = p.id
join t_ds_user as u on s.user_id = u.id
where 1=1
<if test="processDefinitionId!= 0">
and s.process_definition_id = #{processDefinitionId}
......@@ -15,15 +15,15 @@
</select>
<select id="querySchedulerListByProjectName" resultType="org.apache.dolphinscheduler.dao.entity.Schedule">
select p_f.name as process_definition_name, p_f.description as definition_description, p.name as project_name,u.user_name,s.*
from t_escheduler_schedules s
join t_escheduler_process_definition p_f on s.process_definition_id = p_f.id
join t_escheduler_project as p on p_f.project_id = p.id
join t_escheduler_user as u on s.user_id = u.id
from t_ds_schedules s
join t_ds_process_definition p_f on s.process_definition_id = p_f.id
join t_ds_project as p on p_f.project_id = p.id
join t_ds_user as u on s.user_id = u.id
where p.name = #{projectName}
</select>
<select id="selectAllByProcessDefineArray" resultType="org.apache.dolphinscheduler.dao.entity.Schedule">
select *
from t_escheduler_schedules
from t_ds_schedules
where 1= 1
<if test="processDefineIds != null and processDefineIds.length != 0 ">
and process_definition_id in
......@@ -35,7 +35,7 @@
</select>
<select id="queryByProcessDefinitionId" resultType="org.apache.dolphinscheduler.dao.entity.Schedule">
select *
from t_escheduler_schedules
from t_ds_schedules
where process_definition_id =#{processDefinitionId}
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.SessionMapper">
<select id="queryByUserId" resultType="org.apache.dolphinscheduler.dao.entity.Session">
select *
from t_escheduler_session
from t_ds_session
where user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
......@@ -2,32 +2,32 @@
<!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.TaskInstanceMapper">
<update id="setFailoverByHostAndStateArray">
update t_escheduler_task_instance
update t_ds_task_instance
set state = #{destStatus}
where host = #{host} and state in (#{states})
</update>
<select id="queryById" resultType="org.apache.dolphinscheduler.dao.entity.TaskInstance">
select *, UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
from t_escheduler_task_instance
from t_ds_task_instance
where id=#{taskInstanceId}
</select>
<select id="queryTaskByProcessIdAndState" resultType="java.lang.Integer">
select *, UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
from t_escheduler_task_instance
from t_ds_task_instance
WHERE process_instance_id = #{processInstanceId}
and state = #{state}
and flag = 1
</select>
<select id="findValidTaskListByProcessId" resultType="org.apache.dolphinscheduler.dao.entity.TaskInstance">
select *, UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time) as duration
from t_escheduler_task_instance
from t_ds_task_instance
WHERE process_instance_id = #{processInstanceId}
and flag = #{flag}
order by start_time desc
</select>
<select id="queryByHostAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.TaskInstance">
select *
from t_escheduler_task_instance
from t_ds_task_instance
where 1 = 1
<if test="host != null and host != ''">
and host = #{host}
......@@ -36,9 +36,9 @@
</select>
<select id="countTaskInstanceStateByUser" resultType="org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount">
select state, count(0) as count
from t_escheduler_task_instance t
left join t_escheduler_process_definition d on d.id=t.process_definition_id
left join t_escheduler_project p on p.id=d.project_id
from t_ds_task_instance t
left join t_ds_process_definition d on d.id=t.process_definition_id
left join t_ds_project p on p.id=d.project_id
where 1=1
<if test="projectIds != null and projectIds != ''">
and d.project_id in (#{projectIds})
......@@ -48,14 +48,14 @@
</select>
<select id="queryByInstanceIdAndName" resultType="org.apache.dolphinscheduler.dao.entity.TaskInstance">
select *
from t_escheduler_task_instance
from t_ds_task_instance
where process_instance_id = #{processInstanceId}
and `name` = #{name}
and `flag` = 1
</select>
<select id="countTask" resultType="java.lang.Integer">
select count(1) as `count`
from t_escheduler_task_instance task,t_escheduler_process_definition process
from t_ds_task_instance task,t_ds_process_definition process
where task.process_definition_id=process.id
<if test="projectIds != null and projectIds != ''">
and process.project_id in (#{projectIds})
......@@ -69,8 +69,8 @@
</select>
<select id="queryTaskInstanceListPaging" resultType="org.apache.dolphinscheduler.dao.entity.TaskInstance">
select instance.*,process.name as process_instance_name, UNIX_TIMESTAMP(instance.end_time)-UNIX_TIMESTAMP(instance.start_time) as duration
from t_escheduler_task_instance instance
join t_escheduler_process_definition define ON instance.process_definition_id = define.id
from t_ds_task_instance instance
join t_ds_process_definition define ON instance.process_definition_id = define.id
join process on process.id=instance.process_instance_id
where define.project_id = #{projectId}
<if test="startTime != null">
......
......@@ -3,18 +3,18 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.TenantMapper">
<select id="queryById" resultType="org.apache.dolphinscheduler.dao.entity.Tenant">
SELECT t.*,q.queue_name,q.queue
FROM t_escheduler_tenant t,t_escheduler_queue q
FROM t_ds_tenant t,t_ds_queue q
WHERE t.queue_id = q.id
and t.id = #{tenantId}
</select>
<select id="queryByTenantCode" resultType="org.apache.dolphinscheduler.dao.entity.Tenant">
select *
from t_escheduler_tenant
from t_ds_tenant
where tenant_code = #{tenantCode}
</select>
<select id="queryTenantPaging" resultType="org.apache.dolphinscheduler.dao.entity.Tenant">
SELECT t.*,q.queue_name
FROM t_escheduler_tenant t,t_escheduler_queue q
FROM t_ds_tenant t,t_ds_queue q
WHERE t.queue_id = q.id
<if test="searchVal != null and searchVal != ''">
and t.tenant_name like concat('%', #{searchVal}, '%')
......
......@@ -2,11 +2,11 @@
<!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.UDFUserMapper">
<delete id="deleteByUserId">
delete from t_escheduler_relation_udfs_user
delete from t_ds_relation_udfs_user
where `user_id` = #{userId}
</delete>
<delete id="deleteByUdfFuncId">
delete from t_escheduler_relation_udfs_user
delete from t_ds_relation_udfs_user
where `udf_id` = #{udfFuncId}
</delete>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper">
<select id="queryUdfByIdStr" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc">
select *
from t_escheduler_udfs
from t_ds_udfs
where 1 = 1
<if test="ids != null and ids != ''">
and id in
......@@ -18,36 +18,36 @@
</select>
<select id="queryUdfFuncPaging" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc">
select *
from t_escheduler_udfs
from t_ds_udfs
where 1=1
<if test="searchVal!= null and searchVal != ''">
and `name` like concat('%', #{searchVal}, '%')
</if>
<if test="userId != 0">
and id in (
select udf_id from t_escheduler_relation_udfs_user where user_id=#{userId}
union select id as udf_id from t_escheduler_udfs where user_id=#{userId})
select udf_id from t_ds_relation_udfs_user where user_id=#{userId}
union select id as udf_id from t_ds_udfs where user_id=#{userId})
</if>
order by create_time desc
</select>
<select id="getUdfFuncByType" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc">
select *
from t_escheduler_udfs
from t_ds_udfs
where `type` = #{type}
<if test="userId != 0">
and id in (
select udf_id from t_escheduler_relation_udfs_user where user_id=#{userId}
union select id as udf_id from t_escheduler_udfs where user_id=#{userId})
select udf_id from t_ds_relation_udfs_user where user_id=#{userId}
union select id as udf_id from t_ds_udfs where user_id=#{userId})
</if>
</select>
<select id="queryUdfFuncExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc">
select *
from t_escheduler_udfs
from t_ds_udfs
where user_id <![CDATA[ <> ]]> #{userId}
</select>
<select id="queryAuthedUdfFunc" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc">
SELECT u.*
from t_escheduler_udfs u,t_escheduler_relation_udfs_user rel
from t_ds_udfs u,t_ds_relation_udfs_user rel
WHERE u.id = rel.udf_id
AND rel.user_id = #{userId}
</select>
......
......@@ -2,13 +2,13 @@
<!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.UserAlertGroupMapper">
<delete id="deleteByAlertgroupId">
delete from t_escheduler_relation_user_alertgroup
delete from t_ds_relation_user_alertgroup
where `alertgroup_id` = #{alertgroupId}
</delete>
<select id="listUserByAlertgroupId" resultType="org.apache.dolphinscheduler.dao.entity.User">
SELECT u.*
FROM t_escheduler_relation_user_alertgroup g_u
JOIN t_escheduler_user u on g_u.user_id = u.id
FROM t_ds_relation_user_alertgroup g_u
JOIN t_ds_user u on g_u.user_id = u.id
WHERE g_u.alertgroup_id = #{alertgroupId}
</select>
</mapper>
\ No newline at end of file
......@@ -3,15 +3,15 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.UserMapper">
<select id="queryAllGeneralUser" resultType="org.apache.dolphinscheduler.dao.entity.User">
select * from t_escheduler_user
select * from t_ds_user
where user_type=1;
</select>
<select id="queryByUserNameAccurately" resultType="org.apache.dolphinscheduler.dao.entity.User">
select * from t_escheduler_user
select * from t_ds_user
where user_name=#{userName}
</select>
<select id="queryUserByNamePassword" resultType="org.apache.dolphinscheduler.dao.entity.User">
select * from t_escheduler_user
select * from t_ds_user
where user_name=#{userName} and user_password = #{password}
</select>
......@@ -19,9 +19,9 @@
select u.id,u.user_name,u.user_password,u.user_type,u.email,u.phone,u.tenant_id,u.create_time,
u.update_time,t.tenant_name,
case when u.queue <![CDATA[ <> ]]> '' then u.queue else q.queue_name end as queue, q.queue_name
from t_escheduler_user u
left join t_escheduler_tenant t on u.tenant_id=t.id
left join t_escheduler_queue q on t.queue_id = q.id
from t_ds_user u
left join t_ds_tenant t on u.tenant_id=t.id
left join t_ds_queue q on t.queue_id = q.id
where 1=1
<if test="userName!=null and userName != ''" >
and u.user_name like concat ('%', #{userName}, '%')
......@@ -32,24 +32,24 @@
<select id="queryDetailsById" resultType="org.apache.dolphinscheduler.dao.entity.User">
select u.*, t.tenant_name,
case when u.queue <![CDATA[ <> ]]> '' then u.queue else q.queue_name end as queue_name
from t_escheduler_user u,t_escheduler_tenant t,t_escheduler_queue q
from t_ds_user u,t_ds_tenant t,t_ds_queue q
WHERE u.tenant_id = t.id and t.queue_id = q.id and u.id = #{userId}
</select>
<select id="queryUserListByAlertGroupId" resultType="org.apache.dolphinscheduler.dao.entity.User">
select u.*
from t_escheduler_user u, t_escheduler_relation_user_alertgroup rel
from t_ds_user u, t_ds_relation_user_alertgroup rel
where u.id = rel.user_id AND u.user_type = 1 AND rel.alertgroup_id = #{alertgroupId}
</select>
<select id="queryTenantCodeByUserId" resultType="org.apache.dolphinscheduler.dao.entity.User">
SELECT u.*,t.tenant_code
FROM t_escheduler_user u, t_escheduler_tenant t
FROM t_ds_user u, t_ds_tenant t
WHERE u.tenant_id = t.id AND u.id = #{userId}
</select>
<select id="queryUserByToken" resultType="org.apache.dolphinscheduler.dao.entity.User">
select u.*
from t_escheduler_user u ,t_escheduler_access_token t
from t_ds_user u ,t_ds_access_token t
where u.id = t.user_id and token=#{token} and t.expire_time > NOW()
</select>
</mapper>
\ No newline at end of file
......@@ -3,17 +3,17 @@
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper">
<select id="queryAllWorkerGroup" resultType="org.apache.dolphinscheduler.dao.entity.WorkerGroup">
select *
from t_escheduler_worker_group
from t_ds_worker_group
order by update_time desc
</select>
<select id="queryWorkerGroupByName" resultType="org.apache.dolphinscheduler.dao.entity.WorkerGroup">
select *
from t_escheduler_worker_group
from t_ds_worker_group
where `name` = #{name}
</select>
<select id="queryListPaging" resultType="org.apache.dolphinscheduler.dao.entity.WorkerGroup">
select *
from t_escheduler_worker_group
from t_ds_worker_group
where 1 = 1
<if test="searchVal != null and searchVal != ''">
and name like concat('%', #{searchVal}, '%')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册