| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.service.TUserSiteService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-user-site") |
| | | public class TUserSiteController { |
| | | |
| | | @Resource |
| | | private TUserSiteService userSiteService; |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取可访问的站点数据 |
| | | * @param userId 用户id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(@RequestParam("userId") Long userId){ |
| | | List<TUserSite> list = userSiteService.list(new LambdaQueryWrapper<TUserSite>().eq(TUserSite::getUserId, userId)); |
| | | List<Integer> collect = list.stream().map(TUserSite::getSiteId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | |
| | | } |
| | | |