|
@@ -0,0 +1,154 @@
|
|
|
+<?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.system.mapper.ClockRecordMapper">
|
|
|
+
|
|
|
+ <resultMap type="ClockRecord" id="ClockRecordResult">
|
|
|
+ <result property="clockId" column="clock_id" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="deptName" column="dept_name" />
|
|
|
+ <result property="userName" column="user_name" />
|
|
|
+ <result property="phonenumber" column="phonenumber" />
|
|
|
+ <result property="idCard" column="id_card" />
|
|
|
+ <result property="recordTime" column="record_time" />
|
|
|
+ <result property="week" column="week" />
|
|
|
+ <result property="workingTime" column="working_time" />
|
|
|
+ <result property="dutyTime" column="duty_time" />
|
|
|
+ <result property="type" column="type" />
|
|
|
+ <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="selectClockRecordVo">
|
|
|
+ select clock_id, user_id, dept_name, user_name, phonenumber, id_card, record_time,week, working_time, duty_time,type, create_by, create_time, update_by, update_time, remark from clock_record
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectClockRecordList" parameterType="ClockRecord" resultMap="ClockRecordResult">
|
|
|
+ <include refid="selectClockRecordVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
+ <if test="deptName != null "> and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
+ <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
+ <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
|
|
|
+ <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
|
|
|
+ <if test="recordTime != null and recordTime != ''"> and record_time = #{recordTime}</if>
|
|
|
+ <if test="week != null and week != ''"> and week = #{week}</if>
|
|
|
+ <if test="workingTime != null and workingTime != ''"> and working_time = #{workingTime}</if>
|
|
|
+ <if test="dutyTime != null and dutyTime != ''"> and duty_time = #{dutyTime}</if>
|
|
|
+ <if test="type != null and type != ''"> and type = #{type}</if>
|
|
|
+ <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
|
|
|
+ AND record_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
+ AND record_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectClockRecordByClockId" parameterType="Long" resultMap="ClockRecordResult">
|
|
|
+ <include refid="selectClockRecordVo"/>
|
|
|
+ where clock_id = #{clockId}
|
|
|
+ </select>
|
|
|
+ <select id="selectOrderFoodListRl" parameterType="ClockRecord" resultMap="ClockRecordResult">
|
|
|
+ <include refid="selectClockRecordVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
+ <if test="deptName != null "> and dept_name like concat('%', #{deptName}, '%')</if>
|
|
|
+ <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
+ <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
|
|
|
+ <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
|
|
|
+ <if test="recordTime != null and recordTime != ''">
|
|
|
+ and date_format(record_time,'%Y%m') = date_format(#{recordTime},'%Y%m')
|
|
|
+ </if>
|
|
|
+ <if test="workingTime != null and workingTime != ''"> and working_time = #{workingTime}</if>
|
|
|
+ <if test="dutyTime != null and dutyTime != ''"> and duty_time = #{dutyTime}</if>
|
|
|
+ <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
|
|
|
+ AND record_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
|
+ AND record_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="selectClockRecordNew" parameterType="ClockRecord" resultMap="ClockRecordResult">
|
|
|
+ <include refid="selectClockRecordVo"/>
|
|
|
+ where (working_time!=null or duty_time!=null)
|
|
|
+ and user_id = #{userId}
|
|
|
+ order by record_time desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertClockRecord" parameterType="ClockRecord" useGeneratedKeys="true" keyProperty="clockId">
|
|
|
+ insert into clock_record
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="deptName != null">dept_name,</if>
|
|
|
+ <if test="userName != null and userName != ''">user_name,</if>
|
|
|
+ <if test="phonenumber != null">phonenumber,</if>
|
|
|
+ <if test="idCard != null">id_card,</if>
|
|
|
+ <if test="recordTime != null">record_time,</if>
|
|
|
+ <if test="week != null">week,</if>
|
|
|
+ <if test="workingTime != null">working_time,</if>
|
|
|
+ <if test="dutyTime != null">duty_time,</if>
|
|
|
+ <if test="type != null and type != ''">type,</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="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="deptName != null">#{deptName},</if>
|
|
|
+ <if test="userName != null and userName != ''">#{userName},</if>
|
|
|
+ <if test="phonenumber != null">#{phonenumber},</if>
|
|
|
+ <if test="idCard != null">#{idCard},</if>
|
|
|
+ <if test="recordTime != null">#{recordTime},</if>
|
|
|
+ <if test="week != null">#{week},</if>
|
|
|
+ <if test="workingTime != null">#{workingTime},</if>
|
|
|
+ <if test="dutyTime != null">#{dutyTime},</if>
|
|
|
+ <if test="type != null and type != ''">#{type},</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="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateClockRecord" parameterType="ClockRecord">
|
|
|
+ update clock_record
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="deptName != null">dept_name = #{deptName},</if>
|
|
|
+ <if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
|
+ <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
|
|
|
+ <if test="idCard != null">id_card = #{idCard},</if>
|
|
|
+ <if test="recordTime != null">record_time = #{recordTime},</if>
|
|
|
+ <if test="week != null "> and week = #{week},</if>
|
|
|
+ <if test="workingTime != null">working_time = #{workingTime},</if>
|
|
|
+ <if test="dutyTime != null">duty_time = #{dutyTime},</if>
|
|
|
+ <if test="type != null and type != ''">type = #{type},</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="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where clock_id = #{clockId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteClockRecordByClockId" parameterType="Long">
|
|
|
+ delete from clock_record where clock_id = #{clockId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteClockRecordByClockIds" parameterType="String">
|
|
|
+ delete from clock_record where clock_id in
|
|
|
+ <foreach item="clockId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{clockId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|