TWW
2025-08-08 81aa0cb2a8f563075eef1d4101024c3fd9cb2205
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.personnelManagement.mapper.AttendanceMapper">
    
    <resultMap type="Attendance" id="AttendanceResult">
        <result property="id"    column="id"    />
        <result property="employeeId"    column="employee_id"    />
        <result property="employeeName"    column="employee_name"    />
        <result property="employeeNo"    column="employee_no"    />
        <result property="month"    column="month"    />
        <result property="shouldAttendDays"    column="should_attend_days"    />
        <result property="actualAttendDays"    column="actual_attend_days"    />
        <result property="status"    column="status"    />
        <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="tenantId"    column="tenant_id"    />
    </resultMap>
 
    <sql id="selectAttendanceVo">
        select id, employee_id, employee_name, employee_no, month, should_attend_days, actual_attend_days, status, create_by, create_time, update_by, update_time, tenant_id from attendance
    </sql>
 
    <select id="selectAttendanceList" parameterType="Attendance" resultMap="AttendanceResult">
        <include refid="selectAttendanceVo"/>
        <where>  
            <if test="employeeId != null "> and employee_id = #{employeeId}</if>
            <if test="employeeName != null  and employeeName != ''"> and employee_name like concat('%', #{employeeName}, '%')</if>
            <if test="employeeNo != null  and employeeNo != ''"> and employee_no = #{employeeNo}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="shouldAttendDays != null "> and should_attend_days = #{shouldAttendDays}</if>
            <if test="actualAttendDays != null "> and actual_attend_days = #{actualAttendDays}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="tenantId != null "> and tenant_id = #{tenantId}</if>
        </where>
    </select>
    
    <select id="selectAttendanceById" parameterType="Long" resultMap="AttendanceResult">
        <include refid="selectAttendanceVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertAttendance" parameterType="Attendance" useGeneratedKeys="true" keyProperty="id">
        insert into attendance
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="employeeId != null">employee_id,</if>
            <if test="employeeName != null and employeeName != ''">employee_name,</if>
            <if test="employeeNo != null and employeeNo != ''">employee_no,</if>
            <if test="month != null and month != ''">month,</if>
            <if test="shouldAttendDays != null">should_attend_days,</if>
            <if test="actualAttendDays != null">actual_attend_days,</if>
            <if test="status != null and status != ''">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="tenantId != null">tenant_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="employeeId != null">#{employeeId},</if>
            <if test="employeeName != null and employeeName != ''">#{employeeName},</if>
            <if test="employeeNo != null and employeeNo != ''">#{employeeNo},</if>
            <if test="month != null and month != ''">#{month},</if>
            <if test="shouldAttendDays != null">#{shouldAttendDays},</if>
            <if test="actualAttendDays != null">#{actualAttendDays},</if>
            <if test="status != null and status != ''">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="tenantId != null">#{tenantId},</if>
         </trim>
    </insert>
 
    <update id="updateAttendance" parameterType="Attendance">
        update attendance
        <trim prefix="SET" suffixOverrides=",">
            <if test="employeeId != null">employee_id = #{employeeId},</if>
            <if test="employeeName != null and employeeName != ''">employee_name = #{employeeName},</if>
            <if test="employeeNo != null and employeeNo != ''">employee_no = #{employeeNo},</if>
            <if test="month != null and month != ''">month = #{month},</if>
            <if test="shouldAttendDays != null">should_attend_days = #{shouldAttendDays},</if>
            <if test="actualAttendDays != null">actual_attend_days = #{actualAttendDays},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="tenantId != null">tenant_id = #{tenantId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteAttendanceById" parameterType="Long">
        delete from attendance where id = #{id}
    </delete>
 
    <delete id="deleteAttendanceByIds" parameterType="String">
        delete from attendance where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>