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

mappers.WorkflowTaskEntityMapper.xml Maven / Gradle / Ivy

The 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.inlong.manager.dao.mapper.WorkflowTaskEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.WorkflowTaskEntity">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="type" jdbcType="VARCHAR" property="type"/>
        <result column="process_id" jdbcType="INTEGER" property="processId"/>
        <result column="process_name" jdbcType="VARCHAR" property="processName"/>
        <result column="process_display_name" jdbcType="VARCHAR" property="processDisplayName"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="display_name" jdbcType="VARCHAR" property="displayName"/>
        <result column="tenant" jdbcType="VARCHAR" property="tenant"/>
        <result column="applicant" jdbcType="VARCHAR" property="applicant"/>
        <result column="approvers" jdbcType="VARCHAR" property="approvers"/>
        <result column="status" jdbcType="VARCHAR" property="status"/>
        <result column="operator" jdbcType="VARCHAR" property="operator"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
        <result column="form_data" jdbcType="LONGVARCHAR" property="formData"/>
        <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, type, process_id, process_name, process_display_name, name, display_name, tenant, applicant, approvers,
        status, operator, remark, start_time, end_time, form_data, ext_params
    </sql>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
            parameterType="org.apache.inlong.manager.dao.entity.WorkflowTaskEntity">
        insert into workflow_task (id, type, process_id,
                                   process_name, process_display_name,
                                   name, display_name, tenant,
                                   applicant, approvers, status,
                                   operator, remark, start_time,
                                   end_time, form_data, ext_params)
        values (#{id,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{processId,jdbcType=INTEGER},
                #{processName,jdbcType=VARCHAR}, #{processDisplayName,jdbcType=VARCHAR},
                #{name,jdbcType=VARCHAR}, #{displayName,jdbcType=VARCHAR},  #{tenant,jdbcType=VARCHAR},
                #{applicant,jdbcType=VARCHAR}, #{approvers,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
                #{operator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP},
                #{endTime,jdbcType=TIMESTAMP}, #{formData,jdbcType=LONGVARCHAR}, #{extParams,jdbcType=LONGVARCHAR})
    </insert>

    <select id="selectById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from workflow_task
        where tenant = #{tenant,jdbcType=VARCHAR}
        and id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectByProcess" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from workflow_task
        where tenant = #{tenant,jdbcType=VARCHAR}
        and process_id = #{processId,jdbcType=INTEGER}
        and status = #{status,jdbcType=VARCHAR}
    </select>
    <select id="selectByQuery"
            parameterType="org.apache.inlong.manager.pojo.workflow.TaskRequest"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from workflow_task
        <where>
            tenant = #{tenant,jdbcType=VARCHAR}
            <if test="id != null">
                and id = #{id,jdbcType=INTEGER}
            </if>
            <if test="processId != null">
                and process_id = #{processId,jdbcType=INTEGER}
            </if>
            <if test="type != null and type !=''">
                and type = #{type,jdbcType=VARCHAR}
            </if>
            <if test="name != null and name !=''">
                and name = #{name,jdbcType=VARCHAR}
            </if>
            <if test="displayName != null and displayName !=''">
                and display_name = #{displayName,jdbcType=VARCHAR}
            </if>
            <if test="approver != null and approver !=''">
                and (
                (find_in_set(#{approver,jdbcType=VARCHAR},approvers) and status='PENDING')
                or operator = #{approver,jdbcType=VARCHAR}
                )
            </if>
            <if test="operator != null and operator !=''">
                and operator = #{operator,jdbcType=VARCHAR}
            </if>
            <if test="applicant != null and applicant !=''">
                and applicant = #{applicant,jdbcType=VARCHAR}
            </if>
            <if test="statusSet != null and statusSet.size()>0">
                AND status IN
                <foreach item="item" index="index" collection="statusSet" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="startTimeBegin != null">
                and start_time >= #{startTimeBegin,jdbcType=TIMESTAMP}
            </if>
            <if test="startTimeEnd != null">
                and start_time &lt;= #{startTimeEnd,jdbcType=TIMESTAMP}
            </if>
            <if test="endTimeBegin != null">
                and end_time >= #{endTimeBegin,jdbcType=TIMESTAMP}
            </if>
            <if test="endTimeEnd != null">
                and end_time &lt;= #{endTimeEnd,jdbcType=TIMESTAMP}
            </if>
        </where>
        order by id desc
    </select>
    <select id="countByStatus" resultType="java.lang.Integer">
        select count(1)
        from workflow_task
        where tenant = #{tenant,jdbcType=VARCHAR}
          and process_id = #{processId, jdbcType=INTEGER}
          and name = #{name, jdbcType=VARCHAR}
          and status = #{status, jdbcType=VARCHAR}
    </select>
    <select id="countByQuery"
            parameterType="org.apache.inlong.manager.pojo.workflow.TaskCountRequest"
            resultType="org.apache.inlong.manager.pojo.common.CountInfo">
        select status as `key`, count(1) as `value`
        from workflow_task
        <where>
            tenant = #{tenant,jdbcType=VARCHAR}
            <if test="processId != null">
                and process_id = #{processId,jdbcType=INTEGER}
            </if>
            <if test="type != null and type !=''">
                and type = #{type,jdbcType=VARCHAR}
            </if>
            <if test="name != null and name !=''">
                and name = #{name,jdbcType=VARCHAR}
            </if>
            <if test="displayName != null and displayName !=''">
                and display_name = #{displayName,jdbcType=VARCHAR}
            </if>
            <if test="approver != null and approver !=''">
                and (
                (find_in_set(#{approver,jdbcType=VARCHAR},approvers) and status='PENDING')
                or operator = #{approver,jdbcType=VARCHAR}
                )
            </if>
            <if test="applicant != null and applicant !=''">
                and applicant = #{applicant,jdbcType=VARCHAR}
            </if>
            <if test="startTimeBegin != null">
                and start_time >= #{startTimeBegin,jdbcType=TIMESTAMP}
            </if>
            <if test="startTimeEnd != null">
                and start_time &lt;= #{startTimeEnd,jdbcType=TIMESTAMP}
            </if>
            <if test="endTimeBegin != null">
                and end_time >= #{endTimeBegin,jdbcType=TIMESTAMP}
            </if>
            <if test="endTimeEnd != null">
                and end_time &lt;= #{endTimeEnd,jdbcType=TIMESTAMP}
            </if>
        </where>
        group by status
    </select>

    <update id="update" parameterType="org.apache.inlong.manager.dao.entity.WorkflowTaskEntity">
        update workflow_task
        set status     = #{status,jdbcType=VARCHAR},
            operator   = #{operator,jdbcType=VARCHAR},
            remark     = #{remark,jdbcType=VARCHAR},
            form_data  = #{formData,jdbcType=LONGVARCHAR},
            ext_params = #{extParams,jdbcType=LONGVARCHAR},
            end_time   = #{endTime,jdbcType=TIMESTAMP}
        where tenant = #{tenant,jdbcType=VARCHAR}
        and id = #{id,jdbcType=INTEGER}
    </update>

    <delete id="deleteByProcessIds">
        delete
        from workflow_task
        where process_id in
        <foreach item="item" index="index" collection="processIdList" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and tenant = #{tenant,jdbcType=VARCHAR}
    </delete>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy