puzhibing
2025-01-02 210828d1a6947596fe00ab30fcd8725c6714dde4
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java
@@ -1,6 +1,7 @@
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;
@@ -22,7 +23,11 @@
    @PostMapping("/addAppUserShop")
    public R<Void> add(@RequestBody AppUserShop 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();
    }
@@ -34,5 +39,22 @@
   }
   
    /**
     * 删除门店用户关系数据
     * @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();
    }
   
}