<?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="com.chinaweal.aiccs.aiccs.business.mapper.TSTwfProcessNodeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.business.entity.TSTwfProcessNode">
        <id column="PROCESSNODEID" property="processnodeid" />
        <result column="PROCESSID" property="processid" />
        <result column="CREATEDON" property="createdon" />
        <result column="CURRENTNODE" property="currentnode" />
        <result column="NODEFLOW" property="nodeflow" />
        <result column="STATUS" property="status" />
        <result column="OPTLOCK" property="optlock" />
        <result column="CURRUSERID" property="curruserid" />
        <result column="LAUPTIME" property="lauptime" />
        <result column="AREA_CODE" property="areaCode" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PROCESSNODEID, PROCESSID, CREATEDON, CURRENTNODE, NODEFLOW, STATUS, OPTLOCK, CURRUSERID, LAUPTIME, AREA_CODE
    </sql>

    <select id="queryByPROCESSIDAndCURRENTNODE" resultMap="BaseResultMap">
        select * from tstwfprocessnode
		where 1=1
		and PROCESSID = #{PROCESSID}
		and CURRENTNODE = #{CURRENTNODE}
		order by LAUPTIME desc
    </select>

    <select id="queryRealName" resultType="String">
        select realName from cxaicorg.t_users tu where userID = #{userID}
    </select>

    <select id="queryByPROCESSID" resultMap="BaseResultMap">
        select * from aiccs.tstwfprocessnode where PROCESSID = #{PROCESSID} and STATUS = '0'
    </select>
</mapper>
