diff --git a/pom.xml b/pom.xml index 95cf34b5..2f1fbc27 100644 --- a/pom.xml +++ b/pom.xml @@ -48,6 +48,11 @@ org.springframework.boot spring-boot-starter-web + + + org.hibernate.orm + hibernate-core + org.springframework.boot @@ -65,6 +70,13 @@ lombok true + + + + + jakarta.persistence + jakarta.persistence-api + org.springframework.data spring-data-jpa @@ -110,6 +122,13 @@ + + + + org.postgresql + postgresql + + org.apache.commons diff --git a/src/main/java/cn/lihongjie/coal/dao/BaseDao.java b/src/main/java/cn/lihongjie/coal/dao/BaseDao.java new file mode 100644 index 00000000..881cea46 --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/dao/BaseDao.java @@ -0,0 +1,8 @@ +package cn.lihongjie.coal.dao; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.ListPagingAndSortingRepository; + +public interface BaseDao extends JpaRepository { +} diff --git a/src/main/java/cn/lihongjie/coal/dao/CoalWashingDailyAnalysisDao.java b/src/main/java/cn/lihongjie/coal/dao/CoalWashingDailyAnalysisDao.java new file mode 100644 index 00000000..a0fa0c22 --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/dao/CoalWashingDailyAnalysisDao.java @@ -0,0 +1,6 @@ +package cn.lihongjie.coal.dao; + +import cn.lihongjie.coal.entity.CoalWashingDailyAnalysis; + +public interface CoalWashingDailyAnalysisDao extends BaseDao{ +} diff --git a/src/main/java/cn/lihongjie/coal/dto/CommonQuery.java b/src/main/java/cn/lihongjie/coal/dto/CommonQuery.java new file mode 100644 index 00000000..6727f30a --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/dto/CommonQuery.java @@ -0,0 +1,55 @@ +package cn.lihongjie.coal.dto; + +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Root; +import lombok.Data; +import org.springframework.data.jpa.domain.Specification; + +import java.util.List; + +@Data +public class CommonQuery { + + private List items; + + private Integer pageNo; + + private Integer pageSize; + + @Data + public static class QueryItem { + private String key; + private String opt; + private String value; + private String group = "default"; + + } + + + + + public Specification specification(){ + + return new Specification() { + @Override + public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder criteriaBuilder) { + + return criteriaBuilder.or(); + + + } + + }; + + + } + + + + + + + +} diff --git a/src/main/java/cn/lihongjie/coal/entity/BaseEntity.java b/src/main/java/cn/lihongjie/coal/entity/BaseEntity.java new file mode 100644 index 00000000..dc55cacc --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/entity/BaseEntity.java @@ -0,0 +1,52 @@ +package cn.lihongjie.coal.entity; + + +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.Formula; +import org.hibernate.annotations.SourceType; +import org.hibernate.annotations.UpdateTimestamp; +import org.springframework.data.annotation.CreatedDate; + +import java.time.LocalDateTime; + +@MappedSuperclass +@Getter +@Setter +public class BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.UUID) + private String id; + + + + private String createUserId; + + + @Formula("(select '')") + private String createUserName; + + + @CreationTimestamp(source = SourceType.VM) + private LocalDateTime createTime; + + + + + private String updateUserId; + @Formula("(select '')") + private String updateUserName; + + + @UpdateTimestamp(source = SourceType.VM) + private LocalDateTime updateTime; + + + +} diff --git a/src/main/java/cn/lihongjie/coal/entity/CoalWashingDailyAnalysis.java b/src/main/java/cn/lihongjie/coal/entity/CoalWashingDailyAnalysis.java new file mode 100644 index 00000000..3c699144 --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/entity/CoalWashingDailyAnalysis.java @@ -0,0 +1,212 @@ +package cn.lihongjie.coal.entity; + +import jakarta.persistence.Entity; +import lombok.Data; +import org.hibernate.annotations.Comment; + +import java.time.LocalDate; + +@Entity +@Data +public class CoalWashingDailyAnalysis extends BaseEntity { + + @Comment("显示名称") + private String name; + + + @Comment("日期") + private LocalDate date; + + + @Comment("成分0 比例") + private Double c0p0; + + + + @Comment("成分0 灰") + private Double c0p1; + + + + @Comment("成分0 硫") + private Double c0p2; + + + + @Comment("成分1 比例") + private Double c1p0; + + + + @Comment("成分1 灰") + private Double c1p1; + + + + @Comment("成分1 硫") + private Double c1p2; + + + + + @Comment("成分2 比例") + private Double c2p0; + + + + @Comment("成分2 灰") + private Double c2p1; + + + + @Comment("成分2 硫") + private Double c2p2; + + + + @Comment("成分3 比例") + private Double c3p0; + + + + @Comment("成分3 灰") + private Double c3p1; + + + + @Comment("成分3 硫") + private Double c3p2; + + + + + @Comment("成分4 比例") + private Double c4p0; + + + + @Comment("成分4 灰") + private Double c4p1; + + + + @Comment("成分4 硫") + private Double c4p2; + + + + + + + + @Comment("成分5 比例") + private Double c5p0; + + + + @Comment("成分5 灰") + private Double c5p1; + + + + @Comment("成分5 硫") + private Double c5p2; + + + + @Comment("成分6 比例") + private Double c6p0; + + + + @Comment("成分6 灰") + private Double c6p1; + + + + @Comment("成分6 硫") + private Double c6p2; + + + + + @Comment("成分7 比例") + private Double c7p0; + + + + @Comment("成分7 灰") + private Double c7p1; + + + + @Comment("成分7 硫") + private Double c7p2; + + + + @Comment("成分8 比例") + private Double c8p0; + + + + @Comment("成分8 灰") + private Double c8p1; + + + + @Comment("成分8 硫") + private Double c8p2; + + + + + @Comment("成分9 比例") + private Double c9p0; + + + + @Comment("成分9 灰") + private Double c9p1; + + + + @Comment("成分9 硫") + private Double c9p2; + + + + + + + + @Comment("大堆 灰") + private Double ddp1; + + + + @Comment("大堆 硫") + private Double ddp2; + + + + + @Comment("大堆 挥发") + private Double ddp3; + + + + @Comment("大堆 粘结") + private Double ddp4; + + + + + @Comment("大堆 备用") + private Double ddp5; + + + + + +} diff --git a/src/main/java/cn/lihongjie/coal/service/BaseService.java b/src/main/java/cn/lihongjie/coal/service/BaseService.java new file mode 100644 index 00000000..9fc84a30 --- /dev/null +++ b/src/main/java/cn/lihongjie/coal/service/BaseService.java @@ -0,0 +1,53 @@ +package cn.lihongjie.coal.service; + +import cn.lihongjie.coal.dao.BaseDao; +import cn.lihongjie.coal.entity.BaseEntity; +import org.springframework.beans.factory.annotation.Autowired; + +public abstract class BaseService { + + @Autowired + BaseDao dao; + + + + public String create(Entity entity){ + + + dao.save(entity); + + return entity.getId(); + + } + + public void update(Entity entity){ + + + dao.save(entity); + + + } + + + public void deleteById(String id){ + + + dao.deleteById(id); + + + } + + public void deleteAllById(Iterable id){ + dao.deleteAllById(id); + } + + + public Object list(){ + + + return null; + + + } + +}