Bladeren bron

打卡信息

LIVE_YE 10 maanden geleden
bovenliggende
commit
ee32eca8ef

+ 107 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/clock/ClockRecordController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.web.controller.clock;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.ClockRecord;
+import com.ruoyi.system.service.IClockRecordService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 打卡记录Controller
+ *
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+@RestController
+@RequestMapping("/system/clock")
+public class ClockRecordController extends BaseController {
+    @Autowired
+    private IClockRecordService clockRecordService;
+
+    /**
+     * 查询打卡记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(ClockRecord clockRecord) {
+        startPage();
+        List<ClockRecord> list = clockRecordService.selectClockRecordList(clockRecord);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询打卡记录日历形式
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:rl')")
+    @GetMapping("/rl")
+    public AjaxResult rl(ClockRecord clockRecord) {
+        return clockRecordService.selectClockRecordListRl(clockRecord);
+    }
+
+    /**
+     * 导出打卡记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:export')")
+    @Log(title = "打卡记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ClockRecord clockRecord) {
+        List<ClockRecord> list = clockRecordService.selectClockRecordList(clockRecord);
+        ExcelUtil<ClockRecord> util = new ExcelUtil<ClockRecord>(ClockRecord.class);
+        util.exportExcel(response, list, "打卡记录数据");
+    }
+
+    /**
+     * 获取打卡记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:query')")
+    @GetMapping(value = "/{clockId}")
+    public AjaxResult getInfo(@PathVariable("clockId") Long clockId) {
+        return success(clockRecordService.selectClockRecordByClockId(clockId));
+    }
+
+    /**
+     * 新增打卡记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:add')")
+    @Log(title = "打卡记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ClockRecord clockRecord) {
+        return toAjax(clockRecordService.insertClockRecord(clockRecord));
+    }
+
+    /**
+     * 修改打卡记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:edit')")
+    @Log(title = "打卡记录", businessType = BusinessType.UPDATE)
+    @PostMapping("/put")
+    public AjaxResult edit(@RequestBody ClockRecord clockRecord) {
+        return toAjax(clockRecordService.updateClockRecord(clockRecord));
+    }
+
+    /**
+     * 删除打卡记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:remove')")
+    @Log(title = "打卡记录", businessType = BusinessType.DELETE)
+    @GetMapping("/delete/{clockIds}")
+    public AjaxResult remove(@PathVariable Long[] clockIds) {
+        return toAjax(clockRecordService.deleteClockRecordByClockIds(clockIds));
+    }
+}

+ 198 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/ClockRecord.java

@@ -0,0 +1,198 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 打卡记录对象 clock_record
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public class ClockRecord extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 打卡记录id */
+    private Long clockId;
+
+    /** 人员ID */
+    @Excel(name = "人员ID")
+    private Long userId;
+
+    /** 所属部门名称 */
+    @Excel(name = "所属部门名称")
+    private Long deptName;
+
+    /** 人员姓名 */
+    @Excel(name = "人员姓名")
+    private String userName;
+
+    /** 手机号码 */
+    @Excel(name = "手机号码")
+    private String phonenumber;
+
+    /** 人员身份证号 */
+    @Excel(name = "人员身份证号")
+    private String idCard;
+
+    /** 打卡记录日期(yyyy-mm-dd) */
+    @Excel(name = "打卡记录日期")
+    private String recordTime;
+
+    /** 周几(1:星期一,2:星期二,3:星期三,4:星期四,5:星期五,6:星期六,7:星期日) */
+    @Excel(name = "周几", readConverterExp = "1=星期一,2=星期二,3=星期三,4=星期四,5=星期五,6=星期六,7=星期日")
+    private String week;
+
+    /** 上班打卡时间 */
+    @Excel(name = "上班打卡时间")
+    private String workingTime;
+
+    /** 下班打卡时间 */
+    @Excel(name = "下班打卡时间")
+    private String dutyTime;
+
+    private String startTime;
+
+    private String endTime;
+
+    /** 是否打卡 N:否,Y:是*/
+    @Excel(name = "是否打卡", readConverterExp = "N=否,Y=是")
+    private String type;
+
+    public void setClockId(Long clockId) 
+    {
+        this.clockId = clockId;
+    }
+
+    public Long getClockId() 
+    {
+        return clockId;
+    }
+    public void setUserId(Long userId) 
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId() 
+    {
+        return userId;
+    }
+    public void setDeptName(Long deptName) 
+    {
+        this.deptName = deptName;
+    }
+
+    public Long getDeptName() 
+    {
+        return deptName;
+    }
+    public void setUserName(String userName) 
+    {
+        this.userName = userName;
+    }
+
+    public String getUserName() 
+    {
+        return userName;
+    }
+    public void setPhonenumber(String phonenumber) 
+    {
+        this.phonenumber = phonenumber;
+    }
+
+    public String getPhonenumber() 
+    {
+        return phonenumber;
+    }
+    public void setIdCard(String idCard) 
+    {
+        this.idCard = idCard;
+    }
+
+    public String getIdCard() 
+    {
+        return idCard;
+    }
+    public void setRecordTime(String recordTime) 
+    {
+        this.recordTime = recordTime;
+    }
+
+    public String getRecordTime() 
+    {
+        return recordTime;
+    }
+    public void setWorkingTime(String workingTime) 
+    {
+        this.workingTime = workingTime;
+    }
+
+    public String getWorkingTime() 
+    {
+        return workingTime;
+    }
+    public void setDutyTime(String dutyTime) 
+    {
+        this.dutyTime = dutyTime;
+    }
+
+    public String getDutyTime() 
+    {
+        return dutyTime;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getWeek() {
+        return week;
+    }
+
+    public void setWeek(String week) {
+        this.week = week;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("clockId", getClockId())
+            .append("userId", getUserId())
+            .append("deptName", getDeptName())
+            .append("userName", getUserName())
+            .append("phonenumber", getPhonenumber())
+            .append("idCard", getIdCard())
+            .append("recordTime", getRecordTime())
+            .append("workingTime", getWorkingTime())
+            .append("dutyTime", getDutyTime())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ClockRecordMapper.java

@@ -0,0 +1,65 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.ClockRecord;
+
+/**
+ * 打卡记录Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public interface ClockRecordMapper 
+{
+    /**
+     * 查询打卡记录
+     * 
+     * @param clockId 打卡记录主键
+     * @return 打卡记录
+     */
+    public ClockRecord selectClockRecordByClockId(Long clockId);
+
+    /**
+     * 查询打卡记录列表
+     * 
+     * @param clockRecord 打卡记录
+     * @return 打卡记录集合
+     */
+    public List<ClockRecord> selectClockRecordList(ClockRecord clockRecord);
+
+    /**
+     * 新增打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    public int insertClockRecord(ClockRecord clockRecord);
+
+    /**
+     * 修改打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    public int updateClockRecord(ClockRecord clockRecord);
+
+    /**
+     * 删除打卡记录
+     * 
+     * @param clockId 打卡记录主键
+     * @return 结果
+     */
+    public int deleteClockRecordByClockId(Long clockId);
+
+    /**
+     * 批量删除打卡记录
+     * 
+     * @param clockIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteClockRecordByClockIds(Long[] clockIds);
+
+    List<ClockRecord> selectOrderFoodListRl(ClockRecord clockRecord);
+
+    ClockRecord selectClockRecordNew(ClockRecord clockRecord);
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IClockRecordService.java

@@ -0,0 +1,65 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.system.domain.ClockRecord;
+
+/**
+ * 打卡记录Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+public interface IClockRecordService 
+{
+    /**
+     * 查询打卡记录
+     * 
+     * @param clockId 打卡记录主键
+     * @return 打卡记录
+     */
+    public ClockRecord selectClockRecordByClockId(Long clockId);
+
+    /**
+     * 查询打卡记录列表
+     * 
+     * @param clockRecord 打卡记录
+     * @return 打卡记录集合
+     */
+    public List<ClockRecord> selectClockRecordList(ClockRecord clockRecord);
+
+    /**
+     * 新增打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    public int insertClockRecord(ClockRecord clockRecord);
+
+    /**
+     * 修改打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    public int updateClockRecord(ClockRecord clockRecord);
+
+    /**
+     * 批量删除打卡记录
+     * 
+     * @param clockIds 需要删除的打卡记录主键集合
+     * @return 结果
+     */
+    public int deleteClockRecordByClockIds(Long[] clockIds);
+
+    /**
+     * 删除打卡记录信息
+     * 
+     * @param clockId 打卡记录主键
+     * @return 结果
+     */
+    public int deleteClockRecordByClockId(Long clockId);
+
+    AjaxResult selectClockRecordListRl(ClockRecord clockRecord);
+}

+ 162 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClockRecordServiceImpl.java

@@ -0,0 +1,162 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.ClockUserInfo;
+import com.ruoyi.system.domain.OrderFood;
+import com.ruoyi.system.mapper.ClockUserInfoMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.ClockRecordMapper;
+import com.ruoyi.system.domain.ClockRecord;
+import com.ruoyi.system.service.IClockRecordService;
+
+/**
+ * 打卡记录Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-06
+ */
+@Service
+public class ClockRecordServiceImpl implements IClockRecordService 
+{
+    @Autowired
+    private ClockRecordMapper clockRecordMapper;
+    @Autowired
+    private ClockUserInfoMapper clockUserInfoMapper;
+
+    /**
+     * 查询打卡记录
+     * 
+     * @param clockId 打卡记录主键
+     * @return 打卡记录
+     */
+    @Override
+    public ClockRecord selectClockRecordByClockId(Long clockId)
+    {
+        return clockRecordMapper.selectClockRecordByClockId(clockId);
+    }
+
+    /**
+     * 查询打卡记录列表
+     * 
+     * @param clockRecord 打卡记录
+     * @return 打卡记录
+     */
+    @Override
+    public List<ClockRecord> selectClockRecordList(ClockRecord clockRecord)
+    {
+        return clockRecordMapper.selectClockRecordList(clockRecord);
+    }
+
+    /**
+     * 新增打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    @Override
+    public int insertClockRecord(ClockRecord clockRecord)
+    {
+        clockRecord.setCreateTime(DateUtils.getNowDate());
+        return clockRecordMapper.insertClockRecord(clockRecord);
+    }
+
+    /**
+     * 修改打卡记录
+     * 
+     * @param clockRecord 打卡记录
+     * @return 结果
+     */
+    @Override
+    public int updateClockRecord(ClockRecord clockRecord)
+    {
+        clockRecord.setUpdateTime(DateUtils.getNowDate());
+        return clockRecordMapper.updateClockRecord(clockRecord);
+    }
+
+    /**
+     * 批量删除打卡记录
+     * 
+     * @param clockIds 需要删除的打卡记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteClockRecordByClockIds(Long[] clockIds)
+    {
+        return clockRecordMapper.deleteClockRecordByClockIds(clockIds);
+    }
+
+    /**
+     * 删除打卡记录信息
+     * 
+     * @param clockId 打卡记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteClockRecordByClockId(Long clockId)
+    {
+        return clockRecordMapper.deleteClockRecordByClockId(clockId);
+    }
+
+    @Override
+    public AjaxResult selectClockRecordListRl(ClockRecord clockRecord) {
+        Map<String, Object> resultMap = new HashMap<>();
+        //查询人员数据
+        ClockUserInfo clockUserInfo = clockUserInfoMapper.selectClockUserInfoByUserId(clockRecord.getUserId());
+        resultMap.put("name",clockUserInfo.getUserName());
+        //查询最新打卡数据
+        ClockRecord clockRecordNew = clockRecordMapper.selectClockRecordNew(clockRecord);
+        resultMap.put("time",clockRecordNew.getRecordTime());
+        //todo 上下班时间
+        resultMap.put("workTime","");
+        //查询查询月打卡数据
+        List<ClockRecord> clockRecords = clockRecordMapper.selectOrderFoodListRl(clockRecord);
+        //按日期分类
+        Map<String, List<ClockRecord>> clockTime = new HashMap<>();
+        if (clockRecords != null && clockRecords.size() > 0){
+            clockTime = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getRecordTime));
+        }
+        //查询传入月所有日期
+        List<String> dayList = DateUtils.getDay(DateUtils.parseDate(clockRecord.getRecordTime()));
+        //写入数据
+        List<Map> mapList = new ArrayList<>();
+        if (dayList.size()> 0){
+            for (String day : dayList) {
+                Map<String,Object> map = new HashMap<>(5);
+                map.put("date",day);
+                map.put("am","未打卡");
+                //上午打卡标识 1:打卡,2:未打卡
+                map.put("amex","2");
+                map.put("pm","未打卡");
+                //下午打卡标识 1:打卡,2:未打卡
+                map.put("pmex","2");
+                if (clockTime.size() > 0){
+                    List<ClockRecord> clockRecordList = clockTime.get(day);
+                    if (clockRecordList != null && clockRecordList.size() > 0){
+                        for (ClockRecord clock : clockRecordList) {
+                            if(StringUtils.isNotEmpty(clock.getWorkingTime())){
+                                map.put("am",clock.getWorkingTime());
+                                //上午打卡表示 1:打卡,2:未打卡
+                                map.put("amex","1");
+                            }
+                            if(StringUtils.isNotEmpty(clock.getDutyTime())){
+                                map.put("pm",clock.getDutyTime());
+                                //下午打卡表示 1:打卡,2:未打卡
+                                map.put("pmex","1");
+                            }
+                        }
+                    }
+                }
+                mapList.add(map);
+            }
+        }
+        //日历数据
+        resultMap.put("rlData",mapList);
+        return AjaxResult.success(resultMap);
+    }
+}

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderFoodServiceImpl.java

@@ -4,8 +4,10 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.system.mapper.SysDeptMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.OrderFoodMapper;
@@ -23,6 +25,8 @@ public class OrderFoodServiceImpl implements IOrderFoodService {
     @Autowired
     private OrderFoodMapper orderFoodMapper;
 
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
     /**
      * 查询订餐预约
      *
@@ -101,6 +105,12 @@ public class OrderFoodServiceImpl implements IOrderFoodService {
             return AjaxResult.error("请勿重复预约");
         }
         orderFood.setCreateTime(DateUtils.getNowDate());
+        orderFood.setOrderFoodUserId(userId);
+        orderFood.setOrderFoodUser(SecurityUtils.getUsername());
+        orderFood.setOrderFoodDeptId(SecurityUtils.getDeptId());
+        //
+        SysDept sysDept = sysDeptMapper.selectDeptById(SecurityUtils.getDeptId());
+        orderFood.setOrderFoodDept(sysDept.getDeptName());
         int rows = orderFoodMapper.insertOrderFood(orderFood);
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
     }

+ 154 - 0
ruoyi-system/src/main/resources/mapper/system/ClockRecordMapper.xml

@@ -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 &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND record_time &lt;= #{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 &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND record_time &lt;= #{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>