You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.9 KiB
110 lines
2.9 KiB
package com.softegg.freetogo.Evaluate.service;
|
|
|
|
import com.softegg.freetogo.Evaluate.Dao.EvaluateRepository;
|
|
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
|
|
/**
|
|
* @description:
|
|
* @author:zhanglinhao
|
|
* @date:2024/5/10 9:25
|
|
*/
|
|
@Component
|
|
public class EvaluateServiceImpl implements EvaluateService {
|
|
|
|
@Autowired
|
|
EvaluateRepository evaluateRepository;
|
|
|
|
/**
|
|
* @description: 获取所有评论
|
|
* @param: null
|
|
* @return: void
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/10 9:25
|
|
*/
|
|
@Override
|
|
public List<Evaluations> evaluationList() {
|
|
System.out.println("查询评论");
|
|
return evaluateRepository.findAll();
|
|
}
|
|
/**
|
|
* @description: 根据电话筛选评价
|
|
* @param: phone
|
|
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/11 16:28
|
|
*/
|
|
@Override
|
|
public List<Evaluations> getEListByPhone(String phone) {
|
|
System.out.println("查询"+phone+"的评论");
|
|
return evaluateRepository.findByEditorPhone(phone);
|
|
}
|
|
|
|
/**
|
|
* @description: 根据电话筛选评价
|
|
* @param: phone
|
|
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/11 16:28
|
|
*/
|
|
@Override
|
|
public List<Evaluations> getEListByPhone(String phone) {
|
|
System.out.println("查询" + phone + "的评论");
|
|
return evaluateRepository.findByEditorPhone(phone);
|
|
}
|
|
|
|
/**
|
|
* @description: 添加评论
|
|
* @param: evaluation
|
|
* @return: void
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/10 21:20
|
|
*/
|
|
@Override
|
|
public void addEvaluation(Evaluations evaluation) {
|
|
evaluateRepository.save(evaluation);
|
|
System.out.println("添加评论" + evaluation.getEbody());
|
|
}
|
|
|
|
<<<<<<< HEAD
|
|
=======
|
|
/**
|
|
* @description: 编辑评论
|
|
* @param: eid
|
|
* @return: void
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/11 17:10
|
|
*/
|
|
@Override
|
|
public void editEvaluation(int eid, String ebody) {
|
|
System.out.println("编辑评论:" + eid);
|
|
Optional<Evaluations> opt = evaluateRepository.findById(eid);
|
|
if (opt.isPresent()) {
|
|
Evaluations evaluation = opt.get();
|
|
evaluation.setEbody(ebody);
|
|
evaluateRepository.save(evaluation);
|
|
System.out.println("编辑成功:" + eid);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 删除评论
|
|
* @param: eid
|
|
* @return: void
|
|
* @author: zhanglinhao
|
|
* @date: 2024/5/11 17:28
|
|
*/
|
|
@Override
|
|
public void deleteEvaluation(int eid) {
|
|
evaluateRepository.deleteById(eid);
|
|
System.out.println("删除评论:" + eid);
|
|
}
|
|
|
|
>>>>>>> zhanglinhao_branch
|
|
|
|
}
|