第五天

组内完成安全检测项目的增删改查和部分逻辑
分组查询之后是批量导出一开始是以这种形式的批量导出
遇到的问题网上大多只有element-ui的element-plus的很难找到大多笼统不全面跟着跑不出东西来
部分代码:
package com.example.springbootdemo.controller;

import com.example.springbootdemo.entity.SafetyRiskHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.springbootdemo.service.SafetyRiskHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Optional;

@RestController
@RequestMapping("/history")
@CrossOrigin
public class SafetyRiskHistoryController {

@Autowired
private SafetyRiskHistoryService service;

@GetMapping
public ResponseEntity<List<SafetyRiskHistory>> getAllSafetyRiskHistories() {
    List<SafetyRiskHistory> histories = service.getAllSafetyRiskHistories();
    return new ResponseEntity<>(histories, HttpStatus.OK);
}

@GetMapping("/{id}")
public ResponseEntity<SafetyRiskHistory> getSafetyRiskHistoryById(@PathVariable Integer id) {
    Optional<SafetyRiskHistory> history = service.getSafetyRiskHistoryById(id);
    return history.map(value -> new ResponseEntity<>(value, HttpStatus.OK))
            .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND));
}

}
package com.example.springbootdemo.entity;

import cn.hutool.core.annotation.Alias;
import jakarta.persistence.*;
import lombok.Data;

import java.util.Date;

@Entity
@Data // 自动生成getter/setter/tostring/hashcode/equals方法
@Table(name="safetyrisk")
public class safetyrisk {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Alias("编号")
private Integer id; // 编号
@Alias("风险编码")
private String risk_code; // 风险编码
@Alias("责任部门/分区")
private String department; // 责任部门/工区
@Alias("专业系统")
private String professional_system; // 专业系统
@Alias("风险类别")
private String risk_category; // 风险类别
@Alias("风险项目")
private String risk_item; // 风险项目
@Alias("风险项点")
private String risk_point; // 风险项点
@Alias("风险等级")
private String risk_level; // 风险等级
@Alias("危害程度")
private String harm_degree; // 危害程度
@Alias("管控措施")
private String control_measures; // 管控措施
@Alias("管控岗位")
private String control_position; // 管控岗位
@Alias("管控人员")
private String control_personnel; // 管控人员
@Alias("量化要求")
private String quantified_requirements; // 量化要求
@Alias("开始录入时间")
private Date entry_start_date; // 开始录入日期
@Alias("结束录入时间")
private Date entry_end_date; // 结束录入日期
@Alias("审核状态")
private String review_status; // 审核状态
@Alias("审核日期")
private Date review_date; // 审核日期
@Transient
private String operator;

public String getOperator() {
    return operator;
}

public void setOperator(String operator) {
    this.operator = operator;
}

public Integer getId() {
    return id;
}

public void setId(Integer id) {
    this.id = id;
}

public String getRisk_code() {
    return risk_code;
}

public void setRisk_code(String risk_code) {
    this.risk_code = risk_code;
}

public String getDepartment() {
    return department;
}

public void setDepartment(String department) {
    this.department = department;
}

public String getProfessional_system() {
    return professional_system;
}

public void setProfessional_system(String professional_system) {
    this.professional_system = professional_system;
}

public String getRisk_category() {
    return risk_category;
}

public void setRisk_category(String risk_category) {
    this.risk_category = risk_category;
}

public String getRisk_item() {
    return risk_item;
}

public void setRisk_item(String risk_item) {
    this.risk_item = risk_item;
}

public String getRisk_point() {
    return risk_point;
}

public void setRisk_point(String risk_point) {
    this.risk_point = risk_point;
}

public String getRisk_level() {
    return risk_level;
}

public void setRisk_level(String risk_level) {
    this.risk_level = risk_level;
}

public String getHarm_degree() {
    return harm_degree;
}

public void setHarm_degree(String harm_degree) {
    this.harm_degree = harm_degree;
}

public String getControl_measures() {
    return control_measures;
}

public void setControl_measures(String control_measures) {
    this.control_measures = control_measures;
}

public String getControl_position() {
    return control_position;
}

public void setControl_position(String control_position) {
    this.control_position = control_position;
}

public String getControl_personnel() {
    return control_personnel;
}

public void setControl_personnel(String control_personnel) {
    this.control_personnel = control_personnel;
}

public String getQuantified_requirements() {
    return quantified_requirements;
}

public void setQuantified_requirements(String quantified_requirements) {
    this.quantified_requirements = quantified_requirements;
}

public Date getEntry_start_date() {
    return entry_start_date;
}

public void setEntry_start_date(Date entry_start_date) {
    this.entry_start_date = entry_start_date;
}

public Date getEntry_end_date() {
    return entry_end_date;
}

public void setEntry_end_date(Date entry_end_date) {
    this.entry_end_date = entry_end_date;
}

public String getReview_status() {
    return review_status;
}

public void setReview_status(String review_status) {
    this.review_status = review_status;
}

public Date getReview_date() {
    return review_date;
}

public void setReview_date(Date review_date) {
    this.review_date = review_date;
}

}

posted @ 2025-04-22 22:45  深度检测  阅读(15)  评论(0)    收藏  举报