<?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.PayWorkOrderEmployeeMapper">

    <resultMap type="com.ruoyi.pay.domain.PayWorkOrderEmployee" id="PayWorkOrderEmployeeResult">
        <result property="id" column="id"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="workOrderId" column="work_order_id"/>
        <result property="employeeId" column="employee_id"/>
        <result property="deptId" column="dept_id"/>
        <result property="type" column="type"/>
        <result property="empName" column="emp_name"/>
        <result property="startTime" column="start_time"/>
        <result property="endTime" column="end_time"/>
        <result property="validHours" column="valid_hours"/>
        <result property="date" column="date"/>
        <result property="month" column="month"/>
        <result property="processingType" column="processing_type"/>
        <result property="processingPrice" column="processing_price"/>
        <result property="processingNum" column="processing_num"/>
        <result property="amount" column="amount"/>
        <result property="helper" column="helper"/>
        <result property="intime" column="intime"/>
    </resultMap>
    <sql id="selectSgrWorkOrderEmployeeVo">
        select id, work_order_id, employee_id, dept_id, type, emp_name, start_time, end_time, valid_hours, date, month, processing_type, processing_price, processing_num, amount, helper,intime  from pay_work_order_employee
    </sql>
    <select id="selectSgrWorkOrderEmployeeList1"  resultMap="PayWorkOrderEmployeeResult">
        <include refid="selectSgrWorkOrderEmployeeVo"/>
        <where>
            <if test="workOrderId != null "> and work_order_id = #{workOrderId}</if>
            <if test="tenantId != null "> and tenant_id = #{tenantId}</if>
            <if test="employeeId != null "> and employee_id = #{employeeId}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="empName != null  and empName != ''"> and emp_name like concat('%', #{empName}, '%')</if>
            <if test="startTime != null "> and start_time = #{startTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="validHours != null "> and valid_hours = #{validHours}</if>
            <if test="date != null "> and date = #{date}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="processingType != null  and processingType != ''"> and processing_type = #{processingType}</if>
            <if test="processingPrice != null "> and processing_price = #{processingPrice}</if>
            <if test="processingNum != null "> and processing_num = #{processingNum}</if>
            <if test="amount != null "> and amount = #{amount}</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>
