package com.ruoyi.system.controller; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.system.api.model.UserShop; import com.ruoyi.system.service.UserShopService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * @author zhibing.pu * @date 2025/1/2 18:04 */ @RestController @RequestMapping("/userShop") public class UserShopController { @Resource private UserShopService userShopService; /** * 获取用户门店关系数据 * @param userShop * @return */ @PostMapping("/getUserShop") public R> getUserShop(@RequestBody UserShop userShop){ LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); if(null != userShop.getUserId()){ wrapper.eq(UserShop::getUserId, userShop.getUserId()); } if(null != userShop.getShopId()){ wrapper.eq(UserShop::getShopId, userShop.getShopId()); } if(null != userShop.getRoleType()){ wrapper.eq(UserShop::getRoleType, userShop.getRoleType()); } List list = userShopService.list(wrapper); return R.ok(list); } /** * 保存数据 * @param userShop * @return */ @PostMapping("/saveUserShop") public R saveUserShop(@RequestBody UserShop userShop){ userShopService.save(userShop); return R.ok(); } }