|
@@ -2,6 +2,7 @@ package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.management.platform.entity.MealApplications;
|
|
|
import com.management.platform.entity.MealTypes;
|
|
import com.management.platform.entity.MealTypes;
|
|
|
import com.management.platform.mapper.MealApplicationsMapper;
|
|
import com.management.platform.mapper.MealApplicationsMapper;
|
|
|
import com.management.platform.mapper.MealTypesMapper;
|
|
import com.management.platform.mapper.MealTypesMapper;
|
|
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -32,8 +34,8 @@ public class MealTypesController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private MealTypesMapper mealTypesMapper;
|
|
private MealTypesMapper mealTypesMapper;
|
|
|
|
|
|
|
|
- @Resource
|
|
|
|
|
- private MealApplicationsMapper mealApplicationsMapper;
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private MealApplicationsService mealApplicationsService;
|
|
|
|
|
|
|
|
@RequestMapping("/getMeals")
|
|
@RequestMapping("/getMeals")
|
|
|
public HttpRespMsg getMeals(){
|
|
public HttpRespMsg getMeals(){
|
|
@@ -42,6 +44,13 @@ public class MealTypesController {
|
|
|
msg.setCode("ok");
|
|
msg.setCode("ok");
|
|
|
return msg;
|
|
return msg;
|
|
|
}
|
|
}
|
|
|
|
|
+ @RequestMapping("/getMealsList")
|
|
|
|
|
+ public HttpRespMsg getMealsList(){
|
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
|
+ msg.setData(mealTypesService.list());
|
|
|
|
|
+ msg.setCode("ok");
|
|
|
|
|
+ return msg;
|
|
|
|
|
+ }
|
|
|
@RequestMapping("/updateMeal")
|
|
@RequestMapping("/updateMeal")
|
|
|
public HttpRespMsg updateMeal(MealTypes mealTypes){
|
|
public HttpRespMsg updateMeal(MealTypes mealTypes){
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
@@ -58,6 +67,10 @@ public class MealTypesController {
|
|
|
@RequestMapping("/deleteMealType")
|
|
@RequestMapping("/deleteMealType")
|
|
|
public HttpRespMsg deleteMealType(Integer id){
|
|
public HttpRespMsg deleteMealType(Integer id){
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
|
+ List<MealApplications> list = mealApplicationsService.list(new QueryWrapper<MealApplications>().eq("meal_type_id", id).eq("status", 0));
|
|
|
|
|
+ if(!list.isEmpty()){
|
|
|
|
|
+ return msg.fail("该餐别已有报餐数据,不可删除");
|
|
|
|
|
+ }
|
|
|
boolean delete = mealTypesService.removeById(id);
|
|
boolean delete = mealTypesService.removeById(id);
|
|
|
if(delete){
|
|
if(delete){
|
|
|
msg.setCode("ok");
|
|
msg.setCode("ok");
|