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

camunda-extends-mappings.ExtendedTaskMapper.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="cn.herodotus.cloud.bpmn.logic.camunda.mapper.ExtendedTaskMapper">
    <resultMap id="TaskResultMap" type="cn.herodotus.cloud.bpmn.logic.camunda.entity.ExtendedTask">
        <id column="task_id_" property="taskId" />
        <result column="activity_id_" property="activityId" />
        <result column="activity_name_" property="activityName" />
        <result column="tenant_id_" property="tenantId" />
        <result column="business_key_" property="businessKey" />
        <result column="proc_def_id_" property="processDefinitionId" />
        <result column="proc_inst_id_" property="processInstanceId" />
        <result column="execution_id_" property="executionId" />
        <result column="start_time_" property="startTime" jdbcType="TIMESTAMP" />
        <result column="end_time_" property="endTime" jdbcType="TIMESTAMP" />
        <result column="assignee_name_" property="assigneeName" />
        <result column="assignee_id_" property="assigneeId" />
        <result column="owner_name_" property="ownerName" />
        <result column="owner_id_" property="ownerId" />
        <result column="start_user_name_" property="startUsername" />
        <result column="start_user_id_" property="startUserId" />
    </resultMap>

    <select id="getToDoTasksByPage" resultMap="TaskResultMap">
        SELECT DISTINCT
            t1.id_ AS task_id_,
            t1.task_def_key_ AS activity_id_,
            t1.name_ AS activity_name_,
            t1.tenant_id_,
            t2.business_key_,
            t1.proc_def_id_,
            t1.proc_inst_id_,
            t1.execution_id_,
            t1.create_time_ AS start_time_,
            t1.last_updated_ AS end_time_,
            ( SELECT t5.first_ FROM act_id_user t5 WHERE t5.id_ = t1.assignee_ ) AS assignee_name_,
            ( SELECT t5.first_ FROM act_id_user t5 WHERE t5.id_ = t1.owner_ ) AS owner_name_,
            t1.assignee_ AS assignee_id_,
            t1.owner_ AS owner_id_,
            t3.start_user_id_,
            ( SELECT t5.first_ FROM act_id_user t5 WHERE t5.id_ = t3.start_user_id_ ) AS start_user_name_
        FROM
            act_ru_task t1
                INNER JOIN act_ru_execution t2 ON t1.execution_id_ = t2.id_
                INNER JOIN act_hi_procinst t3 ON t1.proc_inst_id_ = t3.proc_inst_id_
                LEFT JOIN act_ru_identitylink t4 ON t4.task_id_ = t1.id_
        WHERE
            t2.business_key_ IS NOT NULL
          AND (
                    t1.assignee_ = #{employeeId}
                OR t1.owner_ = #{employeeId}
                OR (
                                t4.type_ = 'candidate'
                            AND ( t4.user_id_ = #{employeeId} OR t4.group_id_ IN ( SELECT t6.group_id_ FROM act_id_membership t6 WHERE t6.user_id_ = #{employeeId} ) )
                        )
            )
    </select>
    <select id="getCompletedTasksByPage" resultMap="TaskResultMap">
        SELECT DISTINCT
            t1.id_ AS task_id_,
            t1.task_def_key_ AS activity_id_,
            t1.name_ AS activity_name_,
            t1.tenant_id_,
            t2.business_key_,
            t1.proc_def_id_,
            t1.proc_inst_id_,
            t1.execution_id_,
            t1.start_time_,
            t1.end_time_,
            ( SELECT t3.first_ FROM act_id_user t3 WHERE t3.id_ = t1.assignee_ ) AS assignee_name_,
            ( SELECT t3.first_ FROM act_id_user t3 WHERE t3.id_ = t1.owner_ ) AS owner_name_,
            t1.assignee_ AS assignee_id_,
            t1.owner_ AS owner_id_,
            t2.start_user_id_,
            ( SELECT t3.first_ FROM act_id_user t3 WHERE t3.id_ = t2.start_user_id_ ) AS start_user_name_
        FROM
            act_hi_taskinst t1
                LEFT JOIN act_hi_procinst t2 ON t1.proc_inst_id_ = t2.id_
                LEFT JOIN act_id_user t3 ON t3.id_ = t1.assignee_
        WHERE
            t1.end_time_ IS NOT NULL
          AND ( t1.assignee_ = #{employeeId} OR t1.owner_ = #{employeeId} )
    </select>
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy