Board logo

标题: Spring Boot使用JPA多条件查询mysql(2) [打印本页]

作者: look_w    时间: 2019-5-16 19:50     标题: Spring Boot使用JPA多条件查询mysql(2)

其中支持的方法非常之强大,下面给出一个示例,大家可以参考一下,同样的,可以根据示例,自己可以写出更为复杂的查询:

新建实体
我们需要操作的实体字段如下:

package com.biologic.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name= "t_quality_inspection")
public class QualityCheck {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String version;
    private Date upload_time;
    private int qualified;
    private int released;
    private int processed;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
    public Date getUpload_time() {
        return upload_time;
    }
    public void setUpload_time(Date upload_time) {
        this.upload_time = upload_time;
    }
    public int getQualified() {
        return qualified;
    }
    public void setQualified(int qualified) {
        this.qualified = qualified;
    }
    public int getReleased() {
        return released;
    }
    public void setReleased(int released) {
        this.released = released;
    }
    public int getProcessed() {
        return processed;
    }
    public void setProcessed(int processed) {
        this.processed = processed;
    }

}




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0