新增获取当天员工订单接口

This commit is contained in:
czx 2020-12-11 14:42:05 +08:00
parent fe51f511a4
commit 1540db84df
5 changed files with 25 additions and 5 deletions

View File

@ -42,8 +42,8 @@ public class ClientController extends BaseController {
}
@GetMapping("/getOrderOfToday/{staffId}")
public AjaxResult getOrderOfToday(@PathVariable("staffId") Integer staffId) {
return AjaxResult.success("调用成功");
public AjaxResult getOrderOfToday(@PathVariable("staffId") Long staffId) {
return AjaxResult.success(orderDaoService.getOrderOfToday(staffId));
}
@GetMapping("/getWeekMenu")
@ -95,8 +95,7 @@ public class ClientController extends BaseController {
@PostMapping("/logout/{staffId}")
public AjaxResult logout(@PathVariable("staffId") Long staffId) {
staffInfoDaoService.logout(staffId);
return AjaxResult.success("登录成功");
return AjaxResult.success(staffInfoDaoService.logout(staffId));
}
@GetMapping("/getWorkday")

View File

@ -46,7 +46,7 @@ public class FtOrderDao implements Serializable {
/**
* 员工 id
*/
private Long workerId;
private Long staffId;
/**
* 清单

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.fantang.domain.FtOrderDao;
import org.apache.ibatis.annotations.Insert;
import java.util.List;
/**
* 订单管理Mapper接口
*
@ -14,4 +16,7 @@ public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
@Insert("insert into ft_order (order_type, staff_id, order_src, create_at, order_date, order_list, total_price) select type as order_type, staff_id, 1 as order_src, now() as create_at, date_add(now(), interval 1 day) as order_date, foods, (select sum(price) from ft_food f where FIND_IN_SET(f.food_id,d.foods)) as price from ft_staff_demand d where d.demand_mode = 1")
void GenerateStaffTomorrowOrder();
List<FtOrderDao> getOrderOfToday(Long staffId);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.fantang.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtOrderDao;
/**
@ -11,4 +12,5 @@ import com.ruoyi.system.fantang.domain.FtOrderDao;
*/
public interface IFtOrderDaoService extends IService<FtOrderDao> {
AjaxResult getOrderOfToday(Long staffId);
}

View File

@ -1,12 +1,17 @@
package com.ruoyi.system.fantang.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtOrderDao;
import com.ruoyi.system.fantang.mapper.FtOrderDaoMapper;
import com.ruoyi.system.fantang.service.IFtOrderDaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 订单管理Service业务层处理
*
@ -20,4 +25,13 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
this.baseMapper.GenerateStaffTomorrowOrder();
}
@Override
public AjaxResult getOrderOfToday(Long staffId) {
QueryWrapper<FtOrderDao> wrapper = new QueryWrapper<>();
wrapper.eq("staff_id", staffId);
wrapper.between("order_date", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()));
return AjaxResult.success(this.baseMapper.selectList(wrapper));
}
}