打印机接口修改

This commit is contained in:
张松
2025-03-07 17:08:54 +08:00
parent d148aafb48
commit 11d6916935
2 changed files with 15 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterDelDTO;
import com.czg.account.dto.print.PrinterEditDTO;
@@ -50,7 +51,13 @@ public class PrintMachineController {
queryWrapper.eq(PrintMachine::getSubType, subType);
}
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
return CzgResult.success(printMachineService.page(PageUtil.buildPage(), queryWrapper));
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
page.getRecords().forEach(item -> {
if (StrUtil.isNotBlank(item.getCategoryIds())) {
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
}
});
return CzgResult.success(page);
}
/**
@@ -61,7 +68,11 @@ public class PrintMachineController {
@SaAdminCheckPermission(value = "printer:detail", name = "打印机详情获取")
@GetMapping("/detail")
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
return CzgResult.success(printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId())));
PrintMachine printMachine = printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId()));
if (printMachine != null && StrUtil.isNotBlank(printMachine.getCategoryIds())) {
printMachine.setCategoryList(JSONArray.parse(printMachine.getCategoryIds()));
}
return CzgResult.success(printMachine);
}