<?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.TProcessNodeMapper">
    <resultMap id="tProcessNodeMap" type="com.yifu.cloud.plus.v1.yifu.process.entity.TProcessNode">
        <id property="id" column="ID"/>
        <result property="type" column="TYPE"/>
        <result property="logoTitle" column="LOGO_TITLE"/>
        <result property="name" column="NAME"/>
        <result property="description" column="DESCRIPTION"/>
        <result property="form" column="FORM"/>
        <result property="allowDispatch" column="ALLOW_DISPATCH"/>
        <result property="allowThis" column="ALLOW_THIS"/>
        <result property="processId" column="PROCESS_ID"/>
        <result property="handleAllowNext" column="HANDLE_ALLOW_NEXT"/>
        <result property="countersign" column="COUNTERSIGN"/>
        <result property="backType" column="BACK_TYPE"/>
        <result property="shape" column="SHAPE"/>
        <result property="size" column="SIZE"/>
        <result property="coordinatex" column="COORDINATEX"/>
        <result property="coordinatey" column="COORDINATEY"/>
        <result property="color" column="COLOR"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.ID,
                  a.TYPE,
                  a.LOGO_TITLE,
                  a.NAME,
                  a.DESCRIPTION,
                  a.FORM,
                  a.ALLOW_DISPATCH,
                  a.ALLOW_THIS,
                  a.PROCESS_ID,
                  a.HANDLE_ALLOW_NEXT,
                  a.COUNTERSIGN,
                  a.BACK_TYPE,
                  a.SHAPE,
                  a.SIZE,
                  a.COORDINATEX,
                  a.COORDINATEY,
                  a.COLOR,
                  a.allow_add_sign
         </sql>
    <sql id="tProcessNode_where">
        <if test="tProcessNode != null">
            <if test="tProcessNode.id != null and tProcessNode.id.trim() != ''">
                AND a.ID = #{tProcessNode.id}
            </if>
            <if test="tProcessNode.type != null and tProcessNode.type.trim() != ''">
                AND a.TYPE = #{tProcessNode.type}
            </if>
            <if test="tProcessNode.logoTitle != null and tProcessNode.logoTitle.trim() != ''">
                AND a.LOGO_TITLE = #{tProcessNode.logoTitle}
            </if>
            <if test="tProcessNode.name != null and tProcessNode.name.trim() != ''">
                AND a.NAME = #{tProcessNode.name}
            </if>
            <if test="tProcessNode.description != null and tProcessNode.description.trim() != ''">
                AND a.DESCRIPTION = #{tProcessNode.description}
            </if>
            <if test="tProcessNode.form != null and tProcessNode.form.trim() != ''">
                AND a.FORM = #{tProcessNode.form}
            </if>
            <if test="tProcessNode.allowDispatch != null and tProcessNode.allowDispatch.trim() != ''">
                AND a.ALLOW_DISPATCH = #{tProcessNode.allowDispatch}
            </if>
            <if test="tProcessNode.allowThis != null and tProcessNode.allowThis.trim() != ''">
                AND a.ALLOW_THIS = #{tProcessNode.allowThis}
            </if>
            <if test="tProcessNode.processId != null and tProcessNode.processId.trim() != ''">
                AND a.PROCESS_ID = #{tProcessNode.processId}
            </if>
            <if test="tProcessNode.handleAllowNext != null and tProcessNode.handleAllowNext.trim() != ''">
                AND a.HANDLE_ALLOW_NEXT = #{tProcessNode.handleAllowNext}
            </if>
            <if test="tProcessNode.countersign != null and tProcessNode.countersign.trim() != ''">
                AND a.COUNTERSIGN = #{tProcessNode.countersign}
            </if>
            <if test="tProcessNode.backType != null and tProcessNode.backType.trim() != ''">
                AND a.BACK_TYPE = #{tProcessNode.backType}
            </if>
        </if>
    </sql>
    <!--tProcessNode简单分页查询-->
    <select id="getTProcessNodePage" resultMap="tProcessNodeMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_process_node a
        <where>
            1=1
            <include refid="tProcessNode_where"/>
        </where>
    </select>

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

</mapper>