'更新JS直接操作数据库'
This commit is contained in:
parent
1ade4f8447
commit
3cfa76f659
15
JS直接操作数据库.js
15
JS直接操作数据库.js
@ -3,28 +3,33 @@
|
|||||||
前端执行SQL查询语句
|
前端执行SQL查询语句
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
function SelectByGSL() {
|
// let SQL_sentence = `SELECT loginid as id,password as pw FROM hrmresource`;
|
||||||
|
// let cols = "id,pw";
|
||||||
|
function SelectByGSL(SQL_sentence, cols) {
|
||||||
const getUrl = '/api/gSl/GSl/gsl';
|
const getUrl = '/api/gSl/GSl/gsl';
|
||||||
const Query1 = `SELECT loginid as id,password as pw FROM hrmresource`;//编写SQL语句
|
const Query1 = SQL_sentence;//编写SQL语句
|
||||||
const jiami = ecCom.WeaTools.Base64.encode(Query1);
|
const jiami = ecCom.WeaTools.Base64.encode(Query1);
|
||||||
const result1 = ecCom.WeaTools.Base64.encode("id,pw");//编写查询内容
|
const result1 = ecCom.WeaTools.Base64.encode(cols);//编写查询内容
|
||||||
const mynewJSON = `{
|
const mynewJSON = `{
|
||||||
"expression": "${jiami}",
|
"expression": "${jiami}",
|
||||||
"result": "${result1}"
|
"result": "${result1}"
|
||||||
}`;
|
}`;
|
||||||
const result = await ecCom.WeaTools.callApi(getUrl, 'POST', JSON.parse(mynewJSON));
|
const result = await ecCom.WeaTools.callApi(getUrl, 'POST', JSON.parse(mynewJSON));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
前端执行SQL增、删、改语句
|
前端执行SQL增、删、改语句
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
function insertOrDeleteOrUpdateByGSL() {
|
// let SQL_sentence = `update hrmresource set fieldname='123' where id='43' `;
|
||||||
|
function insertOrDeleteOrUpdateByGSL(SQL_sentence) {
|
||||||
const getUrl = '/api/gSl/GSl/setTable';
|
const getUrl = '/api/gSl/GSl/setTable';
|
||||||
const Query1 = `update hrmresource set fieldname='123' where id='43' `;//编写SQL语句
|
const Query1 = SQL_sentence;//编写SQL语句
|
||||||
const jiami = ecCom.WeaTools.Base64.encode(Query1);
|
const jiami = ecCom.WeaTools.Base64.encode(Query1);
|
||||||
const mynewJSON = `{
|
const mynewJSON = `{
|
||||||
"expression": "${jiami}",
|
"expression": "${jiami}",
|
||||||
}`;
|
}`;
|
||||||
const result = await ecCom.WeaTools.callApi(getUrl, 'POST', JSON.parse(mynewJSON));
|
const result = await ecCom.WeaTools.callApi(getUrl, 'POST', JSON.parse(mynewJSON));
|
||||||
|
return result;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user