activiti中的查询sql

Posted CodeZLei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了activiti中的查询sql相关的知识,希望对你有一定的参考价值。

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

<mapper namespace="com.le.ssm.dao.flow.FlowTaskMapper">

    <!-- 参数映射 -->
    <resultMap id="TaskRM" type="com.le.ssm.domain.flow.Task">
        <id property="id" column="id_" javaType="String" jdbcType="VARCHAR"/>
        <result property="startTime" column="start_time_" javaType="Date" jdbcType="TIMESTAMP"/>
        <result property="endTime" column="end_time_" javaType="Date" jdbcType="TIMESTAMP"/>
        <result property="status" column="status" javaType="String" jdbcType="CHAR"/>
    </resultMap>
    
    <!-- 
        分页查询指定人的任务 
        status: 1:待签收 2:已经签收3:历史任务   
    -->
    <sql id="getAllTaskSQL">
        <!-- 查询待签收  -->
        select
            art.id_,
            art.create_time_ start_time_,
            null as end_time_,
            "1" as `status` 
        from
            act_ru_task art
            left join act_ru_identitylink ari on art.id_ = ari.task_id_ 
        where
            art.assignee_ is null 
            and (
                ( ari.user_id_ = #{userId} ) 
                or (
                    ari.group_id_ in (
                    select
                        aig.id_ 
                    from
                        act_id_user aiu
                        inner join act_id_membership aim on aiu.id_ = #{userId} 
                        and aiu.id_ = aim.user_id_
                        inner join act_id_group aig on aig.id_ = aim.group_id_ 
                    ) 
                ) 
            ) 
        
        union all
        <!-- 查询已签收  -->
        select
            art.id_,
            art.create_time_ start_time_,
            null as end_time_,
            "2" as `status` 
        from
            act_ru_task art 
        where
            art.assignee_ = #{userId} 
            
            
        union all
        <!-- 查询已完成 -->
        select
            aht.id_,
            aht.start_time_,
            aht.end_time_,
            "3" as `status` 
        from
            act_hi_taskinst aht 
        where
            aht.assignee_ = #{userId}
    </sql>
        
    <select id="getAllTask" resultMap="TaskRM">
        select 
            tab.id_,
            tab.start_time_,
            tab.end_time_,
            tab.`status`  
        from 
            (<include refid="getAllTaskSQL" />) tab
        order by tab.start_time_ desc
        limit #{pageNum}, #{pageSize}
    </select>
    
    <select id="getAllTaskCount" resultMap="TaskRM">
        select 
            count(1)
        from 
            (<include refid="getAllTaskSQL" />) tab
    </select>
</mapper>

 

以上是关于activiti中的查询sql的主要内容,如果未能解决你的问题,请参考以下文章

activiti中的查询sql

如何将片段中的 ListView 对象的数据传递给 Activity?

如何在 Activity(非 AppCompatActivity)中打开片段?

sql [SQL查询片段]用于在命令行或通过R和其他工具使用SQL的快速代码段#tags:sql,R,text processing,命令li

在android中的一个Activity中添加两个片段

将字符串数据从Activity发送到片段[关闭]