|
|
|
@ -4,6 +4,7 @@ package com.foreverwin.mesnac.common.controller;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.model.Printer;
|
|
|
|
|
import com.foreverwin.modular.core.exception.BusinessException;
|
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
|
import com.foreverwin.modular.core.util.R;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
@ -66,7 +67,7 @@ public class PrinterController {
|
|
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@PostMapping("/savePrinter")
|
|
|
|
|
public R savePrinter(Printer printer) {
|
|
|
|
|
public R savePrinter(@RequestBody Printer printer) {
|
|
|
|
|
try {
|
|
|
|
|
LocalDateTime nowDate = LocalDateTime.now();
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
@ -90,4 +91,22 @@ public class PrinterController {
|
|
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@PostMapping("/delPrinter")
|
|
|
|
|
public R delPrinter(Printer printer) {
|
|
|
|
|
try {
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
|
|
|
|
|
String handle = HandleEnum.PRINT.getHandle(site, printer.getPrinter());
|
|
|
|
|
Printer printerModel = printerService.getById(handle);
|
|
|
|
|
if (printerModel == null) {
|
|
|
|
|
throw BusinessException.build("请先检索再删除!");
|
|
|
|
|
} else {
|
|
|
|
|
printerService.removeById(printerModel);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return R.failed(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
}
|