关于评价功能,每评价一条就会for循环很多条相同的数据

相关代码:
<van-action-sheet v-model:show="state.dialogVisible" :title="book.bookName">
<van-form ref="evaluationForm">
<van-cell-group inset>
<van-rate v-model="form.score" color="#ffd21e" void-icon="star" style="padding: 16px" ></van-rate>
<van-field
v-model="form.content"
name="content"
placeholder="这里输入评论内容"
autocomplete = "off"
:rules="[{ required: true, message: '请输入评论内容' }]"
/>
</van-cell-group>
<div style="margin: 16px;margin-bottom: 50px">
<van-button round block type="primary" @click="onSubmit('evaluationForm')">
提交短评
</van-button>
</div>
</van-form>
</van-action-sheet>相关代码:
@PostMapping("/evaluate")
public ResponseUtils evaluate(Long memberId,Long bookId,Integer score,String content){
ResponseUtils resp = null;
try {
Evaluation evaluation = evaluationService.evaluate(memberId, bookId, score, content);
resp = new ResponseUtils().put("evaluation",evaluation);
}catch (Exception e){
e.printStackTrace();
resp = new ResponseUtils(e.getClass().getSimpleName(),e.getMessage());
}
return resp;
}相关代码:
实现类
@Override
public Evaluation evaluate(Long memberId, Long bookId, Integer score, String content) {
Evaluation evaluation = new Evaluation();
evaluation.setMemberId(memberId);
evaluation.setBookId(bookId);
evaluation.setScore(score);
evaluation.setContent(content);
evaluation.setCreateTime(new Date());
evaluation.setState("enable");
evaluation.setEnjoy(0);
evaluationMapper.insert(evaluation);
return evaluation;
}26
收起
正在回答
1回答
同学你好,1、测试同学代码是没有问题的,建议同学查看数据库中短评信息,查看是否是数据库中的问题。
2、也有可能是同学查询的问题,同学也可以将代码反馈到问答区。如下所示:将对应的代码反馈到对应的代码格式中。

祝学习愉快!
2023版Java工程师
- 参与学习 人
- 提交作业 8788 份
- 解答问题 9886 个
综合就业常年第一,编程排行常年霸榜,北上广深月薪过万! 不需要基础,无需脱产即可学习,只要你有梦想,想高薪! 全新升级:技术栈升级(包含VUE3.0,ES6,Git)+项目升级(前后端联调与功能升级)
了解课程

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星