| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | import com.ruoyi.account.service.AppUserShopService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | |
| | | @PostMapping("/addAppUserShop") |
| | | public R<Void> add(@RequestBody AppUserShop appUserShop) { |
| | | appUserShopService.save(appUserShop); |
| | | long count = appUserShopService.count(new LambdaQueryWrapper<AppUserShop>() |
| | | .eq(AppUserShop::getAppUserId, appUserShop.getAppUserId()).eq(AppUserShop::getShopId, appUserShop.getShopId())); |
| | | if(0 == count){ |
| | | appUserShopService.save(appUserShop); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return R.ok(appUserShopService.list(new LambdaQueryWrapper<AppUserShop>() |
| | | .eq(AppUserShop::getAppUserId,userId))); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除门店用户关系数据 |
| | | * @param appUserShop |
| | | * @return |
| | | */ |
| | | @PostMapping("/delAppUserShop") |
| | | public R delAppUserShop(@RequestBody AppUserShop appUserShop){ |
| | | LambdaUpdateWrapper<AppUserShop> wrapper = new LambdaUpdateWrapper<>(); |
| | | if(null != appUserShop.getAppUserId()){ |
| | | wrapper.eq(AppUserShop::getAppUserId, appUserShop.getAppUserId()); |
| | | } |
| | | if(null != appUserShop.getShopId()){ |
| | | wrapper.eq(AppUserShop::getShopId, appUserShop.getShopId()); |
| | | } |
| | | appUserShopService.remove(wrapper); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |