package com.ruoyi.mall.controller; import java.util.List; import java.util.Map; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.mall.domain.MallOrderComment; import com.ruoyi.mall.service.IMallOrderCommentService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 商品评论Controller * * @author chang * @date 2021-11-25 */ @RestController @RequestMapping("/mall/mallOrderComment") public class MallOrderCommentController extends BaseController { @Autowired private IMallOrderCommentService mallOrderCommentService; /** * 查询商品评论列表 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:list')") @GetMapping("/list") public TableDataInfo list(MallOrderComment mallOrderComment) { startPage(); List> list = mallOrderCommentService.selectMallOrderCommentList(mallOrderComment); return getDataTable(list); } /** * 导出商品评论列表 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:export')") @Log(title = "商品评论", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(MallOrderComment mallOrderComment) { List> list = mallOrderCommentService.selectMallOrderCommentList(mallOrderComment); ExcelUtil util = new ExcelUtil(MallOrderComment.class); return util.exportExcel(null, "商品评论数据"); } /** * 获取商品评论详细信息 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(mallOrderCommentService.selectMallOrderCommentById(id)); } /** * 新增商品评论 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:add')") @Log(title = "商品评论", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MallOrderComment mallOrderComment) { return toAjax(mallOrderCommentService.insertMallOrderComment(mallOrderComment)); } /** * 修改商品评论 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:edit')") @Log(title = "商品评论", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MallOrderComment mallOrderComment) { return toAjax(mallOrderCommentService.updateMallOrderComment(mallOrderComment)); } /** * 删除商品评论 */ @PreAuthorize("@ss.hasPermi('mall:mallOrderComment:remove')") @Log(title = "商品评论", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(mallOrderCommentService.deleteMallOrderCommentByIds(ids)); } }