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

flowable.CustomTaskMapper.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.flowable.task.service.impl.persistence.entity.TaskEntityImpl">
    <select id="selectTasks" parameterType="com.xlrit.gears.engine.flowable.CustomTaskListQuery" resultMap="taskResultMap">
        <if test="needsPaging">${limitBefore}</if>
        select RES.* <if test="needsPaging">${limitBetween}</if>
        <include refid="fromWherePart"/>
        ${orderBy}
        <if test="needsPaging">${limitAfter}</if>
    </select>

    <select id="countTasks" parameterType="com.xlrit.gears.engine.flowable.CustomTaskListQuery" resultType="long">
        select count(distinct RES.ID_)
        <include refid="fromWherePart"/>
    </select>

    <sql id="fromWherePart">
        from ${prefix}ACT_RU_TASK RES
        <where>
            <choose>
                <when test="assigned == true">
                    and RES.ASSIGNEE_ IS NOT NULL
                </when>
                <when test="assigned == false">
                    and RES.ASSIGNEE_ IS NULL
                </when>
            </choose>
            <if test="assignee != null">
                and RES.ASSIGNEE_ = #{assignee}
            </if>
            <if test="assigneeNot != null">
                and RES.ASSIGNEE_ != #{assigneeNot}
            </if>
            <if test="candidateGroups != null &amp;&amp; candidateGroups.size() &gt; 0">
                and exists (
                select LINK.ID_ from ${prefix}ACT_RU_IDENTITYLINK LINK where LINK.TYPE_ = 'candidate' and LINK.TASK_ID_ = RES.ID_
                and LINK.GROUP_ID_ IN
                <foreach item="candidateGroup" collection="candidateGroups" open="(" separator="," close=")">
                    #{candidateGroup}
                </foreach>
                )
            </if>
            <if test="filter != null &amp;&amp; !filter.isEmpty()">
                <include refid="search"/>
            </if>
        </where>
    </sql>

    <!-- NOTE that the task name contains the process name as well -->
    <sql id="search">
        and (
            lower(RES.NAME_) like #{likeFilter}
            or
            lower(RES.DESCRIPTION_) like #{likeFilter}
            or
            lower(RES.CATEGORY_) like #{likeFilter}
        )
    </sql>

    <sql id="search" databaseId="postgres">
        and (
            to_tsvector(concat_ws(' ||| ', RES.NAME_, RES.DESCRIPTION_, RES.CATEGORY_)) @@ websearch_to_tsquery(#{filter})
        )
    </sql>
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy