返回菜单接口bug
This commit is contained in:
parent
5f825db580
commit
357eb123c9
@ -216,13 +216,16 @@ public class ClientController extends BaseController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化员工订餐配置文件,并返回初始化后的记录给前端
|
||||
* params: staffId
|
||||
* return
|
||||
*/
|
||||
@PostMapping("/initDemandMode")
|
||||
public AjaxResult initDemandMode(@RequestBody JSONObject params) {
|
||||
return staffDemandDaoService.initDemandMode(params.getLong("staffId"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置订餐模式
|
||||
* 日期:2020年12月11日
|
||||
@ -243,18 +246,18 @@ public class ClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当天菜谱
|
||||
* 返回某天的菜单
|
||||
* param today
|
||||
* return
|
||||
*/
|
||||
@GetMapping("/getTodayMenu")
|
||||
public AjaxResult getTodayMenu(@RequestBody JSONObject params) {
|
||||
@PostMapping("/getMenuOfDay")
|
||||
public AjaxResult getMenuOfDay(@RequestBody JSONObject params) {
|
||||
String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(params.getDate("date"));
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
return weekMenuDaoService.getTodayMenu(weekDays[w]);
|
||||
return weekMenuDaoService.getMenuOfDay(weekDays[w]);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
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.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 每周菜单Mapper接口
|
||||
*
|
||||
@ -16,5 +18,5 @@ public interface FtWeekMenuDaoMapper extends BaseMapper<FtWeekMenuDao> {
|
||||
// 非聚合方式转换参考
|
||||
// SELECT a.weekday, a.dinner_type, 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 = '周一'
|
||||
@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);
|
||||
List<FtWeekMenuDao> getTodayMenu(@Param("weekDay")String weekDay);
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IFtWeekMenuDaoService extends IService<FtWeekMenuDao> {
|
||||
|
||||
AjaxResult getTodayMenu(String weekDay);
|
||||
AjaxResult getMenuOfDay(String weekDay);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import com.ruoyi.system.fantang.service.IFtWeekMenuDaoService;
|
||||
public class FtWeekMenuDaoServiceImpl extends ServiceImpl<FtWeekMenuDaoMapper, FtWeekMenuDao> implements IFtWeekMenuDaoService {
|
||||
|
||||
@Override
|
||||
public AjaxResult getTodayMenu(String weekDay) {
|
||||
return this.baseMapper.getTodayMenu(weekDay);
|
||||
public AjaxResult getMenuOfDay(String weekDay) {
|
||||
return AjaxResult.success(this.baseMapper.getTodayMenu(weekDay));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user