|
|
@ -0,0 +1,42 @@ |
|
|
|
|
|
package com.gaotao.modules.sys.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.gaotao.common.utils.R; |
|
|
|
|
|
import com.gaotao.modules.sys.entity.FavoriteFunctions; |
|
|
|
|
|
import com.gaotao.modules.sys.entity.SysMenuEntity; |
|
|
|
|
|
import com.gaotao.modules.sys.service.FavoriteFunctionsService; |
|
|
|
|
|
import oracle.jdbc.proxy.annotation.Post; |
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
|
|
@RequestMapping("userFavorite") |
|
|
|
|
|
public class UserFavoriteMenuController { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private FavoriteFunctionsService favoriteFunctionsService; |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("userFavoriteList/{userId}/{languageCode}") |
|
|
|
|
|
public R userMenuFavoriteList(@PathVariable("userId")Long userId,@PathVariable("languageCode")String languageCode){ |
|
|
|
|
|
List<SysMenuEntity> sysMenuEntities = favoriteFunctionsService.userMenuFavoriteList(userId, languageCode); |
|
|
|
|
|
return R.ok().put("list",sysMenuEntities); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("save") |
|
|
|
|
|
public R saveUserMenuFavorite(@RequestBody FavoriteFunctions favoriteFunctions){ |
|
|
|
|
|
|
|
|
|
|
|
favoriteFunctionsService.save(favoriteFunctions); |
|
|
|
|
|
return R.ok("收藏成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("remove") |
|
|
|
|
|
public R removeUserMenuFavorite(@RequestBody FavoriteFunctions favoriteFunctions){ |
|
|
|
|
|
QueryWrapper<FavoriteFunctions> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
queryWrapper.eq("user_id",favoriteFunctions.getUserId()) |
|
|
|
|
|
.eq("function_id",favoriteFunctions.getFunctionId()); |
|
|
|
|
|
favoriteFunctionsService.remove(queryWrapper); |
|
|
|
|
|
return R.ok("取消收藏"); |
|
|
|
|
|
} |
|
|
|
|
|
} |