批量青苔设置

This commit is contained in:
张松 2025-11-11 09:26:24 +08:00
parent 056e0cfa83
commit 9dd929c00c
3 changed files with 58 additions and 4 deletions

View File

@ -1,10 +1,7 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.table.ShopTableAddDTO;
import com.czg.account.dto.table.ShopTableBindDTO;
import com.czg.account.dto.table.ShopTableClearDTO;
import com.czg.account.dto.table.ShopTableDTO;
import com.czg.account.dto.table.*;
import com.czg.account.entity.ShopTable;
import com.czg.account.service.ShopTableService;
import com.czg.account.vo.ShopTableVO;
@ -15,6 +12,7 @@ import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -93,6 +91,24 @@ public class ShopTableController {
return CzgResult.success(shopTableService.updateInfo(StpKit.USER.getLoginIdAsLong(), shopTableDTO));
}
/**
* 批量台桌配置
* 权限标识: shopTable:edit
* @return 是否成功
*/
@PutMapping
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.getAutoClear() != null) {
query.eq(ShopTable::getAutoClear, shopTableDTO.getAutoClear());
}
return CzgResult.success(query.update());
}
/**
* 台桌清台
* 权限标识: shopTable:clear

View File

@ -0,0 +1,36 @@
package com.czg.account.dto.table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 台桌配置 实体类
*
* @author zs
* @since 2025-02-13
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopTableEditBatchDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自动清台 0手动 1自动
*/
private Integer autoClear;
/**
* 自动清台时间 单位分钟 默认10
*/
private Integer clearTime;
}

View File

@ -126,6 +126,8 @@ public class ShopTable implements Serializable {
*/
private Integer useNum;
private Integer autoClear;
public boolean canUseByStatus() {
return !ShopTableStatusEnum.UNBOUND.equalsVal(status)
&& !ShopTableStatusEnum.SETTLED.equalsVal(status)