修改评论数不对的问题

This commit is contained in:
yangjun 2024-08-05 10:51:34 +08:00
parent 845fa141c2
commit a3ce8477f1
1 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/app/shipinquan")
@ -83,9 +84,18 @@ public class AppShipinquanController {
@PostMapping("/addContent")
@ApiOperation("添加评论内容")
public Result addContent(BlShipinquanPinglun BlShipinquanPinglun){
BlShipinquanPinglun.setCreateTime(new Date());
pinglunservice.save(BlShipinquanPinglun);
public Result addContent(BlShipinquanPinglun blShipinquanPinglun){
blShipinquanPinglun.setCreateTime(new Date());
pinglunservice.save(blShipinquanPinglun);
QueryWrapper<BlShipinquanPinglun> query = new QueryWrapper<BlShipinquanPinglun>();
query.eq("shipinquanId", blShipinquanPinglun.getShipinquanId());
List<BlShipinquanPinglun> list = pinglunservice.list(query);
BlShipinquan blShipinquan = service.getById(blShipinquanPinglun.getShipinquanId());
blShipinquan.setPls(list.size());
service.updateById(blShipinquan);
return Result.success();
}