| | |
| | | package com.ruoyi.shop.service.impl.shop; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopRelUser; |
| | | import com.ruoyi.shop.mapper.shop.ShopRelUserMapper; |
| | |
| | | */ |
| | | @Override |
| | | public void deleteByShopId(Long shopId){ |
| | | LambdaQueryWrapper<ShopRelUser> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(ShopRelUser::getDelFlag, 0).eq(ShopRelUser::getShopId, shopId); |
| | | List<ShopRelUser> shopRelUserList = this.list(queryWrapper); |
| | | if(shopRelUserList!=null&&!shopRelUserList.isEmpty()){ |
| | | Long userId; |
| | | for(ShopRelUser shopRelUser : shopRelUserList){ |
| | | userId = shopRelUser.getUserId(); |
| | | |
| | | } |
| | | } |
| | | shopRelUserMapper.deleteByShopId(shopId); |
| | | } |
| | | |
| | |
| | | queryWrapper.eq(ShopRelUser::getDelFlag, 0).eq(ShopRelUser::getUserId, userId); |
| | | return this.getOne(queryWrapper,false); |
| | | } |
| | | |
| | | /** |
| | | * 通过用户id删除关联 |
| | | * @param userId |
| | | */ |
| | | @Override |
| | | public void deleteByUserId(Long userId){ |
| | | LambdaUpdateWrapper<ShopRelUser> updateWrapper = new LambdaUpdateWrapper(); |
| | | updateWrapper.set(ShopRelUser::getDelFlag,1); |
| | | updateWrapper.eq(ShopRelUser::getUserId,userId); |
| | | updateWrapper.eq(ShopRelUser::getDelFlag,0); |
| | | this.update(updateWrapper); |
| | | } |
| | | } |