From 76fd1b11ef14a1c088fa9037ea2710d274c1a07d Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Thu, 28 Mar 2024 16:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E6=A8=A1=E5=9D=97-?= =?UTF-8?q?=E8=AF=84=E4=BB=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShopProductRecordController.java | 54 +++++++++++++++++++ .../service/ShopProductRecordService.java | 7 +++ .../impl/ShopProductRecordServiceImpl.java | 14 +++++ 3 files changed, 75 insertions(+) create mode 100644 src/main/java/com/peanut/modules/master/controller/ShopProductRecordController.java create mode 100644 src/main/java/com/peanut/modules/master/service/ShopProductRecordService.java create mode 100644 src/main/java/com/peanut/modules/master/service/impl/ShopProductRecordServiceImpl.java diff --git a/src/main/java/com/peanut/modules/master/controller/ShopProductRecordController.java b/src/main/java/com/peanut/modules/master/controller/ShopProductRecordController.java new file mode 100644 index 00000000..adee83b5 --- /dev/null +++ b/src/main/java/com/peanut/modules/master/controller/ShopProductRecordController.java @@ -0,0 +1,54 @@ +package com.peanut.modules.master.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.peanut.common.utils.R; +import com.peanut.modules.common.entity.ShopProductRecord; +import com.peanut.modules.master.service.ShopProductRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 商品评价管理 + */ +@Slf4j +@RestController("masterShopProductRecord") +@RequestMapping("master/shopProductRecord") +public class ShopProductRecordController { + + @Autowired + private ShopProductRecordService recordService; + + @RequestMapping("/listByPage") + public R listByPage(@RequestBody Map params) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); + if (params.containsKey("productId")&&StringUtils.isNotEmpty(params.get("productId").toString())) { + wrapper.eq(ShopProductRecord::getProductId,params.get("productId")); + } + if (params.containsKey("content")&&StringUtils.isNotEmpty(params.get("content").toString())) { + wrapper.like(ShopProductRecord::getContent,params.get("content")); + } + if (params.containsKey("reContent")&&StringUtils.isNotEmpty(params.get("reContent").toString())) { + wrapper.like(ShopProductRecord::getReContent,params.get("reContent")); + } + wrapper.orderByDesc(ShopProductRecord::getRecordTime); + Page records = recordService.page(new Page<>( + Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper); + return R.ok().put("result", records); + } + + @RequestMapping("/delRecord") + public R delRecord(String id) { + recordService.removeById(id); + return R.ok(); + } + +} diff --git a/src/main/java/com/peanut/modules/master/service/ShopProductRecordService.java b/src/main/java/com/peanut/modules/master/service/ShopProductRecordService.java new file mode 100644 index 00000000..7768c05e --- /dev/null +++ b/src/main/java/com/peanut/modules/master/service/ShopProductRecordService.java @@ -0,0 +1,7 @@ +package com.peanut.modules.master.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.peanut.modules.common.entity.ShopProductRecord; + +public interface ShopProductRecordService extends IService { +} diff --git a/src/main/java/com/peanut/modules/master/service/impl/ShopProductRecordServiceImpl.java b/src/main/java/com/peanut/modules/master/service/impl/ShopProductRecordServiceImpl.java new file mode 100644 index 00000000..c6746b2a --- /dev/null +++ b/src/main/java/com/peanut/modules/master/service/impl/ShopProductRecordServiceImpl.java @@ -0,0 +1,14 @@ +package com.peanut.modules.master.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.peanut.modules.common.dao.ShopProductRecordDao; +import com.peanut.modules.common.entity.ShopProductRecord; +import com.peanut.modules.master.service.ShopProductRecordService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service("masterShopProductRecordService") +public class ShopProductRecordServiceImpl extends ServiceImpl implements ShopProductRecordService { +} +