管理端模块-评价管理

This commit is contained in:
wuchunlei
2024-03-28 16:12:43 +08:00
parent 5104976112
commit 76fd1b11ef
3 changed files with 75 additions and 0 deletions

View File

@@ -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<String, Object> params) {
MPJLambdaWrapper<ShopProductRecord> 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<ShopProductRecord> 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();
}
}

View File

@@ -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<ShopProductRecord> {
}

View File

@@ -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<ShopProductRecordDao, ShopProductRecord> implements ShopProductRecordService {
}