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

iqiny.silly.mapping.activiti.MyActivitiDao.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8" ?>
<!--

     Copyright  iqiny.com

     https://gitee.com/iqiny/silly

     project name:silly-activiti
     project description:top silly project pom.xml file

-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iqiny.silly.core.engine.SillyMasterTask">

    <select id="getDoingMasterTask" resultType="com.iqiny.silly.core.engine.SillyMasterTask">
        SELECT
        T4.CATEGORY_ AS "category",
        T4.KEY_ AS "processKey",
        T1.ID_ AS "taskId",
        T1.TASK_DEF_KEY_ AS "nodeKey",
        T1.NAME_ AS "nodeName",
        T2.BUSINESS_KEY_ AS "masterId",
        T5.BUSINESS_KEY_ AS "executeBusinessId",
        T3.USER_ID_ AS "userId",
        T1.ASSIGNEE_ AS "assignee",
        T3.GROUP_ID_ AS "groupId"
        FROM ACT_RU_TASK T1
        INNER JOIN ACT_HI_PROCINST T2 ON T2.ID_ = T1.PROC_INST_ID_
        LEFT JOIN ACT_RU_IDENTITYLINK T3 ON T3.TASK_ID_ = T1.ID_
        LEFT JOIN ACT_RE_PROCDEF T4 ON T4.ID_ = T1.PROC_DEF_ID_
        LEFT JOIN ACT_RU_EXECUTION T5 ON T5.ID_ = T1.EXECUTION_ID_
        WHERE T2.BUSINESS_KEY_ IS NOT NULL
        <if test="processKeys!=null and !processKeys.isEmpty()">
            AND T4.KEY_ IN
            <foreach collection="processKeys" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="businessKey!=null and businessKey!=''">
            AND T2.BUSINESS_KEY_ = #{businessKey}
        </if>
        <if test="(userId!=null and userId!='') or (allGroupId!=null and !allGroupId.isEmpty())">
            AND (T3.USER_ID_ = #{userId} OR T1.ASSIGNEE_ = #{userId}
            <if test="allGroupId!=null and !allGroupId.isEmpty()">
                OR T3.GROUP_ID_ IN
                <foreach collection="allGroupId" item="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            )
        </if>
        ORDER BY T1.CREATE_TIME_ DESC
    </select>

    <select id="getHistoryMasterTask" resultType="com.iqiny.silly.core.engine.SillyMasterTask">
        SELECT
        T3.CATEGORY_ AS "category",
        T3.KEY_ AS "processKey",
        T1.TASK_DEF_KEY_ AS "nodeKey",
        T1.NAME_ AS "nodeName",
        T2.BUSINESS_KEY_ AS "masterId"
        FROM ACT_HI_TASKINST T1
        INNER JOIN ACT_HI_PROCINST T2 ON T2.ID_ = T1.PROC_INST_ID_
        INNER JOIN ACT_RE_PROCDEF T3 ON T3.ID_ = T1.PROC_DEF_ID_
        WHERE T2.BUSINESS_KEY_ IS NOT NULL
        <if test="processKeys!=null and !processKeys.isEmpty()">
            AND T3.KEY_ IN
            <foreach collection="processKeys" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="userId!=null and userId!=''">
            AND T1.ASSIGNEE_ = #{userId}
        </if>
        ORDER BY T1.END_TIME_ DESC
    </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy