123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- const pgClient = require("../DataBase/Postgresql/pgClient.js"); //pg 查询引擎
- const sqlUtil = require("./sqlUtil.js");
- // 通用 getlist
- function tablelist(req, res) {
- // 根据req 制作sql字符串
- let sql = sqlUtil.tablelist(req);
- // 执行sql语句,并返回数据
- pgClient.query(sql).then((data) => {
- res.send(data);
- });
- }
- // 通用 新增
- function add(req, res) {
- let sql = sqlUtil.add(req);
- // 执行sql语句,并返回数据
- pgClient.query(sql).then((data) => {
- res.send(data);
- });
- }
- // 通用 删除
- function delet(req, res) {
- let sql = sqlUtil.delet(req);
- // 执行sql语句,并返回数据
- pgClient.query(sql).then((data) => {
- res.send(data);
- });
- }
- // 通用 查询
- function select(req, res) {
- let sql = sqlUtil.select(req);
- // 执行sql语句,并返回数据
- pgClient.query(sql).then((data) => {
- res.send(data);
- });
- }
- //coor ->>>save->>> WKT
- function SaveWKT(req, res) {
- let sql = sqlUtil.savewkt(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //WKT ->>>save->>> coor
- function GetAllWKT(req, res) {
- let sql = sqlUtil.getallwkt(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //query -> WKT
- function GetWKTById(req, res) {
- let sql = sqlUtil.getwktbyId(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //updata -> WKT
- function UpdataWKTById(req, res) {
- let sql = sqlUtil.updatawktbyId(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //del -> WKT
- function DelWKTById(req, res) {
- let sql = sqlUtil.delwktbyId(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //缓冲区查询
- function QueryBuffer(req, res) {
- let sql = sqlUtil.queryBuffer(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- //线面相交查询
- function QueryBufferXJ(req, res) {
- let sql = sqlUtil.queryBufferXJ(req);
- pgClient.query(sql).then(data => {
- res.send(data);
- })
- }
- module.exports = {
- tablelist,
- add,
- delet,
- select,
- GetAllWKT,
- SaveWKT,
- GetWKTById,
- UpdataWKTById,
- DelWKTById,
- QueryBuffer,
- QueryBufferXJ
- };
|