增加今日菜单功能
This commit is contained in:
parent
14186cc4af
commit
d903c4ebe5
@ -4,14 +4,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.service.IFtConfigDaoService;
|
||||
import com.ruoyi.system.fantang.service.IFtOrderDaoService;
|
||||
import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
|
||||
import com.ruoyi.system.fantang.service.IFtStaffInfoDaoService;
|
||||
import com.ruoyi.system.fantang.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@ -34,6 +32,9 @@ public class ClientController extends BaseController {
|
||||
@Autowired
|
||||
private IFtOrderDaoService orderDaoService;
|
||||
|
||||
@Autowired
|
||||
private IFtWeekMenuDaoService weekMenuDaoService;
|
||||
|
||||
/**
|
||||
* 获取用餐时间信息
|
||||
* 日期:2020年12月11日
|
||||
@ -232,4 +233,20 @@ public class ClientController extends BaseController {
|
||||
Boolean demandMode = params.getBoolean("demandModeFlag");
|
||||
return staffDemandDaoService.setDemandMode(id, type, demandMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当天菜谱
|
||||
* param today
|
||||
* return
|
||||
*/
|
||||
@GetMapping("/getTodayMenu")
|
||||
public AjaxResult getTodayMenu() {
|
||||
String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
return weekMenuDaoService.getTodayMenu(weekDays[w]);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.domain.FtWeekMenuDao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 每周菜单Mapper接口
|
||||
@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface FtWeekMenuDaoMapper extends BaseMapper<FtWeekMenuDao> {
|
||||
|
||||
@Select("SELECT a.weekday, a.dinner_type, GROUP_CONCAT(b.name ) name FROM ft_week_menu a LEFT JOIN ft_food b ON FIND_IN_SET(b.food_id,a.foods) WHERE a.weekday = #{weekDay} GROUP BY a.dinner_type")
|
||||
AjaxResult getTodayMenu(String weekDay);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.fantang.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.domain.FtWeekMenuDao;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -11,4 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IFtWeekMenuDaoService extends IService<FtWeekMenuDao> {
|
||||
|
||||
AjaxResult getTodayMenu(String weekDay);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.fantang.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.system.fantang.mapper.FtWeekMenuDaoMapper;
|
||||
@ -15,4 +16,8 @@ import com.ruoyi.system.fantang.service.IFtWeekMenuDaoService;
|
||||
@Service
|
||||
public class FtWeekMenuDaoServiceImpl extends ServiceImpl<FtWeekMenuDaoMapper, FtWeekMenuDao> implements IFtWeekMenuDaoService {
|
||||
|
||||
@Override
|
||||
public AjaxResult getTodayMenu(String weekDay) {
|
||||
return this.baseMapper.getTodayMenu(weekDay);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user