<?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.yifu.cloud.plus.v1.yifu.process.mapper.TNodeRouteMapper">
    <resultMap id="tNodeRouteMap" type="com.yifu.cloud.plus.v1.yifu.process.entity.TNodeRoute">
        <id property="id" column="ID"/>
        <result property="processId" column="PROCESS_ID"/>
        <result property="prewNode" column="PREW_NODE"/>
        <result property="nextNode" column="NEXT_NODE"/>
        <result property="logoTitle" column="LOGO_TITLE"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createDate" column="CREATE_DATE"/>
        <result property="updateUser" column="UPDATE_USER"/>
        <result property="updateDate" column="UPDATE_DATE"/>
        <result property="name" column="NAME"/>
        <result property="description" column="DESCRIPTION"/>
        <result property="sequenceNo" column="SEQUENCE_NO"/>
        <result property="opinion" column="OPINION"/>
        <result property="opinionMustFlag" column="OPINION_MUST_FLAG"/>
        <result property="routeType" column="ROUTE_TYPE"/>
        <result property="priorityFlag" column="PRIORITY_FLAG"/>
        <result property="timeoutRoam" column="TIMEOUT_ROAM"/>
        <result property="sameForPrew" column="SAME_FOR_PREW"/>
        <result property="shape" column="SHAPE"/>
        <result property="preNodeAnchor" column="PRE_NODE_ANCHOR"/>
        <result property="nextNodeAnchor" column="NEXT_NODE_ANCHOR"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.ID,
             a.PROCESS_ID,
             a.PREW_NODE,
              a.NEXT_NODE,
              a.LOGO_TITLE,
              a.CREATE_USER,
              a.CREATE_DATE,
              a.UPDATE_USER,
              a.UPDATE_DATE,
              a.NAME,
              a.DESCRIPTION,
              a.SEQUENCE_NO,
              a.OPINION,
              a.OPINION_MUST_FLAG,
              a.ROUTE_TYPE,
              a.PRIORITY_FLAG,
              a.TIMEOUT_ROAM,
              a.SAME_FOR_PREW,
              a.SHAPE,
              a.PRE_NODE_ANCHOR,
              a.NEXT_NODE_ANCHOR
         </sql>
    <sql id="tNodeRoute_where">
        <if test="tNodeRoute != null">
            <if test="tNodeRoute.id != null and tNodeRoute.id.trim() != ''">
                AND a.ID = #{tNodeRoute.id}
            </if>
            <if test="tNodeRoute.processId != null and tNodeRoute.processId.trim() != ''">
                AND a.PROCESS_ID = #{tNodeRoute.processId}
            </if>
            <if test="tNodeRoute.prewNode != null and tNodeRoute.prewNode.trim() != ''">
                AND a.PREW_NODE = #{tNodeRoute.prewNode}
            </if>
            <if test="tNodeRoute.nextNode != null and tNodeRoute.nextNode.trim() != ''">
                AND a.NEXT_NODE = #{tNodeRoute.nextNode}
            </if>
            <if test="tNodeRoute.logoTitle != null and tNodeRoute.logoTitle.trim() != ''">
                AND a.LOGO_TITLE = #{tNodeRoute.logoTitle}
            </if>
            <if test="tNodeRoute.createUser != null and tNodeRoute.createUser.trim() != ''">
                AND a.CREATE_USER = #{tNodeRoute.createUser}
            </if>
            <if test="tNodeRoute.createDate != null">
                AND a.CREATE_DATE = #{tNodeRoute.createDate}
            </if>
            <if test="tNodeRoute.updateUser != null and tNodeRoute.updateUser.trim() != ''">
                AND a.UPDATE_USER = #{tNodeRoute.updateUser}
            </if>
            <if test="tNodeRoute.updateDate != null">
                AND a.UPDATE_DATE = #{tNodeRoute.updateDate}
            </if>
            <if test="tNodeRoute.name != null and tNodeRoute.name.trim() != ''">
                AND a.NAME = #{tNodeRoute.name}
            </if>
            <if test="tNodeRoute.description != null and tNodeRoute.description.trim() != ''">
                AND a.DESCRIPTION = #{tNodeRoute.description}
            </if>
            <if test="tNodeRoute.sequenceNo != null">
                AND a.SEQUENCE_NO = #{tNodeRoute.sequenceNo}
            </if>
            <if test="tNodeRoute.opinion != null and tNodeRoute.opinion.trim() != ''">
                AND a.OPINION = #{tNodeRoute.opinion}
            </if>
            <if test="tNodeRoute.opinionMustFlag != null and tNodeRoute.opinionMustFlag.trim() != ''">
                AND a.OPINION_MUST_FLAG = #{tNodeRoute.opinionMustFlag}
            </if>
            <if test="tNodeRoute.routeType != null and tNodeRoute.routeType.trim() != ''">
                AND a.ROUTE_TYPE = #{tNodeRoute.routeType}
            </if>
            <if test="tNodeRoute.priorityFlag != null and tNodeRoute.priorityFlag.trim() != ''">
                AND a.PRIORITY_FLAG = #{tNodeRoute.priorityFlag}
            </if>
            <if test="tNodeRoute.timeoutRoam != null and tNodeRoute.timeoutRoam.trim() != ''">
                AND a.TIMEOUT_ROAM = #{tNodeRoute.timeoutRoam}
            </if>
            <if test="tNodeRoute.sameForPrew != null and tNodeRoute.sameForPrew.trim() != ''">
                AND a.SAME_FOR_PREW = #{tNodeRoute.sameForPrew}
            </if>
        </if>
    </sql>
    <!--tNodeRoute简单分页查询-->
    <select id="getTNodeRoutePage" resultMap="tNodeRouteMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_node_route a
        <where>
            1=1
            <include refid="tNodeRoute_where"/>
        </where>
    </select>

    <!--删除-->
    <delete id="deleteByProcessId">
        delete from t_node_route where PROCESS_ID = #{processId}
    </delete>
</mapper>
