95 lines
3.0 KiB
Java
95 lines
3.0 KiB
Java
package com.peanut.modules.book.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.peanut.common.utils.R;
|
|
import com.peanut.modules.book.entity.MyUserEntity;
|
|
import com.peanut.modules.book.entity.UserFeedbackEntity;
|
|
import com.peanut.modules.book.service.MyUserService;
|
|
import com.peanut.modules.book.service.UserFeedbackSerivce;
|
|
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.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 追加评论后游客评论无限制
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/user/feedback")
|
|
public class UserFeedbackController {
|
|
|
|
|
|
@Autowired
|
|
private UserFeedbackSerivce userFeedbackService;
|
|
@Autowired
|
|
private MyUserService myUserService;
|
|
|
|
/**
|
|
* 查看我的评价
|
|
*/
|
|
@RequestMapping("/Allevaluations")
|
|
public R Allevaluations(@RequestBody UserFeedbackEntity userFeedbackEntity){
|
|
List<UserFeedbackEntity> userid = userFeedbackService.getBaseMapper().selectList(new QueryWrapper<UserFeedbackEntity>().eq("userid", userFeedbackEntity.getUserId()
|
|
));
|
|
return R.ok().put("Allevaluations",userid);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 查看全部评价
|
|
*/
|
|
@RequestMapping("/All")
|
|
public R All(@RequestBody UserFeedbackEntity userFeedbackEntity){
|
|
HashMap<Object, Object> maps = new HashMap<>();
|
|
List list = new ArrayList<>();
|
|
List<UserFeedbackEntity> bookid = userFeedbackService.getBaseMapper().selectList(new QueryWrapper<UserFeedbackEntity>().eq("bookid", userFeedbackEntity.getBookid()));
|
|
for (UserFeedbackEntity userFe : bookid) {
|
|
HashMap<Object, Object> map = new HashMap<>();
|
|
Integer book = userFe.getBookid();
|
|
Integer use = userFe.getUserId();
|
|
List<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().eq("id", use));
|
|
String usser="";
|
|
String name = "";
|
|
for (MyUserEntity user : id) {
|
|
usser = user.getAvatar();
|
|
name =user.getNickname();
|
|
|
|
}
|
|
map.put("Avatar",usser);
|
|
map.put("name",name);
|
|
map.put("bookid",book);
|
|
map.put("orderSn",userFeedbackEntity.getOrdersn());
|
|
map.put("userid",use);
|
|
map.put("content",userFeedbackEntity.getContent());
|
|
map.put("create_date",userFeedbackEntity.getCreate_date());
|
|
map.put("rid",userFeedbackEntity.getRid());
|
|
map.put("fuid",userFeedbackEntity.getFuid());
|
|
list.add(map);
|
|
|
|
|
|
|
|
|
|
}
|
|
maps.put("list",list);
|
|
|
|
return R.ok().put("list",list);
|
|
|
|
}
|
|
|
|
/**
|
|
* 游客评价
|
|
*/
|
|
@RequestMapping("/userbacksave")
|
|
public R userbacksave(@RequestBody UserFeedbackEntity userFeedbackEntity ) {
|
|
|
|
|
|
return R.ok();
|
|
}
|
|
|
|
}
|