146 lines
8.5 KiB
XML
146 lines
8.5 KiB
XML
<?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.evo.attendance.mapper.RzAttendanceStatisticalMapper">
|
||
|
||
<resultMap type="RzAttendanceStatistical" id="RzAttendanceStatisticalResult">
|
||
<result property="id" column="id" />
|
||
<result property="staffId" column="staff_id" />
|
||
<result property="month" column="month" />
|
||
<result property="deptId" column="dept_id" />
|
||
<result property="name" column="name" />
|
||
<result property="shouldAttendance" column="should_attendance" />
|
||
<result property="realAttendance" column="real_attendance" />
|
||
<result property="essentialAttendance" column="essential_attendance" />
|
||
<result property="workOvertimeNumber" column="work_overtime_number" />
|
||
<result property="absenteeism" column="absenteeism" />
|
||
<result property="lateNumber" column="late_number" />
|
||
<result property="leaveEarly" column="leave_early" />
|
||
<result property="lessNumber" column="less_number" />
|
||
<result property="nightNumber" column="night_number" />
|
||
<result property="middleShiftNumber" column="middle_shift_number" />
|
||
<result property="delFlag" column="del_flag" />
|
||
<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="overTimeHours" column="over_time_hours" />
|
||
</resultMap>
|
||
|
||
<sql id="selectRzAttendanceStatisticalVo">
|
||
select id, staff_id, month, dept_id, name, should_attendance, real_attendance,over_time_hours, essential_attendance, work_overtime_number, absenteeism, late_number, leave_early, less_number, night_number, middle_shift_number, del_flag, create_by, create_time, update_by, update_time from rz_attendance_statistical
|
||
</sql>
|
||
|
||
<select id="selectRzAttendanceStatisticalList" parameterType="RzAttendanceStatistical" resultMap="RzAttendanceStatisticalResult">
|
||
select * from rz_attendance_statistical d
|
||
<where>
|
||
d.del_flag = '0'
|
||
<if test="staffId != null "> and d.staff_id = #{staffId}</if>
|
||
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
|
||
<choose>
|
||
<when test="month != null">and DATE_FORMAT( d.month, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</when>
|
||
<otherwise>
|
||
and DATE_FORMAT( d.month, '%Y%m' ) = DATE_FORMAT(NOW() , '%Y%m' )
|
||
</otherwise>
|
||
</choose>
|
||
<if test="name != null and name != ''"> and d.name like concat('%', #{name}, '%')</if>
|
||
${params.dataScope}
|
||
</where>
|
||
</select>
|
||
|
||
<select id="selectRzAttendanceStatisticalById" parameterType="Long" resultMap="RzAttendanceStatisticalResult">
|
||
<include refid="selectRzAttendanceStatisticalVo"/>
|
||
where id = #{id}
|
||
</select>
|
||
|
||
<insert id="insertRzAttendanceStatistical" parameterType="RzAttendanceStatistical" useGeneratedKeys="true" keyProperty="id">
|
||
insert into rz_attendance_statistical
|
||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
<if test="staffId != null">staff_id,</if>
|
||
<if test="month != null">month,</if>
|
||
<if test="deptId != null">dept_id,</if>
|
||
<if test="name != null">name,</if>
|
||
<if test="shouldAttendance != null">should_attendance,</if>
|
||
<if test="realAttendance != null">real_attendance,</if>
|
||
<if test="essentialAttendance != null">essential_attendance,</if>
|
||
<if test="workOvertimeNumber != null">work_overtime_number,</if>
|
||
<if test="absenteeism != null">absenteeism,</if>
|
||
<if test="lateNumber != null">late_number,</if>
|
||
<if test="leaveEarly != null">leave_early,</if>
|
||
<if test="lessNumber != null">less_number,</if>
|
||
<if test="nightNumber != null">night_number,</if>
|
||
<if test="middleShiftNumber != null">middle_shift_number,</if>
|
||
<if test="delFlag != null">del_flag,</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="overTimeHours != null">over_time_hours,</if>
|
||
</trim>
|
||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
<if test="staffId != null">#{staffId},</if>
|
||
<if test="month != null">#{month},</if>
|
||
<if test="deptId != null">#{deptId},</if>
|
||
<if test="name != null">#{name},</if>
|
||
<if test="shouldAttendance != null">#{shouldAttendance},</if>
|
||
<if test="realAttendance != null">#{realAttendance},</if>
|
||
<if test="essentialAttendance != null">#{essentialAttendance},</if>
|
||
<if test="workOvertimeNumber != null">#{workOvertimeNumber},</if>
|
||
<if test="absenteeism != null">#{absenteeism},</if>
|
||
<if test="lateNumber != null">#{lateNumber},</if>
|
||
<if test="leaveEarly != null">#{leaveEarly},</if>
|
||
<if test="lessNumber != null">#{lessNumber},</if>
|
||
<if test="nightNumber != null">#{nightNumber},</if>
|
||
<if test="middleShiftNumber != null">#{middleShiftNumber},</if>
|
||
<if test="delFlag != null">#{delFlag},</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="overTimeHours != null">#{overTimeHours},</if>
|
||
</trim>
|
||
</insert>
|
||
|
||
<update id="updateRzAttendanceStatistical" parameterType="RzAttendanceStatistical">
|
||
update rz_attendance_statistical
|
||
<trim prefix="SET" suffixOverrides=",">
|
||
<if test="staffId != null">staff_id = #{staffId},</if>
|
||
<if test="month != null">month = #{month},</if>
|
||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||
<if test="name != null">name = #{name},</if>
|
||
<if test="shouldAttendance != null">should_attendance = #{shouldAttendance},</if>
|
||
<if test="realAttendance != null">real_attendance = #{realAttendance},</if>
|
||
<if test="essentialAttendance != null">essential_attendance = #{essentialAttendance},</if>
|
||
<if test="workOvertimeNumber != null">work_overtime_number = #{workOvertimeNumber},</if>
|
||
<if test="absenteeism != null">absenteeism = #{absenteeism},</if>
|
||
<if test="lateNumber != null">late_number = #{lateNumber},</if>
|
||
<if test="leaveEarly != null">leave_early = #{leaveEarly},</if>
|
||
<if test="lessNumber != null">less_number = #{lessNumber},</if>
|
||
<if test="nightNumber != null">night_number = #{nightNumber},</if>
|
||
<if test="middleShiftNumber != null">middle_shift_number = #{middleShiftNumber},</if>
|
||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||
<if test="createBy != null">create_by = #{createBy},</if>
|
||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
<if test="overTimeHours != null">over_time_hours = #{overTimeHours},</if>
|
||
</trim>
|
||
where id = #{id}
|
||
</update>
|
||
<!-- 根据员工ID,时间查询统计信息 -->
|
||
<select id="getRzAttendanceStatisticalByDateAndName" resultMap="RzAttendanceStatisticalResult">
|
||
<include refid="selectRzAttendanceStatisticalVo"/>
|
||
where del_flag = '0' and staff_id = #{staffId} and DATE_FORMAT( month, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )
|
||
</select>
|
||
<!-- 查询考勤月所有的考勤统计 -->
|
||
<select id="queryStatisticalByMonth" resultMap="RzAttendanceStatisticalResult">
|
||
<include refid="selectRzAttendanceStatisticalVo"/>
|
||
where DATE_FORMAT( month, '%Y%m' ) = DATE_FORMAT(#{month} , '%Y%m' ) AND del_flag = '0'
|
||
</select>
|
||
|
||
<!-- 查询某个人考勤月所有的考勤统计 -->
|
||
<select id="queryStatisticalByMonthAndName" resultMap="RzAttendanceStatisticalResult">
|
||
<include refid="selectRzAttendanceStatisticalVo"/>
|
||
where DATE_FORMAT( month, '%Y%m' ) = DATE_FORMAT(#{attendanceDate} , '%Y%m' ) and name = #{name} AND del_flag = '0'
|
||
</select>
|
||
</mapper>
|