|
|
@@ -2,10 +2,69 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="org.sky.scientific.mapper.AttendanceMapper">
|
|
|
|
|
|
+ <resultMap id="ResultMap" type="org.sky.scientific.pojo.entity.AttendanceEntity">
|
|
|
+ <result column="id" property="id"/>
|
|
|
+ <result column="tenant_id" property="tenantId"/>
|
|
|
+ <result column="technician_id" property="technicianId"/>
|
|
|
+ <result column="work_date" property="workDate"/>
|
|
|
+ <result column="work_hours" property="workHours"/>
|
|
|
+
|
|
|
+ <result column="create_user" property="createUser"/>
|
|
|
+ <result column="create_dept" property="createDept"/>
|
|
|
+ <result column="create_time" property="createTime"/>
|
|
|
+ <result column="update_user" property="updateUser"/>
|
|
|
+ <result column="update_time" property="updateTime"/>
|
|
|
+ <result column="status" property="status"/>
|
|
|
+ <result column="is_deleted" property="isDeleted"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="ResultVoMap" type="org.sky.scientific.pojo.vo.AttendanceVO">
|
|
|
+ <result column="technician_id" property="technicianId"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="number" property="number"/>
|
|
|
+ <result column="identity_card" property="identityCard"/>
|
|
|
+ <result column="personnel_type" property="personnelType"/>
|
|
|
+<!-- <collection property="dailyAttendances" ofType="org.sky.scientific.pojo.vo.DailyAttendance">-->
|
|
|
+<!-- <result column="work_date" property="workDate"/>-->
|
|
|
+<!-- <result column="work_hours" property="workHours"/>-->
|
|
|
+<!-- </collection>-->
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectDailyAttendanceByTechnicianAndMonth" resultType="org.sky.scientific.pojo.vo.DailyAttendance">
|
|
|
+ select work_date,work_hours
|
|
|
+ from kd_attendance_records
|
|
|
+ where technician_id = #{technicianId} and left(work_date,6) = #{yearAndMonth}
|
|
|
+ order by work_date asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAttendancePage" resultMap="ResultVoMap">
|
|
|
+ SELECT DISTINCT(r.technician_id), rs.name, rs.number, rs.identity_card, rs.personnel_type
|
|
|
+ FROM kd_attendance_records r
|
|
|
+ LEFT JOIN
|
|
|
+ (
|
|
|
+ SELECT t.id, t.NAME, t.number, t.identity_card, s.personnel_type
|
|
|
+ FROM kd_technician t
|
|
|
+ left JOIN kd_technician_snapshot s ON s.technician_id = t.id AND year_and_month = #{ew.yearAndMonth}
|
|
|
+ )rs on rs.id = r.technician_id
|
|
|
+ WHERE LEFT(r.work_date,6) = #{ew.yearAndMonth}
|
|
|
+ <if test="ew.name != null">
|
|
|
+ and rs.name like concat('%',#{ew.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="ew.number != null">
|
|
|
+ and rs.number like concat('%',#{ew.number},'%')
|
|
|
+ </if>
|
|
|
+ <if test="ew.identityCard != null">
|
|
|
+ and rs.identity_card like concat('%',#{ew.identityCard},'%')
|
|
|
+ </if>
|
|
|
+ <if test="ew.personnelType != null">
|
|
|
+ and rs.personnel_type = #{ew.personnelType}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<update id="batchUpdate" parameterType="java.util.List">
|
|
|
<foreach collection="list" item="record" open="" separator=";" close="">
|
|
|
update kd_attendance_records
|
|
|
- set work_duration = #{record.workDuration}
|
|
|
+ set work_hours = #{record.workHours}
|
|
|
where id = #{record.id}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
@@ -15,15 +74,17 @@
|
|
|
</select>
|
|
|
|
|
|
<insert id="batchSave" parameterType="java.util.List">
|
|
|
- insert into kd_attendance_records(tenant_id,technician_id,work_date,work_duration,create_user,create_dept)
|
|
|
+ insert into kd_attendance_records(tenant_id,technician_id,work_date,work_hours,create_user,create_dept)
|
|
|
VALUES
|
|
|
<foreach collection="list" item="a" separator=",">
|
|
|
- (#{a.tenantId},#{a.technicianId},#{a.workDate},#{a.workDuration},#{a.createUser},#{a.createDept})
|
|
|
+ (#{a.tenantId},#{a.technicianId},#{a.workDate},#{a.workHours},#{a.createUser},#{a.createDept})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
<select id="selectByYearAndMonth" resultType="org.sky.scientific.pojo.entity.AttendanceEntity" parameterType="java.lang.String">
|
|
|
- select id,technician_id as technicianId, work_date as workDate, work_duration as workDuration from kd_attendance_records
|
|
|
+ select id,technician_id as technicianId, work_date as workDate, work_hours as workHours from kd_attendance_records
|
|
|
where left(work_date,6) = #{yearAndMonth}
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|