6/19 解决了菜品/套餐页面修改窗口无法关闭的问题,以及菜品管理页面菜品分类字段显示空白的问题

This commit is contained in:
zyx 2023-06-19 16:35:34 +08:00
parent 2fa3110b84
commit ee47200b4e
5 changed files with 31 additions and 1 deletions

View File

@ -44,6 +44,12 @@ public class CategoryController {
@Autowired
private CategoryService categoryService;
@GetMapping("list")
public Result<List<CategoryDTO>> list(@RequestParam Map<String, Object> params){
List<CategoryDTO> list = categoryService.list(params);
return new Result<List<CategoryDTO>>().ok(list);
}
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({

View File

@ -10,6 +10,8 @@ import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.front.bean.Category;
import io.renren.modules.front.service.CategoryService;
import io.renren.modules.takeout.dto.DishDTO;
import io.renren.modules.takeout.excel.DishExcel;
import io.renren.modules.takeout.service.DishService;
@ -41,9 +43,18 @@ public class DishController {
@Autowired
private DishService dishService;
@Autowired
private CategoryService categoryService;
@Autowired
private RedisTemplate redisTemplate;
@GetMapping("list")
public Result<List<DishDTO>> list(@RequestParam Map<String, Object> params){
List<DishDTO> list = dishService.list(params);
return new Result<List<DishDTO>>().ok(list);
}
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ -55,7 +66,13 @@ public class DishController {
@RequiresPermissions("takeout:dish:page")
public Result<PageData<DishDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<DishDTO> page = dishService.page(params);
List<DishDTO> dishDTOList = page.getList();
for (DishDTO dishDTO : dishDTOList) {
Long categoryId = dishDTO.getCategoryId();
Category category = categoryService.getById(categoryId);
dishDTO.setCategoryName(category.getName());
}
page.setList(dishDTOList);
return new Result<PageData<DishDTO>>().ok(page);
}

View File

@ -28,6 +28,9 @@ public class DishDTO implements Serializable {
@ApiModelProperty(value = "菜品分类id")
private Long categoryId;
@ApiModelProperty(value = "菜品分类名称")
private String categoryName;
@ApiModelProperty(value = "菜品价格")
private BigDecimal price;

View File

@ -23,9 +23,11 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, CategoryEn
@Override
public QueryWrapper<CategoryEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String type = (String) params.get("type");
QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(type), "type", type);
return wrapper;
}

View File

@ -23,9 +23,11 @@ public class DishServiceImpl extends CrudServiceImpl<DishDao, DishEntity, DishDT
@Override
public QueryWrapper<DishEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String categoryId = (String)params.get("categoryId");
QueryWrapper<DishEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(categoryId), "category_id", categoryId);
return wrapper;
}