From 5f825db5800bd2b7311990c2c8d62881e399bde9 Mon Sep 17 00:00:00 2001 From: czx <28353131@qq.com> Date: Thu, 24 Dec 2020 09:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=91=98=E5=B7=A5=E9=85=8D=E7=BD=AE=E8=AE=B0=E5=BD=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fantang/controller/ClientController.java | 8 ++++++++ .../fantang/mapper/FtStaffDemandDaoMapper.java | 4 ++++ .../service/IFtStaffDemandDaoService.java | 2 ++ .../impl/FtStaffDemandDaoServiceImpl.java | 17 +++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java index 45e4150a4..1d71eeb6a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java @@ -2,6 +2,7 @@ package com.ruoyi.system.fantang.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.fantang.service.*; @@ -215,6 +216,13 @@ public class ClientController extends BaseController { return null; } + @PostMapping("/initDemandMode") + public AjaxResult initDemandMode(@RequestBody JSONObject params) { + return staffDemandDaoService.initDemandMode(params.getLong("staffId")); + } + + + /** * 设置订餐模式 * 日期:2020年12月11日 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffDemandDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffDemandDaoMapper.java index 9a98ecdc2..c047de9da 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffDemandDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffDemandDaoMapper.java @@ -1,7 +1,9 @@ package com.ruoyi.system.fantang.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.system.fantang.domain.FtStaffDemandDao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Insert; /** * 员工报餐Mapper接口 @@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface FtStaffDemandDaoMapper extends BaseMapper { + @Insert("INSERT into ft_staff_demand (staff_id, type, demand_mode) VALUES (#{staffId}, 1, 0),(#{staffId}, 2, 0),(#{staffId}, 3, 0)") + Integer initDemandMode(Long staffId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtStaffDemandDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtStaffDemandDaoService.java index fb40fa0fc..850f19071 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtStaffDemandDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtStaffDemandDaoService.java @@ -15,4 +15,6 @@ public interface IFtStaffDemandDaoService extends IService { AjaxResult getConfiguration(Long staffId); AjaxResult setDemandMode(Long id, Integer type, Boolean demandModeFlag); + + AjaxResult initDemandMode(Long staffId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtStaffDemandDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtStaffDemandDaoServiceImpl.java index dcbb4f977..858005de6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtStaffDemandDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtStaffDemandDaoServiceImpl.java @@ -8,7 +8,9 @@ import com.ruoyi.system.fantang.mapper.FtStaffDemandDaoMapper; import com.ruoyi.system.fantang.domain.FtStaffDemandDao; import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 员工报餐Service业务层处理 @@ -42,4 +44,19 @@ public class FtStaffDemandDaoServiceImpl extends ServiceImpl map = new HashMap<>(); + map.put("staff_id", staffId); + int ret = this.baseMapper.deleteByMap(map); + // 初始化三条订餐配置信息 + this.baseMapper.initDemandMode(staffId); + + // 重新检索返回给前端 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("staff_id", staffId); + return AjaxResult.success(this.baseMapper.selectList(wrapper)); + } + }