diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbPrintPCMachineService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbPrintPCMachineService.java index f451227..6c2ebb9 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbPrintPCMachineService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbPrintPCMachineService.java @@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.util.JSONUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -59,6 +60,7 @@ public class TbPrintPCMachineService { */ public Result queryByPage(TbPrintPCMachine tbPrintMachine) { PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize()); + tbPrintMachine.setContentType("local"); List tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine); PageInfo pageInfo=new PageInfo(tbPrintMachines); return Result.success(CodeEnum.SUCCESS,pageInfo); @@ -73,7 +75,11 @@ public class TbPrintPCMachineService { public Result insert(PrintMachineDto resources) { TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine(); tbPrintMachine.setCreatedAt(Instant.now().toEpochMilli()); + tbPrintMachine.setContentType("local"); if (resources.getConfig() != null){ + if(CollectionUtils.isEmpty(resources.getConfig().getCategoryList())){ + resources.getConfig().setCategoryList(null); + } tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(),true)); } BeanUtils.copyProperties(resources,tbPrintMachine);