<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!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.salary.mapper.TApprovalRecordMapper">

  <resultMap id="tApprovalRecordMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord">
    <id property="id" column="id"/>
    <result property="salaryId" column="salary_id"/>
    <result property="nodeId" column="node_id"/>
    <result property="approvalMan" column="approval_man"/>
    <result property="approvalManName" column="approval_man_name"/>
    <result property="approvalTime" column="approval_time"/>
    <result property="approvalResult" column="approval_result"/>
    <result property="approvalOpinion" column="approval_opinion"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.id,
                a.salary_id,
                a.node_id,
                a.approval_man,
                a.approval_man_name,
                a.approval_time,
                a.approval_result,
                a.approval_opinion
    </sql>
    <sql id="tApprovalRecord_where">
        <if test="tApprovalRecord != null">
                    <if test="tApprovalRecord.id != null and tApprovalRecord.id.trim() != ''">
                        AND a.id = #{tApprovalRecord.id}
                    </if>
                    <if test="tApprovalRecord.salaryId != null and tApprovalRecord.salaryId.trim() != ''">
                        AND a.salary_id = #{tApprovalRecord.salaryId}
                    </if>
                    <if test="tApprovalRecord.nodeId != null and tApprovalRecord.nodeId.trim() != ''">
                        AND a.node_id = #{tApprovalRecord.nodeId}
                    </if>
                    <if test="tApprovalRecord.approvalMan != null and tApprovalRecord.approvalMan.trim() != ''">
                        AND a.approval_man = #{tApprovalRecord.approvalMan}
                    </if>
                    <if test="tApprovalRecord.approvalManName != null and tApprovalRecord.approvalManName.trim() != ''">
                        AND a.approval_man_name = #{tApprovalRecord.approvalManName}
                    </if>
                    <if test="tApprovalRecord.approvalTime != null">
                        AND a.approval_time = #{tApprovalRecord.approvalTime}
                    </if>
                    <if test="tApprovalRecord.approvalResult != null and tApprovalRecord.approvalResult.trim() != ''">
                        AND a.approval_result = #{tApprovalRecord.approvalResult}
                    </if>
                    <if test="tApprovalRecord.approvalOpinion != null and tApprovalRecord.approvalOpinion.trim() != ''">
                        AND a.approval_opinion = #{tApprovalRecord.approvalOpinion}
                    </if>
        </if>
    </sql>
    <!--tApprovalRecord简单分页查询-->
    <select id="getTApprovalRecordPage" resultMap="tApprovalRecordMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_approval_record a
        <where>
            1=1
            <include refid="tApprovalRecord_where"/>
        </where>
    </select>
</mapper>
