<?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.TNodePrimissionMapper">
    <resultMap id="tNodePrimissionMap" type="com.yifu.cloud.plus.v1.yifu.process.entity.TNodePrimission">
        <id property="id" column="ID"/>
        <result property="user" column="USER"/>
        <result property="role" column="ROLE"/>
        <result property="post" column="POST"/>
        <result property="organization" column="ORGANIZATION"/>
        <result property="realationCreateUser" column="REALATION_CREATE_USER"/>
        <result property="logoTitle" column="LOGO_TITLE"/>
        <result property="nodeId" column="NODE_ID"/>
        <result property="dealType" column="DEAL_TYPE"/>
        <result property="processId" column="PROCESS_ID"/>
        <result property="nodeLogoTitle" column="NODE_LOGO_TITLE"/>
        <result property="type" column="TYPE"/>
        <result property="approvalRole" column="approval_role"/>
        <result property="divisionIdentification" column="division_identification"/>
        <result property="isPass" column="is_pass"/>
    </resultMap>
    <sql id="Base_Column_List">
          a.ID,
          a.USER,
          a.ROLE,
          a.POST,
          a.ORGANIZATION,
          a.REALATION_CREATE_USER,
          a.LOGO_TITLE,
          a.NODE_ID,
          a.DEAL_TYPE,
          a.PROCESS_ID,
          a.NODE_LOGO_TITLE,
          a.TYPE,
          a.approval_role,
          a.division_identification,
          a.is_pass
    </sql>
    <sql id="tNodePrimission_where">
        <if test="tNodePrimission != null">
            <if test="tNodePrimission.id != null and tNodePrimission.id.trim() != ''">
                AND a.ID = #{tNodePrimission.id}
            </if>
            <if test="tNodePrimission.user != null and tNodePrimission.user.trim() != ''">
                AND a.USER = #{tNodePrimission.user}
            </if>
            <if test="tNodePrimission.role != null and tNodePrimission.role.trim() != ''">
                AND a.ROLE = #{tNodePrimission.role}
            </if>
            <if test="tNodePrimission.post != null and tNodePrimission.post.trim() != ''">
                AND a.POST = #{tNodePrimission.post}
            </if>
            <if test="tNodePrimission.organization != null and tNodePrimission.organization.trim() != ''">
                AND a.ORGANIZATION = #{tNodePrimission.organization}
            </if>
            <if test="tNodePrimission.realationCreateUser != null and tNodePrimission.realationCreateUser.trim() != ''">
                AND a.REALATION_CREATE_USER = #{tNodePrimission.realationCreateUser}
            </if>
            <if test="tNodePrimission.logoTitle != null and tNodePrimission.logoTitle.trim() != ''">
                AND a.LOGO_TITLE = #{tNodePrimission.logoTitle}
            </if>
            <if test="tNodePrimission.nodeId != null and tNodePrimission.nodeId.trim() != ''">
                AND a.NODE_ID = #{tNodePrimission.nodeId}
            </if>
            <if test="tNodePrimission.dealType != null and tNodePrimission.dealType.trim() != ''">
                AND a.DEAL_TYPE = #{tNodePrimission.dealType}
            </if>
            <if test="tNodePrimission.approvalRole != null and tNodePrimission.approvalRole.trim() != ''">
                AND a.approval_role = #{tNodePrimission.approvalRole}
            </if>
        </if>
    </sql>
    <!--tNodePrimission简单分页查询-->
    <select id="getTNodePrimissionPage" resultMap="tNodePrimissionMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_node_primission a
        <where>
            1=1
            <include refid="tNodePrimission_where"/>
        </where>
    </select>

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