<?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.ruoyi.pay.mapper.PayBaohuoEmployeeMapper">

    <resultMap type="com.ruoyi.pay.domain.PayBaohuoEmployee" id="PayBaohuoEmployeeResult">
        <result property="id" column="id"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="woId" column="wo_id"/>
        <result property="empId" column="emp_id"/>
        <result property="deptId" column="dept_id"/>
        <result property="empName" column="emp_name"/>
        <result property="amount" column="amount"/>
        <result property="month" column="month"/>
        <result property="helper" column="helper"/>
        <result property="intime" column="intime"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>
    <sql id="selectSgrBaohuoEmployeeVo">
        select id, wo_id, emp_id, dept_id, emp_name, amount, month, helper, intime from pay_baohuo_employee
    </sql>
    <select id="selectSgrBaohuoEmployeeList1"  resultMap="PayBaohuoEmployeeResult">
        <include refid="selectSgrBaohuoEmployeeVo"/>
        <where>
            <if test="woId != null "> and wo_id = #{woId}</if>
            <if test="tenantId != null "> and tenant_id = #{tenantId}</if>
            <if test="empId != null "> and emp_id = #{empId}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="empName != null  and empName != ''"> and emp_name like concat('%', #{empName}, '%')</if>
            <if test="amount != null "> and amount = #{amount}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="helper != null "> and helper = #{helper}</if>
            <if test="intime != null ">
                <![CDATA[AND (DATE_FORMAT(`intime`, '%Y-%m') = DATE_FORMAT( #{intime}, '%Y-%m'))]]>
            </if>
        </where>
    </select>

</mapper>
