package com.ruoyi.promotion.controller.management;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.utils.page.PageDTO;
|
import com.ruoyi.promotion.controller.management.dto.MgtPromotionWishQuery;
|
import com.ruoyi.promotion.controller.management.dto.MgtPromotionWishRecommendDTO;
|
import com.ruoyi.promotion.controller.management.vo.MgtPromotionWishVO;
|
import com.ruoyi.promotion.service.IPromotionWishService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import javax.validation.Valid;
|
import javax.validation.constraints.NotNull;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
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;
|
|
/**
|
* <p>
|
* 心愿求购 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-10-29
|
*/
|
@Validated
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = {"【09.25】管理后台心愿求购管理相关接口"})
|
@RequestMapping("/mgt/promotion-wish")
|
public class MgtPromotionWishController {
|
|
private final IPromotionWishService promotionWishService;
|
|
/**
|
* 获取心愿求购列表
|
*
|
* @param query
|
* @return
|
*/
|
@PostMapping("/page")
|
@ApiOperation(value = "获取心愿求购列表")
|
public R<PageDTO<MgtPromotionWishVO>> queryPage(
|
@Valid @RequestBody MgtPromotionWishQuery query) {
|
return R.ok(promotionWishService.queryPage(query));
|
}
|
|
/**
|
* 查看详情
|
*
|
* @param id
|
* @return
|
*/
|
@GetMapping("/{id}")
|
@ApiOperation(value = "查看详情")
|
public R<MgtPromotionWishVO> getDetails(
|
@ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
|
return R.ok(promotionWishService.getDetails(id));
|
}
|
|
/**
|
* 删除
|
* @param id
|
* @return
|
*/
|
@DeleteMapping("/{id}")
|
@ApiOperation(value = "删除心愿求购")
|
public R<?> deleteById(
|
@ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
|
promotionWishService.deleteById(id);
|
return R.ok();
|
}
|
|
/**
|
* 推荐商品
|
* @param dto
|
* @return
|
*/
|
@PostMapping("/recommend")
|
@ApiOperation(value = "推荐商品")
|
public R<?> recommend(@Valid @RequestBody MgtPromotionWishRecommendDTO dto) {
|
promotionWishService.recommend(dto);
|
return R.ok();
|
}
|
|
/**
|
* 删除推荐商品
|
* @param id
|
* @return
|
*/
|
@DeleteMapping("/recommend/{id}")
|
@ApiOperation(value = "删除推荐商品")
|
public R<?> deleteRecommend(
|
@ApiParam(name = "id", value = "推荐商品id", required = true) @NotNull(message = "推荐商品id不能为空") @PathVariable("id") Long id) {
|
promotionWishService.deleteRecommend(id);
|
return R.ok();
|
}
|
}
|