<?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.TNodeReaderPromissionMapper">
    <resultMap id="tNodeReaderPromissionMap" type="com.yifu.cloud.plus.v1.yifu.process.entity.TNodeReaderPromission">
        <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="processId" column="PROCESS_ID"/>
        <result property="nodeLogoTitle" column="NODE_LOGO_TITLE"/>
        <result property="type" column="TYPE"/>
        <result property="approvalRole" column="approval_role"/>
        <result property="customizeField" column="customize_field"/>
        <result property="isCustomize" column="is_customize"/>
    </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.PROCESS_ID,
                  a.NODE_LOGO_TITLE,
                  a.TYPE,
                  a.approval_role,
                  a.customize_field,
                  a.is_customize
         </sql>
    <sql id="tNodeReaderPromission_where">
        <if test="tNodeReaderPromission != null">
            <if test="tNodeReaderPromission.id != null and tNodeReaderPromission.id.trim() != ''">
                AND a.ID = #{tNodeReaderPromission.id}
            </if>
            <if test="tNodeReaderPromission.user != null and tNodeReaderPromission.user.trim() != ''">
                AND a.USER = #{tNodeReaderPromission.user}
            </if>
            <if test="tNodeReaderPromission.role != null and tNodeReaderPromission.role.trim() != ''">
                AND a.ROLE = #{tNodeReaderPromission.role}
            </if>
            <if test="tNodeReaderPromission.post != null and tNodeReaderPromission.post.trim() != ''">
                AND a.POST = #{tNodeReaderPromission.post}
            </if>
            <if test="tNodeReaderPromission.organization != null and tNodeReaderPromission.organization.trim() != ''">
                AND a.ORGANIZATION = #{tNodeReaderPromission.organization}
            </if>
            <if test="tNodeReaderPromission.realationCreateUser != null and tNodeReaderPromission.realationCreateUser.trim() != ''">
                AND a.REALATION_CREATE_USER = #{tNodeReaderPromission.realationCreateUser}
            </if>
            <if test="tNodeReaderPromission.logoTitle != null and tNodeReaderPromission.logoTitle.trim() != ''">
                AND a.LOGO_TITLE = #{tNodeReaderPromission.logoTitle}
            </if>
            <if test="tNodeReaderPromission.nodeId != null and tNodeReaderPromission.nodeId.trim() != ''">
                AND a.NODE_ID = #{tNodeReaderPromission.nodeId}
            </if>
        </if>
    </sql>
    <!--tNodeReaderPromission简单分页查询-->
    <select id="getTNodeReaderPromissionPage" resultMap="tNodeReaderPromissionMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_node_reader_promission a
        <where>
            1=1
            <include refid="tNodeReaderPromission_where"/>
        </where>
    </select>

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