From 51dd6f6129fec5a8301efafcb28d01a3d5734bea Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 07 四月 2023 17:47:44 +0800 Subject: [PATCH] 1 --- src/main/java/com/terra/coal/entity/Coal2000Entity.java | 49 ++++++++-------- src/main/java/com/terra/coal/mapper/MainMapper.java | 25 ++++++++ src/main/java/com/terra/coal/entity/CountEntity.java | 50 ++++++++++++++++ src/main/resources/mapper/MainMapper.xml | 11 +++ 4 files changed, 110 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/terra/coal/entity/Coal2000Entity.java b/src/main/java/com/terra/coal/entity/Coal2000Entity.java index 86628f5..d2a2eb6 100644 --- a/src/main/java/com/terra/coal/entity/Coal2000Entity.java +++ b/src/main/java/com/terra/coal/entity/Coal2000Entity.java @@ -8,7 +8,6 @@ import lombok.EqualsAndHashCode; import java.io.Serializable; -import java.math.BigDecimal; /** * Coal2000Entity @@ -23,23 +22,23 @@ private Integer gid; - private BigDecimal top; + private Double top; - private BigDecimal bottom; + private Double bottom; - private BigDecimal clong; + private Double clong; - private BigDecimal width; + private Double width; - private BigDecimal height; + private Double height; private String ctype; - private BigDecimal density; + private Double density; - private BigDecimal gangue; + private Double gangue; - private BigDecimal volume; + private Double volume; @TableField(value = "ST_AsText(geom)", updateStrategy = FieldStrategy.NEVER, insertStrategy = FieldStrategy.NEVER) private String geom; @@ -55,43 +54,43 @@ this.gid = gid; } - public BigDecimal getTop() { + public Double getTop() { return top; } - public void setTop(BigDecimal top) { + public void setTop(Double top) { this.top = top; } - public BigDecimal getBottom() { + public Double getBottom() { return bottom; } - public void setBottom(BigDecimal bottom) { + public void setBottom(Double bottom) { this.bottom = bottom; } - public BigDecimal getClong() { + public Double getClong() { return clong; } - public void setClong(BigDecimal clong) { + public void setClong(Double clong) { this.clong = clong; } - public BigDecimal getWidth() { + public Double getWidth() { return width; } - public void setWidth(BigDecimal width) { + public void setWidth(Double width) { this.width = width; } - public BigDecimal getHeight() { + public Double getHeight() { return height; } - public void setHeight(BigDecimal height) { + public void setHeight(Double height) { this.height = height; } @@ -103,27 +102,27 @@ this.ctype = ctype; } - public BigDecimal getDensity() { + public Double getDensity() { return density; } - public void setDensity(BigDecimal density) { + public void setDensity(Double density) { this.density = density; } - public BigDecimal getGangue() { + public Double getGangue() { return gangue; } - public void setGangue(BigDecimal gangue) { + public void setGangue(Double gangue) { this.gangue = gangue; } - public BigDecimal getVolume() { + public Double getVolume() { return volume; } - public void setVolume(BigDecimal volume) { + public void setVolume(Double volume) { this.volume = volume; } diff --git a/src/main/java/com/terra/coal/entity/CountEntity.java b/src/main/java/com/terra/coal/entity/CountEntity.java new file mode 100644 index 0000000..20d17ee --- /dev/null +++ b/src/main/java/com/terra/coal/entity/CountEntity.java @@ -0,0 +1,50 @@ +package com.terra.coal.entity; + +/** + * CountEntity + * @author WWW + */ +public class CountEntity { + private String ctype; + + private Double volume; + + private Double v1; + + private Double v2; + + public CountEntity() { + } + + public String getCtype() { + return ctype; + } + + public void setCtype(String ctype) { + this.ctype = ctype; + } + + public Double getVolume() { + return volume; + } + + public void setVolume(Double volume) { + this.volume = volume; + } + + public Double getV1() { + return v1; + } + + public void setV1(Double v1) { + this.v1 = v1; + } + + public Double getV2() { + return v2; + } + + public void setV2(Double v2) { + this.v2 = v2; + } +} diff --git a/src/main/java/com/terra/coal/mapper/MainMapper.java b/src/main/java/com/terra/coal/mapper/MainMapper.java new file mode 100644 index 0000000..80505a4 --- /dev/null +++ b/src/main/java/com/terra/coal/mapper/MainMapper.java @@ -0,0 +1,25 @@ +package com.terra.coal.mapper; + +import com.terra.coal.entity.CountEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * MainMapper + * @author WWW + */ +@Mapper +@Repository +public interface MainMapper { + /** + * 鏍规嵁鑼冨洿缁熻 + * + * @param wkt + * @param z + * @param deep + * @return + */ + public List<CountEntity> countByRange(String wkt, double z, double deep); +} diff --git a/src/main/resources/mapper/MainMapper.xml b/src/main/resources/mapper/MainMapper.xml new file mode 100644 index 0000000..822d4ca --- /dev/null +++ b/src/main/resources/mapper/MainMapper.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.terra.coal.mapper.MainMapper"> + <select id="selectDictTab" resultType="com.terra.coal.entity.CountEntity"> + select ctype, sum(volume) "volume", sum(volume * density) "v1", sum(volume * density * gangue) "v2" + from public.coal54 + where 1 = 1 + group by ctype + order by ctype + </select> +</mapper> \ No newline at end of file -- Gitblit v1.9.3