模糊词搜索周黑鸭

var express = require("express");
var request = require("request");
var mysql = require('mysql');

var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'zhouheiya',
    port: 3307
});
connection.connect();

var app = new express();

app.get("/query", function (req, res) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");

    var name = req.query.name;
    if (name == "" || name == null || name == undefined) {
        connection.query({
            sql: 'SELECT * FROM zhouheiyastoreinfo WHERE orgcode like \'0-7%\'',
            timeout: 40000
        }, function (err, result, fields) {
            if (err) {
                console.log('[SELECT ERROR] - ', err.message);
                return;
            }
            console.log('---SELECT---');

            var arr = [];
            for(var i=0;i

你可能感兴趣的:(模糊词搜索周黑鸭)