| | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.dao.business.model.Collect; |
| | | import com.doumee.dao.web.request.CollectSaveRequest; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @Api(tags = "用户收藏信息表") |
| | | @RestController |
| | | @RequestMapping("/web/collect") |
| | | @LoginRequired |
| | | public class CollectApi extends ApiController{ |
| | | |
| | | @LoginRequired |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | public ApiResponse create(@RequestBody Collect collect) { |
| | | return ApiResponse.success(collectService.create(collect,getMemberId())); |
| | | @ApiOperation("创建收藏") |
| | | @PostMapping("/saveCollect") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), |
| | | }) |
| | | public ApiResponse saveCollect(@RequestBody CollectSaveRequest request) { |
| | | collectService.saveCollect(request,getMemberId()); |
| | | return ApiResponse.success("操作成功"); |
| | | } |
| | | |
| | | |
| | | @LoginRequired |
| | | @ApiOperation("取消收藏") |
| | | @GetMapping("/cancel/batch") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), |
| | | }) |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | collectService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @LoginRequired |
| | | @ApiOperation("我的收藏") |
| | | @GetMapping("/myCollectList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), |
| | | }) |
| | | public ApiResponse myCollectList(@RequestParam Integer type) { |
| | | return ApiResponse.success(collectService.myCollect(getMemberId(),type)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |