Przeglądaj źródła

保留两位小数

gushoubang 2 tygodni temu
rodzic
commit
85b2b02f6f

+ 55 - 41
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/TGdbhRwGeom.java

@@ -7,101 +7,115 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 耕地保护上传空间详情表对象 t_gdbh_rw_geom
- * 
+ *
  * @author ruoyi
  * @date 2024-12-16
  */
-public class TGdbhRwGeom extends BaseEntity
-{
+public class TGdbhRwGeom extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     private String id;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String geom;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String rwbsm;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private String geomJson;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Integer sort;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private Double geomarea;
 
-    public void setId(String id) 
-    {
+    private Double siweiarea;
+
+    public void setId(String id) {
         this.id = id;
     }
 
-    public String getId() 
-    {
+    public String getId() {
         return id;
     }
-    public void setGeom(String geom) 
-    {
+
+    public void setGeom(String geom) {
         this.geom = geom;
     }
 
-    public String getGeom() 
-    {
+    public String getGeom() {
         return geom;
     }
-    public void setRwbsm(String rwbsm) 
-    {
+
+    public void setRwbsm(String rwbsm) {
         this.rwbsm = rwbsm;
     }
 
-    public String getRwbsm() 
-    {
+    public String getRwbsm() {
         return rwbsm;
     }
-    public void setGeomJson(String geomJson) 
-    {
+
+    public void setGeomJson(String geomJson) {
         this.geomJson = geomJson;
     }
 
-    public String getGeomJson() 
-    {
+    public String getGeomJson() {
         return geomJson;
     }
-    public void setSort(Integer sort)
-    {
+
+    public void setSort(Integer sort) {
         this.sort = sort;
     }
 
-    public Integer getSort()
-    {
+    public Integer getSort() {
         return sort;
     }
-    public void setGeomarea(Double geomarea)
-    {
+
+    public void setGeomarea(Double geomarea) {
         this.geomarea = geomarea;
     }
 
-    public Double getGeomarea()
-    {
+    public Double getGeomarea() {
         return geomarea;
     }
 
+    public Double getSiweiarea() {
+        return siweiarea;
+    }
+
+    public void setSiweiarea(Double siweiarea) {
+        this.siweiarea = siweiarea;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("geom", getGeom())
-            .append("rwbsm", getRwbsm())
-            .append("geomJson", getGeomJson())
-            .append("sort", getSort())
-            .append("geomarea", getGeomarea())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("geom", getGeom())
+                .append("rwbsm", getRwbsm())
+                .append("geomJson", getGeomJson())
+                .append("sort", getSort())
+                .append("geomarea", getGeomarea())
+                .toString();
     }
 }

+ 32 - 23
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhRwGeomMapper.xml

@@ -1,33 +1,36 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.onemap.apply.mapper.gdbh.TGdbhRwGeomMapper">
-    
+
     <resultMap type="TGdbhRwGeom" id="TGdbhRwGeomResult">
-        <result property="id"    column="id"    />
-        <result property="geom"    column="geom"    />
-        <result property="rwbsm"    column="rwbsm"    />
-        <result property="geomJson"    column="geom_json"    />
-        <result property="sort"    column="sort"    />
-        <result property="geomarea"    column="geomarea"    />
+        <result property="id" column="id"/>
+        <result property="geom" column="geom"/>
+        <result property="rwbsm" column="rwbsm"/>
+        <result property="geomJson" column="geom_json"/>
+        <result property="sort" column="sort"/>
+        <result property="geomarea" column="geomarea"/>
+        <result property="siweiarea" column="siweiarea"/>
     </resultMap>
 
     <sql id="selectTGdbhRwGeomVo">
-        select id, public.st_asewkt(geom) geom, rwbsm, geom_json, sort, geomarea from t_gdbh_rw_geom
+        select id, public.st_asewkt(geom) geom, rwbsm, geom_json, sort, geomarea
+        from t_gdbh_rw_geom
     </sql>
 
     <select id="selectTGdbhRwGeomList" parameterType="TGdbhRwGeom" resultMap="TGdbhRwGeomResult">
-        <include refid="selectTGdbhRwGeomVo"/>
-        <where>  
-            <if test="geom != null  and geom != ''"> and geom = #{geom}</if>
-            <if test="rwbsm != null  and rwbsm != ''"> and rwbsm = #{rwbsm}</if>
-            <if test="geomJson != null  and geomJson != ''"> and geom_json = #{geomJson}</if>
-            <if test="sort != null  and sort != ''"> and sort = #{sort}</if>
-            <if test="geomarea != null  and geomarea != ''"> and geomarea = #{geomarea}</if>
+        select id, public.st_asewkt(geom) geom, rwbsm, geom_json, sort, geomarea,ROUND(geomarea * 666.67, 2) AS siweiarea from
+        t_gdbh_rw_geom
+        <where>
+            <if test="geom != null  and geom != ''">and geom = #{geom}</if>
+            <if test="rwbsm != null  and rwbsm != ''">and rwbsm = #{rwbsm}</if>
+            <if test="geomJson != null  and geomJson != ''">and geom_json = #{geomJson}</if>
+            <if test="sort != null  and sort != ''">and sort = #{sort}</if>
+            <if test="geomarea != null  and geomarea != ''">and geomarea = #{geomarea}</if>
         </where>
     </select>
-    
+
     <select id="selectTGdbhRwGeomById" parameterType="String" resultMap="TGdbhRwGeomResult">
         <include refid="selectTGdbhRwGeomVo"/>
         where id = #{id}
@@ -35,7 +38,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="sumTGdbhRwGeomByRwbsm" parameterType="String" resultType="map">
-        select  public.st_asewkt(public.st_union(geom)) geom, sum(geomarea) geomarea, count(*) geomnumber,STRING_AGG(id, ',') AS ids from t_gdbh_rw_geom
+        select public.st_asewkt(public.st_union(geom)) geom,
+               sum(geomarea)                           geomarea,
+               count(*)                                geomnumber,
+               STRING_AGG(id, ',') AS                  ids
+        from t_gdbh_rw_geom
         where rwbsm = #{rwbsm}
 
     </select>
@@ -49,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="geomJson != null">geom_json,</if>
             <if test="sort != null">sort,</if>
             <if test="geomarea != null">geomarea,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null and id != ''">#{id},</if>
             <if test="geom != null">public.st_transform(public.st_geomfromewkt(#{geom}), 4326),</if>
@@ -57,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="geomJson != null">#{geomJson},</if>
             <if test="sort != null">#{sort},</if>
             <if test="geomarea != null">#{geomarea},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateTGdbhRwGeom" parameterType="TGdbhRwGeom">
@@ -73,11 +80,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTGdbhRwGeomById" parameterType="String">
-        delete from t_gdbh_rw_geom where id = #{id}
+        delete
+        from t_gdbh_rw_geom
+        where id = #{id}
     </delete>
 
     <delete id="deleteTGdbhRwGeomByIds" parameterType="String">
-        delete from t_gdbh_rw_geom where id in 
+        delete from t_gdbh_rw_geom where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>