Merge branch 'refs/heads/分账重构'
This commit is contained in:
@ -76,14 +76,12 @@ public class AppDiningPlatesController {
|
||||
@GetMapping("/checkBindAndUnBind")
|
||||
@Operation(summary = "餐盘解绑")
|
||||
public CommonResult<String> checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||
Boolean b = diningPlatesService.checkBindAndUnBind(diningPlatesNum, storeId);
|
||||
String b = diningPlatesService.checkBindAndUnBind(diningPlatesNum, storeId);
|
||||
CommonResult<String> result = new CommonResult<>();
|
||||
result.setCode(200);
|
||||
if (b) {
|
||||
result.setData(b);
|
||||
if ("bind".equals(b)) {
|
||||
result.setMsg("餐盘已解绑");
|
||||
result.setData("bind");
|
||||
}else {
|
||||
result.setData("unbind");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -104,5 +104,5 @@ public interface DiningPlatesService {
|
||||
*/
|
||||
List<String> getBindDiningPlatesList();
|
||||
|
||||
Boolean checkBindAndUnBind(String diningPlatesNum,Long storeId);
|
||||
String checkBindAndUnBind(String diningPlatesNum,Long storeId);
|
||||
}
|
@ -444,15 +444,17 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||
public String checkBindAndUnBind(String diningPlatesNum,Long storeId) {
|
||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||
.eq(DiningPlatesDO::getStoreId, storeId));
|
||||
if(diningPlatesDO == null || diningPlatesDO.getUserId() == null){
|
||||
return false;
|
||||
if(diningPlatesDO == null ) {
|
||||
return "absent";
|
||||
}else if (diningPlatesDO.getUserId() == null){
|
||||
return "unbind";
|
||||
}else {
|
||||
unbind(diningPlatesNum,storeId);
|
||||
return true;
|
||||
return "bind";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user