Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2019 WeBank
~
~ Licensed 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="com.webank.wedatasphere.dss.server.dao.FlowMapper">
<sql id="flow_main">
id,`name`,`state`,`source`,`description`,`create_time`,`creator_id`,`is_root_flow`,`rank`,`project_id`,`has_saved`,`uses`
</sql>
<sql id="flow_version">
id,`flow_id`,`source`,`version`,`json_path`,`comment`,`update_time`,`updator_id`,`project_version_id`
</sql>
<select id="selectFlowByID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlow">
SELECT * FROM `dss_flow` WHERE id = #{id}
</select>
<select id="listFlowByTaxonomyID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlow">
SELECT
f.*
FROM
`dss_flow_taxonomy_relation` ftr
LEFT JOIN dss_flow f ON ftr.flow_id = f.id
WHERE
ftr.taxonomy_id = #{taxonomyID} <if test="isRootFlow != false"> AND f.is_root_flow = #{isRootFlow}</if>
AND f.project_id=#{projectID}
</select>
<!-- <select id="listFlowByTaxonomyID" resultType="com.webank.bdp.dataworkcloud.wtss.entity.DWSFlow">
SELECT
f.*
FROM
`dss_flow_taxonomy_relation` ftr
LEFT JOIN dss_flow f ON ftr.flow_id = f.id
WHERE
ftr.taxonomy_id = #{taxonomyID} AND f.is_root_flow = #{isRootFlow}
</select>-->
<!--<resultMap id="flowWithVersionsMap" type="com.webank.bdp.dataworkcloud.wtss.entity.DWSFlow">
<id column="id" property="id"/>
<collection property="versions" column="id" select="test"/>
</resultMap>
<select id="listFlowByTaxonomyID" resultMap="flowWithVersionsMap">
SELECT
f.*
FROM
`dss_flow_taxonomy_relation` ftr
LEFT JOIN dss_flow f ON ftr.flow_id = f.id
WHERE
ftr.taxonomy_id = #{taxonomyID} AND f.is_root_flow = #{isRootFlow}
</select>
<select id="test" resultType="com.webank.bdp.dataworkcloud.wtss.entity.DWSFlowVersion">
SELECT * FROM dss_flow_version fv WHERE fv.flow_id = #{id}
</select>-->
<select id="listFlowVersionsByFlowID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
SELECT
fv.*, bdu.`name` AS 'updator',
ISNULL(fph.id) AS 'is_not_published'
FROM
dss_flow_version fv
LEFT JOIN dss_user bdu ON fv.updator_id = bdu.id
LEFT JOIN dss_flow_publish_history fph ON fv.id = fph.flow_version_id
WHERE
fv.flow_id =#{flowID} AND fv.project_version_id = #{projectVersionID}
</select>
<insert id="insertFlow" useGeneratedKeys="true" keyProperty="id" parameterType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlow">
INSERT INTO dss_flow (<include refid = "flow_main" />)
VALUES
(#{id},#{name},#{state},#{source},#{description},#{createTime},#{creatorID},#{isRootFlow},#{rank},#{projectID},#{hasSaved},#{uses})
</insert>
<insert id="insertFlowVersion" useGeneratedKeys="true" keyProperty="id" parameterType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
INSERT INTO dss_flow_version (<include refid = "flow_version" />)
VALUES
(#{id},#{flowID},#{source},#{version},#{jsonPath},#{comment},#{updateTime},#{updatorID},#{projectVersionID})
</insert>
<insert id="batchInsertFlowVersion" parameterType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
INSERT INTO dss_flow_version
( `flow_id`,`source`,`version`,`json_path`,`comment`,`update_time`,`updator_id`,`project_version_id`)
VALUES
<foreach collection="flowVersions" item="fv" separator="," >
(#{fv.flowID},#{fv.source},#{fv.version},#{fv.jsonPath},#{fv.comment},#{fv.updateTime},#{fv.updatorID},#{fv.projectVersionID})
</foreach>
</insert>
<update id="batchUpdateFlowVersion" parameterType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
<foreach collection="flowVersions" item="fv" index="index" open="" close="" separator=";">
UPDATE dss_flow_version
<set> source= #{fv.source} </set>
<set> version= #{fv.version} </set>
<set> json_path= #{fv.jsonPath} </set>
<set> comment= #{fv.comment} </set>
<set> update_time= #{fv.updateTime} </set>
<set> updator_id= #{fv.updatorID}</set>
<set> project_version_id= #{fv.projectVersionID}</set>
<where> flow_id = #{fv.flowID} </where>
</foreach>
</update>
<insert id="insertFlowRelation">
INSERT INTO dss_flow_relation (flow_id,parent_flow_id)
VALUES
(#{flowID},#{parentFlowID})
</insert>
<select id="selectVersionByFlowID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
SELECT
fv.*, bdu.`name` AS 'updator',
ISNULL(fph.id) AS 'is_not_published'
FROM
dss_flow_version fv
LEFT JOIN dss_user bdu ON fv.updator_id = bdu.id
LEFT JOIN dss_flow_publish_history fph ON fv.id = fph.flow_version_id
WHERE
fv.flow_id = #{flowID}
AND fv.version =#{version}
AND fv.project_version_id = #{projectVersionID}
</select>
<update id="updateFlowBaseInfo" parameterType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlow">
UPDATE dss_flow
<trim prefix="set" suffixOverrides=",">
<if test="name != null">name=#{name},</if>
<if test="description != null">description=#{description},</if>
<if test="hasSaved != null">has_saved=#{hasSaved},</if>
<if test="uses != null">uses=#{uses},</if>
</trim>
WHERE id =#{id}
</update>
<select id="selectSubFlowIDByParentFlowID" resultType="Long">
SELECT fr.flow_id FROM `dss_flow_relation` fr WHERE fr.parent_flow_id = #{parentFlowID}
</select>
<delete id="deleteFlowVersions">
DELETE
FROM
dss_flow_version
WHERE flow_id = #{flowID} <if test="projectVersionID != null"> AND project_version_id = #{projectVersionID}</if>
</delete>
<delete id="deleteFlowBaseInfo">
DELETE
FROM
dss_flow
WHERE id = #{flowID}
</delete>
<delete id="deleteFlowRelation">
DELETE
FROM
dss_flow_relation
WHERE flow_id = #{flowID}
</delete>
<select id="selectParentFlowIDByFlowID" resultType="Long">
SELECT
parent_flow_id
FROM
`dss_flow_relation`
WHERE
flow_id = #{flowID}
</select>
<select id="listFlowByProjectID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlow">
SELECT
*
FROM
`dss_flow`
WHERE
project_id = #{projectID}
</select>
<select id="listVersionByFlowIDAndProjectVersionID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
SELECT
fv.*, bdu.`name` AS 'updator',
ISNULL(fph.id) AS 'is_not_published'
FROM
dss_flow_version fv
LEFT JOIN dss_user bdu ON fv.updator_id = bdu.id
LEFT JOIN dss_flow_publish_history fph ON fv.id = fph.flow_version_id
WHERE
fv.flow_id = #{flowID} AND fv.project_version_id = #{projectVersionID}
</select>
<select id="noVersions" resultType="Boolean">
SELECT
ISNULL(fv.id)
FROM
`dss_flow` f
LEFT JOIN dss_flow_version fv ON f.id = fv.flow_id
WHERE
f.id = #{flowID}
LIMIT 1
</select>
<select id="listLastFlowVersionsByProjectVersionID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion" >
select <include refid = "flow_version" />
from dss_flow_version as fv
where version =
(select max(version) from dss_flow_version
where project_version_id =#{projectVersionID}
and fv.project_version_id = project_version_id
and fv.flow_id=flow_id ) ;
</select>
<select id="listLatestRootFlowVersionByProjectVersionID" resultType="com.webank.wedatasphere.dss.common.entity.flow.DWSFlowVersion">
SELECT
fv.*
FROM
dss_flow f
LEFT JOIN dss_flow_version fv ON f.id = fv.flow_id
WHERE
fv.id IN (
SELECT
MAX(id)
FROM
dss_flow_version
GROUP BY
flow_id
)
AND fv.project_version_id = #{projectVersionID}
AND f.is_root_flow = TRUE
ORDER BY
fv.version
</select>
<select id="getParentFlowID" resultType="Long">
SELECT parent_flow_id FROM dss_flow_relation WHERE flow_id = #{flowID}
</select>
</mapper>