parent
7f854cff83
commit
2e1475fb0a
@ -0,0 +1,12 @@
|
|||||||
|
package com.softegg.freetogo.Evaluate.Dao;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 继承Jpa数据库接口类
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/10 9:27
|
||||||
|
*/
|
||||||
|
public interface EvaluateRepository extends JpaRepository<Evaluations, Integer> {
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.softegg.freetogo.Evaluate.bean;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author:zhanglinhao
|
||||||
|
* @date:2024/5/10 9:07
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "evaluation")
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Evaluations {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private int eid;
|
||||||
|
@Column(name = "etorname")
|
||||||
|
private String editorName;
|
||||||
|
@Column(name = "etorphone")
|
||||||
|
private String editorPhone;
|
||||||
|
@Column(name = "etedname")
|
||||||
|
private String editedName;
|
||||||
|
@Column(name = "etedphone")
|
||||||
|
private String editedPhone;
|
||||||
|
@Column(name = "createtime")
|
||||||
|
private String ct;
|
||||||
|
@Column(name = "modifytime")
|
||||||
|
private String mt;
|
||||||
|
@Column
|
||||||
|
private String ebody;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.softegg.freetogo.Evaluate.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author:zhanglinhao
|
||||||
|
* @date:2024/5/10 8:52
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public interface evaluateService {
|
||||||
|
List<Evaluations> evaluationList();//获取所有评论
|
||||||
|
void addEvaluation(Evaluations evaluation);//添加评论
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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: 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());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue