Explorar o código

Merge remote-tracking branch 'origin/master'

Administrator hai 10 meses
pai
achega
5705a6d42b

+ 98 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/clock/DutyScheduleController.java

@@ -0,0 +1,98 @@
+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.DutySchedule;
+import com.ruoyi.system.service.IDutyScheduleService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 上班时间配置Controller
+ *
+ * @author ruoyi
+ * @date 2024-08-07
+ */
+@RestController
+@RequestMapping("/system/schedule")
+public class DutyScheduleController extends BaseController {
+    @Autowired
+    private IDutyScheduleService dutyScheduleService;
+
+    /**
+     * 查询上班时间配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(DutySchedule dutySchedule) {
+        startPage();
+        List<DutySchedule> list = dutyScheduleService.selectDutyScheduleList(dutySchedule);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出上班时间配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:export')")
+    @Log(title = "上班时间配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DutySchedule dutySchedule) {
+        List<DutySchedule> list = dutyScheduleService.selectDutyScheduleList(dutySchedule);
+        ExcelUtil<DutySchedule> util = new ExcelUtil<DutySchedule>(DutySchedule.class);
+        util.exportExcel(response, list, "上班时间配置数据");
+    }
+
+    /**
+     * 获取上班时间配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:query')")
+    @GetMapping(value = "/{dutyId}")
+    public AjaxResult getInfo(@PathVariable("dutyId") Long dutyId) {
+        return success(dutyScheduleService.selectDutyScheduleByDutyId(dutyId));
+    }
+
+    /**
+     * 新增上班时间配置
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:add')")
+    @Log(title = "上班时间配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DutySchedule dutySchedule) {
+        return toAjax(dutyScheduleService.insertDutySchedule(dutySchedule));
+    }
+
+    /**
+     * 修改上班时间配置
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:edit')")
+    @Log(title = "上班时间配置", businessType = BusinessType.UPDATE)
+    @PostMapping("/put")
+    public AjaxResult edit(@RequestBody DutySchedule dutySchedule) {
+        return toAjax(dutyScheduleService.updateDutySchedule(dutySchedule));
+    }
+
+    /**
+     * 删除上班时间配置
+     */
+    @PreAuthorize("@ss.hasPermi('system:schedule:remove')")
+    @Log(title = "上班时间配置", businessType = BusinessType.DELETE)
+    @GetMapping("/delete/{dutyIds}")
+    public AjaxResult remove(@PathVariable Long[] dutyIds) {
+        return toAjax(dutyScheduleService.deleteDutyScheduleByDutyIds(dutyIds));
+    }
+}

+ 13 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/StatisticsController.java

@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.common;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.service.IBomanReservatService;
+import com.ruoyi.system.service.IClockRecordService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,6 +15,9 @@ public class StatisticsController {
     @Autowired
     private IBomanReservatService bomanReservatService;
 
+    @Autowired
+    private IClockRecordService clockRecordService;
+
 
     /**
      * pc首页统计每周预约
@@ -24,4 +28,13 @@ public class StatisticsController {
         return bomanReservatService.weekAppointment();
     }
 
+    /**
+     * pc首页统计考勤和订餐
+     */
+    @GetMapping(value = "/kqdc")
+    public AjaxResult kqdc()
+    {
+        return clockRecordService.kqdc();
+    }
+
 }

+ 5 - 13
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -273,20 +273,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
 
     public static void main(String[] args) {
-        String monday = monday();
-        String lastMonday = lastMonday();
-        List<String> collect = weekList();
-        System.out.println("当前周一:"+monday);
-        System.out.println("上周一:"+lastMonday);
-        System.out.println("上周日:"+collect);
-        // 获取当前日期
-        LocalDate today = LocalDate.now();
-
-        // 获取上周的每一天
-        IntStream.range(1, 8)
-                .mapToObj(day -> today.with(TemporalAdjusters.previous(DayOfWeek.MONDAY)).minusWeeks(1).plusDays(day - 1))
-                .forEach(System.out::println);
+        List<String> strings = weekList();
+        for (String string : strings) {
+            System.out.println(string);
+        }
     }
+
     /**
      * 增加 Date  ==> LocalDate
      */

+ 70 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/DutySchedule.java

