修改评论数不对的问题
This commit is contained in:
parent
845fa141c2
commit
a3ce8477f1
|
@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/shipinquan")
|
@RequestMapping("/app/shipinquan")
|
||||||
|
@ -83,9 +84,18 @@ public class AppShipinquanController {
|
||||||
|
|
||||||
@PostMapping("/addContent")
|
@PostMapping("/addContent")
|
||||||
@ApiOperation("添加评论内容")
|
@ApiOperation("添加评论内容")
|
||||||
public Result addContent(BlShipinquanPinglun BlShipinquanPinglun){
|
public Result addContent(BlShipinquanPinglun blShipinquanPinglun){
|
||||||
BlShipinquanPinglun.setCreateTime(new Date());
|
blShipinquanPinglun.setCreateTime(new Date());
|
||||||
pinglunservice.save(BlShipinquanPinglun);
|
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();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue