前端_React主键为id-mysql:http://www.99wk.com/template/35
前端_React主键为_id-MongoDB:http://www.99wk.com/template/30
CL源码生成工具下载地址:http://www.99wk.com/detail/1
React 实现超级接口任何表的增删改查对应后端响应
exe(
new URLSearchParams(
{
//exe 参数1Parms 参数2 不填出错提示,填写不提示
table:"管理员",//表名
// json:"{账号:'测试1',密码:'123'}", //不传返回 {}
//update:"{账号:'测试1',密码:'电话1'}", //更新时候的查询条件
// kind:0,// 类型 0查询 1更新修改 2删除 3新增 4翻页 不传返回 0
// page:1,//页码 不传返回 1
// limit:20//每页记录数 不传返回 20
})).then(res=>{
console.log(res)
if (res.messageCode) {//成功
} else {
}
});
// 参数说明: 表 , 查询字段 查询内容 获取 字段值
// 构造 select 密码 from 管理员 where 账号='admin'
//全局查询函数
//--------查询管理员表---------------
exe(new URLSearchParams({table:"管理员"})).then(res=>{
console.log(res.data,"表内容")
});
//条件查询 传入多 json 叠加多条件
// where 账号='1'
exe(new URLSearchParams({table:"管理员",json:"{账号:'1'}",})).then(res=>{
console.log(res.data,"条件查询")
});
// kind参数 0查询 1更新修改 2删除 3新增 4翻页
//--------修改理员表---------------
// exe( new URLSearchParams({table:"管理员",json:"{账号:'1'}", update:"{密码:'修改新'}", kind:1,})).then(res=>{
// console.log(res.data)
// });
//--------新增---------------
exe( new URLSearchParams({table:"管理员", json:"{账号:'新增账号1',密码:'新增密码1'}", kind:3})).then(res=>{
console.log(res)
});
//--------删除 -- 构造条件 where 账号='新增账号1' and 密码='新增密码1'
exe( new URLSearchParams({table:"管理员", json:"{账号:'新增账号1',密码:'新增密码1'}", kind:2})).then(res=>{
console.log(res)
});