@@ -0,0 +1,70 @@
+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;
+
+/**
+ * 上班时间配置对象 duty_schedule
+ * 
+ * @author ruoyi
+ * @date 2024-08-07
+ */
+public class DutySchedule extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long dutyId;
+
+    /** 上班时间 */
+    @Excel(name = "上班时间")
+    private String startWorkTime;
+
+    /** 下班时间 */
+    @Excel(name = "下班时间")
+    private String endWorkTime;
+
+    public void setDutyId(Long dutyId) 
+    {
+        this.dutyId = dutyId;
+    }
+
+    public Long getDutyId() 
+    {
+        return dutyId;
+    }
+    public void setStartWorkTime(String startWorkTime) 
+    {
+        this.startWorkTime = startWorkTime;
+    }
+
+    public String getStartWorkTime() 
+    {
+        return startWorkTime;
+    }
+    public void setEndWorkTime(String endWorkTime) 
+    {
+        this.endWorkTime = endWorkTime;
+    }
+
+    public String getEndWorkTime() 
+    {
+        return endWorkTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("dutyId", getDutyId())
+            .append("startWorkTime", getStartWorkTime())
+            .append("endWorkTime", getEndWorkTime())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DutyScheduleMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.DutySchedule;
+
+/**
+ * 上班时间配置Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-07
+ */
+public interface DutyScheduleMapper 
+{
+    /**
+     * 查询上班时间配置
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 上班时间配置
+     */
+    public DutySchedule selectDutyScheduleByDutyId(Long dutyId);
+
+    /**
+     * 查询上班时间配置列表
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 上班时间配置集合
+     */
+    public List<DutySchedule> selectDutyScheduleList(DutySchedule dutySchedule);
+
+    /**
+     * 新增上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    public int insertDutySchedule(DutySchedule dutySchedule);
+
+    /**
+     * 修改上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    public int updateDutySchedule(DutySchedule dutySchedule);
+
+    /**
+     * 删除上班时间配置
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 结果
+     */
+    public int deleteDutyScheduleByDutyId(Long dutyId);
+
+    /**
+     * 批量删除上班时间配置
+     * 
+     * @param dutyIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDutyScheduleByDutyIds(Long[] dutyIds);
+}

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

@@ -62,4 +62,6 @@ public interface IClockRecordService
     public int deleteClockRecordByClockId(Long clockId);
 
     AjaxResult selectClockRecordListRl(ClockRecord clockRecord);
+
+    AjaxResult kqdc();
 }

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IDutyScheduleService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.DutySchedule;
+
+/**
+ * 上班时间配置Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-07
+ */
+public interface IDutyScheduleService 
+{
+    /**
+     * 查询上班时间配置
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 上班时间配置
+     */
+    public DutySchedule selectDutyScheduleByDutyId(Long dutyId);
+
+    /**
+     * 查询上班时间配置列表
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 上班时间配置集合
+     */
+    public List<DutySchedule> selectDutyScheduleList(DutySchedule dutySchedule);
+
+    /**
+     * 新增上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    public int insertDutySchedule(DutySchedule dutySchedule);
+
+    /**
+     * 修改上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    public int updateDutySchedule(DutySchedule dutySchedule);
+
+    /**
+     * 批量删除上班时间配置
+     * 
+     * @param dutyIds 需要删除的上班时间配置主键集合
+     * @return 结果
+     */
+    public int deleteDutyScheduleByDutyIds(Long[] dutyIds);
+
+    /**
+     * 删除上班时间配置信息
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 结果
+     */
+    public int deleteDutyScheduleByDutyId(Long dutyId);
+}

+ 41 - 21
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -1,6 +1,6 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.List;
+import java.util.*;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
@@ -110,6 +110,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService
      */
     @Override
     public AjaxResult weekAppointment() {
+        Map<String,Object> resultMap = new HashMap<>();
         //获取上周一
         String lastMonday = DateUtils.lastMonday();
         //获取上周日
@@ -118,29 +119,48 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         String monday = DateUtils.monday();
         //获取当前日期
         String day = DateUtils.getDate();
-
-        //获取上周预约人数
-        int syy = 0;
-        BomanReservat bomanReservat1 = new BomanReservat();
-        bomanReservat1.setStartTime(lastMonday);
-        bomanReservat1.setEndTime(lastSunday);
-        List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat1);
-        //上周访客人数
+        //获取本周一到周日的时间
+        List<String> strings = DateUtils.weekList();
+
+        //预约人数
+        int yy = 0;
+        BomanReservat bomanReservat = new BomanReservat();
+        bomanReservat.setStartTime(lastMonday);
+        bomanReservat.setEndTime(lastSunday);
+        List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat);
+        //访客人数
         int fk = 0;
         if(lastList!=null && lastList.size()>0){
-            syy = lastList.size();
+            yy = lastList.size();
         }
-
-        //获取本周预约人数
-        BomanReservat bomanReservat2 = new BomanReservat();
-        bomanReservat2.setStartTime(monday);
-        bomanReservat2.setEndTime(day);
-        List<BomanReservat> list = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat2);
-
-        //
-
-
-        return null;
+        //周一到周日的访客人数
+        List<String> yyList = new ArrayList<>();
+        //周一到周日的到访人数
+        List<String> fkList = new ArrayList<>();
+
+        for (String string : strings) {
+            //周几的预约人数
+            int weekyy = 0;
+            //周几的访客人数
+            int weekfk = 0;
+            for (BomanReservat reservat : lastList) {
+                if(string.equals(reservat.getVisitDate())){
+                    weekyy++;
+                    if("2".equals(reservat.getVisitStatus())){
+                        weekfk++;
+                        fk++;
+                    }
+                }
+            }
+            yyList.add(String.valueOf(weekyy));
+            fkList.add(String.valueOf(weekfk));
+        }
+        resultMap.put("yyzs",yy);
+        resultMap.put("fkzs",fk);
+        resultMap.put("x",strings);
+        resultMap.put("y1",yyList);
+        resultMap.put("y2",fkList);
+        return AjaxResult.success(resultMap);
     }
 
 }

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

