管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-12-12 b5b3013cf029f24459e22b2c6db0e8349ba43f4c
1
已修改6个文件
109 ■■■■ 文件已修改
data/db_fn.sql 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/all/BaseEntity.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/all/StaticData.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/extend/InsertBatchMethod.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/extend/UpdateBatchMethod.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/GdbHelper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_fn.sql
@@ -359,15 +359,13 @@
select gb,name,classes,pinyin,pac,bsm,geom,eventid,dirid,depid,verid,createtime,createuser,updateuser,updatetime from bd.dlg_agnp
select * from bs.bs_project;
select * from bd.dlg_agnp order by gid desc;
insert into bd.dlg_agnp(gb,name) values('01','A01');
insert into bd.dlg_agnp(gb,name) values('02','A02');
select * from lf.sys_dict where ns='bs' and tab='bs_project';
select fn_rec_query(depid,'dep') depName,fn_rec_query(dirid,'dir') dirName,fn_ver(verid) verName,
  fn_uname(createuser) createName,fn_uname(updateuser) updateName from bd.dlg_agnp limit 10;
src/main/java/com/lf/server/entity/all/BaseEntity.java
@@ -1,6 +1,7 @@
package com.lf.server.entity.all;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
@@ -29,6 +30,21 @@
    private Integer updateuser;
    private Timestamp updatetime;
    @TableField(value = "fn_rec_query(dirid,'dir')")
    private String dirName;
    @TableField(value = "fn_rec_query(depid,'dep')")
    private String depName;
    @TableField(value = "fn_ver(verid)")
    private String verName;
    @TableField(value = "fn_uname(createuser)")
    private String createName;
    @TableField(value = "fn_uname(updateuser)")
    private String updateName;
    public BaseEntity() {
    }
@@ -104,4 +120,44 @@
    public void setUpdatetime(Timestamp updatetime) {
        this.updatetime = updatetime;
    }
    public String getDirName() {
        return dirName;
    }
    public void setDirName(String dirName) {
        this.dirName = dirName;
    }
    public String getDepName() {
        return depName;
    }
    public void setDepName(String depName) {
        this.depName = depName;
    }
    public String getVerName() {
        return verName;
    }
    public void setVerName(String verName) {
        this.verName = verName;
    }
    public String getCreateName() {
        return createName;
    }
    public void setCreateName(String createName) {
        this.createName = createName;
    }
    public String getUpdateName() {
        return updateName;
    }
    public void setUpdateName(String updateName) {
        this.updateName = updateName;
    }
}
src/main/java/com/lf/server/entity/all/StaticData.java
@@ -1,5 +1,9 @@
package com.lf.server.entity.all;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
 * 静态数据类
 * @author WWW
@@ -59,4 +63,19 @@
     * 字符点
     */
    public final static String POINT = ".";
    /**
     * 插入排除字段
     */
    public final static List<String> INSERT_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "objectid", "updateuser", "updatetime", "shape_leng", "shape_area", "dirName", "depName", "verName", "createName", "updateName"));
    /**
     * 更新排除字段
     */
    public final static List<String> UPDATE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("objectid", "createuser", "createtime", "shape_leng", "shape_area", "dirName", "depName", "verName", "createName", "updateName"));
    /**
     * 读取排除字段
     */
    public final static List<String> READ_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "objectid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "shape_leng", "shape_area", "dirName", "depName", "verName", "createName", "updateName"));
}
src/main/java/com/lf/server/extend/InsertBatchMethod.java
@@ -3,14 +3,10 @@
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.lf.server.helper.GdbHelper;
import com.lf.server.entity.all.StaticData;
import org.apache.ibatis.executor.keygen.NoKeyGenerator;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
 * 批量插入方法
@@ -18,8 +14,6 @@
 */
@SuppressWarnings("ALL")
public class InsertBatchMethod extends AbstractMethod {
    private static List<String> excludeFields = new ArrayList<>(Arrays.asList("gid", "objectid", "updateuser", "updatetime", "shape_leng", "shape_area"));
    /**
     * insert into user(id, name, age) values (1, "a", 17), (2, "b", 18);
     * <script>
@@ -47,7 +41,7 @@
        // fieldSql.append(tableInfo.getKeyColumn()).append(",")
        // tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(","))
        for (TableFieldInfo f : tableInfo.getFieldList()) {
            if (excludeFields.contains(f.getColumn())) {
            if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getColumn())) {
                continue;
            }
@@ -67,7 +61,7 @@
        // valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},")
        // tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},"))
        for (TableFieldInfo f : tableInfo.getFieldList()) {
            if (excludeFields.contains(f.getColumn())) {
            if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getColumn())) {
                continue;
            }
src/main/java/com/lf/server/extend/UpdateBatchMethod.java
@@ -4,14 +4,9 @@
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.lf.server.entity.all.StaticData;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * 批量更新方法
@@ -19,8 +14,6 @@
 */
@SuppressWarnings("ALL")
public class UpdateBatchMethod extends AbstractMethod {
    private static List<String> excludeFields = new ArrayList<>(Arrays.asList("objectid", "createuser", "createtime", "shape_leng", "shape_area"));
    /**
     * update user set name = "a", age = 17 where id = 1;
     * update user set name = "b", age = 18 where id = 2;
@@ -75,7 +68,7 @@
    private String getSqlSet(TableInfo tableInfo) {
        StringBuilder sb = new StringBuilder();
        for (TableFieldInfo f : tableInfo.getFieldList()) {
            if (excludeFields.contains(f.getColumn())) {
            if (StaticData.UPDATE_EXCLUDE_FIELDS.contains(f.getColumn())) {
                continue;
            }
src/main/java/com/lf/server/helper/GdbHelper.java
@@ -1,5 +1,6 @@
package com.lf.server.helper;
import com.lf.server.entity.all.StaticData;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gdal.ogr.*;
@@ -19,8 +20,6 @@
    private final static Log log = LogFactory.getLog(GdbHelper.class);
    private final static String OBJECT ="java.lang.Object";
    private static List<String> excludeFields = new ArrayList<>(Arrays.asList("gid", "objectid", "dirid", "depid", "verid","createtime", "createuser", "updateuser", "updatetime", "shape_leng", "shape_area"));
    /**
     * 销毁资源
@@ -190,7 +189,7 @@
                FieldDefn fieldDefn = fd.GetFieldDefn(i);
                try {
                    String name = fieldDefn.GetName().toLowerCase();
                    if (excludeFields.contains(name)) {
                    if (StaticData.READ_EXCLUDE_FIELDS.contains(name)) {
                        continue;
                    }