获取清台配置信息

This commit is contained in:
张松
2025-11-11 10:27:44 +08:00
parent a9336ac17f
commit fd306f34dc
3 changed files with 26 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
/**
* 台桌管理
@@ -99,8 +101,8 @@ public class ShopTableController {
@PutMapping("/batch")
public CzgResult<Boolean> editBatch(@RequestBody @Validated ShopTableEditBatchDTO shopTableDTO) {
UpdateChain<ShopTable> query = shopTableService.updateChain().eq(ShopTable::getShopId, StpKit.USER.getShopId());
if (shopTableDTO.getClearTime() != null) {
query.eq(ShopTable::getClearTime, shopTableDTO.getClearTime());
if (shopTableDTO.getAutoClearTime() != null) {
query.eq(ShopTable::getAutoClearTime, shopTableDTO.getAutoClearTime());
}
if (shopTableDTO.getAutoClear() != null) {
@@ -109,6 +111,26 @@ public class ShopTableController {
return CzgResult.success(query.update());
}
/**
* 获取清台配置信息
* 权限标识: shopTable:edit
* @return 是否成功
*/
@GetMapping("/currentState")
public CzgResult<Map<String, Serializable>> currentState() {
ShopTable one = shopTableService.queryChain().eq(ShopTable::getShopId, StpKit.USER.getShopId()).limit(1).one();
if (one == null) {
one = new ShopTable();
one.setAutoClear(0);
one.setAutoClearTime(0);
}
return CzgResult.success(Map.of(
"autoClear", one.getAutoClear(),
"autoClearTime", one.getAutoClearTime()
));
}
/**
* 台桌清台
* 权限标识: shopTable:clear