package com.bonus.canteen.core.menu.controller.sys;

import com.bonus.canteen.core.menu.dto.SysMenuMaterialPageDto;
import com.bonus.canteen.core.menu.service.impl.sys.SysMenuMaterialServiceImpl;
import com.bonus.common.core.web.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping({"/api/v1/system/sysMenuMaterial"})
public class SysMenuMaterialController {
   private static final Logger log = LoggerFactory.getLogger(SysMenuMaterialController.class);
   @Autowired
   private SysMenuMaterialServiceImpl sysMenuMaterialService;
//   @Autowired
//   private SysMenuMaterialRegisterPicService sysMenuMaterialRegisterPicService;

   @PostMapping({"/queryByPage"})
   public AjaxResult queryByPage(@RequestBody @Valid SysMenuMaterialPageDto dto) {
      return AjaxResult.success(this.sysMenuMaterialService.queryByPage(dto));
   }

//   @PostMapping({"/save"})
//   public AjaxResult save(@RequestBody @Valid SysMenuMaterialAddDto dto) {
//      return AjaxResult.success(this.sysMenuMaterialService.save(dto));
//   }
//
//   @PostMapping({"/delete"})
//   public AjaxResult deleteById(@RequestBody Long content) {
//      return AjaxResult.success(this.sysMenuMaterialService.removeByMaterialId(content));
//   }
//
//   @PostMapping({"/upload"})
//   public AjaxResult upload(@RequestParam("file") MultipartFile[] multipartFile, @RequestParam("id") @Valid @NotNull Long id) {
//      Executors.doInSystem((s) -> {
//         this.sysMenuMaterialRegisterPicService.uploadTrainImage(multipartFile, id, (String)null);
//      });
//      return AjaxResult.success();
//   }
//
//   @PostMapping({"/getPic"})
//   public AjaxResult upload(@RequestBody Long content) {
//      List<SysMenuMaterialRegisterPic> sysMenuMaterialRegisterPics = this.sysMenuMaterialRegisterPicService.getByMaterialId(content);
//      return AjaxResult.success(BeanUtil.copyToList(sysMenuMaterialRegisterPics, MenuMaterialRegisterPicVo.class));
//   }
//
//   @PostMapping({"/removePic"})
//   public AjaxResult removePic(@RequestBody Long content) {
//      Executors.doInSystem((s) -> {
//         this.sysMenuMaterialRegisterPicService.removeById(content);
//      });
//      return AjaxResult.success();
//   }
}
