用户下单同步修改台桌状态
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.mpservice;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||
|
||||
public interface MpShopTableService extends IService<TbShopTable> {
|
||||
/**
|
||||
* 根据台桌id修改台桌状态
|
||||
* @param tableId qrcode
|
||||
* @param state 状态
|
||||
*/
|
||||
boolean updateStateByQrcode(String tableId, TableConstant.ShopTable.State state);
|
||||
|
||||
/**
|
||||
* 根据qrcode获取台桌
|
||||
* @param tableId qrcode
|
||||
*/
|
||||
TbShopTable selectByQrcode(String tableId);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.mpservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mpservice.MpShopTableService;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Primary
|
||||
public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbShopTable> implements MpShopTableService {
|
||||
@Override
|
||||
public boolean updateStateByQrcode(String tableId, TableConstant.ShopTable.State state) {
|
||||
return update(new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, tableId)
|
||||
.set(TbShopTable::getStatus, state.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbShopTable selectByQrcode(String tableId) {
|
||||
return getOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, tableId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user