@@ -9,6 +9,7 @@ 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 com.ruoyi.system.mapper.OrderFoodMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.ClockRecordMapper;
@@ -28,6 +29,8 @@ public class ClockRecordServiceImpl implements IClockRecordService
     private ClockRecordMapper clockRecordMapper;
     @Autowired
     private ClockUserInfoMapper clockUserInfoMapper;
+    @Autowired
+    private OrderFoodMapper orderFoodMapper;
 
     /**
      * 查询打卡记录
@@ -159,4 +162,58 @@ public class ClockRecordServiceImpl implements IClockRecordService
         resultMap.put("rlData",mapList);
         return AjaxResult.success(resultMap);
     }
+
+    @Override
+    public AjaxResult kqdc() {
+        Map<String, Object> resultMap = new HashMap<>();
+        //获取当前日期
+        String day = DateUtils.getDate();
+        //查询当天应打卡人数
+        int dkzs = 0;
+        ClockRecord clockRecord = new ClockRecord();
+        clockRecord.setRecordTime(day);
+        List<ClockRecord> clockRecords = clockRecordMapper.selectClockRecordList(clockRecord);
+        //已打卡人数
+        int ydk = 0;
+        //未打卡人数
+        int wdk = 0;
+        if(clockRecords!=null && clockRecords.size()>0){
+            dkzs = clockRecords.size();
+            for (ClockRecord record : clockRecords) {
+                if(StringUtils.isNotEmpty(record.getWorkingTime()) || StringUtils.isNotEmpty(record.getDutyTime())){
+                    ydk++;
+                }else{
+                    wdk++;
+                }
+            }
+        }
+        //订餐统计
+        OrderFood orderFood = new OrderFood();
+        orderFood.setOrderFoodTime(DateUtils.parseDate(day));
+        List<OrderFood> orderFoods = orderFoodMapper.selectOrderFoodList(orderFood);
+        //订餐总人数
+        int dczs = 0;
+        //订餐午餐人数
+        int dcwc = 0;
+        //订餐晚餐人数
+        int dcDinner = 0;
+        if(orderFoods!=null && orderFoods.size()>0){
+            dczs = orderFoods.size();
+            for (OrderFood food : orderFoods) {
+                if("1".equals(food.getOrderFoodType())){
+                    dcwc++;
+                }
+                if("2".equals(food.getOrderFoodType())){
+                    dcDinner++;
+                }
+            }
+        }
+        resultMap.put("dkzs",dkzs);
+        resultMap.put("ydk",ydk);
+        resultMap.put("wdk",wdk);
+        resultMap.put("dczs",dczs);
+        resultMap.put("dcwc",dcwc);
+        resultMap.put("dcDinner",dcDinner);
+        return AjaxResult.success(resultMap);
+    }
 }

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DutyScheduleServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.DutyScheduleMapper;
+import com.ruoyi.system.domain.DutySchedule;
+import com.ruoyi.system.service.IDutyScheduleService;
+
+/**
+ * 上班时间配置Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-07
+ */
+@Service
+public class DutyScheduleServiceImpl implements IDutyScheduleService 
+{
+    @Autowired
+    private DutyScheduleMapper dutyScheduleMapper;
+
+    /**
+     * 查询上班时间配置
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 上班时间配置
+     */
+    @Override
+    public DutySchedule selectDutyScheduleByDutyId(Long dutyId)
+    {
+        return dutyScheduleMapper.selectDutyScheduleByDutyId(dutyId);
+    }
+
+    /**
+     * 查询上班时间配置列表
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 上班时间配置
+     */
+    @Override
+    public List<DutySchedule> selectDutyScheduleList(DutySchedule dutySchedule)
+    {
+        return dutyScheduleMapper.selectDutyScheduleList(dutySchedule);
+    }
+
+    /**
+     * 新增上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    @Override
+    public int insertDutySchedule(DutySchedule dutySchedule)
+    {
+        dutySchedule.setCreateTime(DateUtils.getNowDate());
+        return dutyScheduleMapper.insertDutySchedule(dutySchedule);
+    }
+
+    /**
+     * 修改上班时间配置
+     * 
+     * @param dutySchedule 上班时间配置
+     * @return 结果
+     */
+    @Override
+    public int updateDutySchedule(DutySchedule dutySchedule)
+    {
+        dutySchedule.setUpdateTime(DateUtils.getNowDate());
+        return dutyScheduleMapper.updateDutySchedule(dutySchedule);
+    }
+
+    /**
+     * 批量删除上班时间配置
+     * 
+     * @param dutyIds 需要删除的上班时间配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDutyScheduleByDutyIds(Long[] dutyIds)
+    {
+        return dutyScheduleMapper.deleteDutyScheduleByDutyIds(dutyIds);
+    }
+
+    /**
+     * 删除上班时间配置信息
+     * 
+     * @param dutyId 上班时间配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDutyScheduleByDutyId(Long dutyId)
+    {
+        return dutyScheduleMapper.deleteDutyScheduleByDutyId(dutyId);
+    }
+}

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/BomanReservatMapper.xml

@@ -70,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectBomanReservatTimeList" parameterType="BomanReservat" resultMap="BomanReservatResult">
         <include refid="selectBomanReservatVo"/>
         <where>
+            <if test="visitStatus != null  and visitStatus != ''"> and visit_status = #{visitStatus}</if>
             <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
                 AND visit_date &gt;= #{startTime}
             </if>

+ 81 - 0
ruoyi-system/src/main/resources/mapper/system/DutyScheduleMapper.xml

@@ -0,0 +1,81 @@
+<?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.DutyScheduleMapper">
+    
+    <resultMap type="DutySchedule" id="DutyScheduleResult">
+        <result property="dutyId"    column="duty_id"    />
+        <result property="startWorkTime"    column="start_work_time"    />
+        <result property="endWorkTime"    column="end_work_time"    />
+        <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="selectDutyScheduleVo">
+        select duty_id, start_work_time, end_work_time, create_by, create_time, update_by, update_time, remark from duty_schedule
+    </sql>
+
+    <select id="selectDutyScheduleList" parameterType="DutySchedule" resultMap="DutyScheduleResult">
+        <include refid="selectDutyScheduleVo"/>
+        <where>  
+            <if test="startWorkTime != null  and startWorkTime != ''"> and start_work_time = #{startWorkTime}</if>
+            <if test="endWorkTime != null  and endWorkTime != ''"> and end_work_time = #{endWorkTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectDutyScheduleByDutyId" parameterType="Long" resultMap="DutyScheduleResult">
+        <include refid="selectDutyScheduleVo"/>
+        where duty_id = #{dutyId}
+    </select>
+        
+    <insert id="insertDutySchedule" parameterType="DutySchedule" useGeneratedKeys="true" keyProperty="dutyId">
+        insert into duty_schedule
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="startWorkTime != null">start_work_time,</if>
+            <if test="endWorkTime != null">end_work_time,</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="startWorkTime != null">#{startWorkTime},</if>
+            <if test="endWorkTime != null">#{endWorkTime},</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="updateDutySchedule" parameterType="DutySchedule">
+        update duty_schedule
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="startWorkTime != null">start_work_time = #{startWorkTime},</if>
+            <if test="endWorkTime != null">end_work_time = #{endWorkTime},</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 duty_id = #{dutyId}
+    </update>
+
+    <delete id="deleteDutyScheduleByDutyId" parameterType="Long">
+        delete from duty_schedule where duty_id = #{dutyId}
+    </delete>
+
+    <delete id="deleteDutyScheduleByDutyIds" parameterType="String">
+        delete from duty_schedule where duty_id in 
+        <foreach item="dutyId" collection="array" open="(" separator="," close=")">
+            #{dutyId}
+        </foreach>
+    </delete>
+</mapper>