修改配置文件,修改相关业务和数据库操作调用代码
This commit is contained in:
parent
33e03e3258
commit
96245e79a7
|
|
@ -30,9 +30,11 @@ http {
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include 'auth/auth.conf';
|
||||||
|
|
||||||
include 'system/account.conf';
|
include 'system/account.conf';
|
||||||
include 'system/application.conf';
|
include 'system/application.conf';
|
||||||
include 'system/organization.conf';
|
include 'system/department.conf';
|
||||||
include 'system/permission.conf';
|
include 'system/permission.conf';
|
||||||
include 'system/role.conf';
|
include 'system/role.conf';
|
||||||
include 'system/user.conf';
|
include 'system/user.conf';
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,89 @@
|
||||||
--- DateTime: 2025/10/25 16:36
|
--- DateTime: 2025/10/25 16:36
|
||||||
--- 数据表模型文件
|
--- 数据表模型文件
|
||||||
|
|
||||||
|
local helpers = require("share.helpers")
|
||||||
--引用使用的库文件
|
--引用使用的库文件
|
||||||
local Model = require("share.model")
|
local Model = require("share.model")
|
||||||
|
|
||||||
--创建一个数据表相关的模型
|
--创建一个数据表相关的模型
|
||||||
local Account = Model:new('tbl_account')
|
local accountModel = Model:new('sys_account')
|
||||||
return Account
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
--判断账户是否存在
|
||||||
|
local function isExistAccount(id)
|
||||||
|
--根据账户id进行验证账户是否存在
|
||||||
|
local code, res = accountModel:find(id)
|
||||||
|
if code ~= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--账户不存在返回错误
|
||||||
|
if num <= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 查询数据表中的所有账户信息
|
||||||
|
function _M.getSystemAccounts(pageNum, pageSize)
|
||||||
|
return accountModel:paginate(pageNum, pageSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据账户id获取账户信息
|
||||||
|
function _M.getSystemAccount(id)
|
||||||
|
return accountModel:find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--增加账户信息到数据表
|
||||||
|
function _M.addSystemAccount(jsonData)
|
||||||
|
--解析json中的键和数据值
|
||||||
|
local name = jsonData['name']
|
||||||
|
|
||||||
|
--根据账户进行验证账户是否存在
|
||||||
|
local code, res = accountModel:where("name", "=", name):get()
|
||||||
|
if code ~= 0 then
|
||||||
|
return 0x000001,res
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--账户存在时返回账户已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C,nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--键值为id产生uuid数据值,增加到json中
|
||||||
|
jsonData.id = helpers.getUuid()
|
||||||
|
local ret = helpers.convert_json(jsonData)
|
||||||
|
-- 创建一个账户
|
||||||
|
return accountModel:create('{'..ret..'}')
|
||||||
|
end
|
||||||
|
|
||||||
|
--删除账户信息到数据表
|
||||||
|
function _M:deleteSystemAccount(id)
|
||||||
|
--根据账户id进行验证账户是否存在
|
||||||
|
local ok = isExistAccount(id)
|
||||||
|
--账户不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
return accountModel:delete(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--更新账户信息到数据表
|
||||||
|
function _M:updateSystemAccount(id, jsonData)
|
||||||
|
--根据账户id进行验证账户是否存在
|
||||||
|
local ok = isExistAccount(id)
|
||||||
|
--账户不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
--对数据内容进行更新
|
||||||
|
return accountModel:where('id', '=', id):update(jsonData)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,104 @@
|
||||||
--- DateTime: 2025/10/25 16:36
|
--- DateTime: 2025/10/25 16:36
|
||||||
--- 数据表模型文件
|
--- 数据表模型文件
|
||||||
|
|
||||||
|
local helpers = require("share.helpers")
|
||||||
--引用使用的库文件
|
--引用使用的库文件
|
||||||
local Model = require("share.model")
|
local model = require("share.model")
|
||||||
|
|
||||||
--创建一个数据表相关的模型
|
--创建一个数据表相关的模型
|
||||||
local Application = Model:new('tbl_application')
|
local applicationModel = model:new('sys_application')
|
||||||
return Application
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
--判断应用是否存在
|
||||||
|
local function isExistApplication(id)
|
||||||
|
--根据应用id进行验证应用是否存在
|
||||||
|
local code, res = applicationModel:find(id)
|
||||||
|
if code ~= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--应用不存在返回错误
|
||||||
|
if num <= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 查询数据表中的所有应用信息
|
||||||
|
function _M.getSystemApplications(pageNum, pageSize)
|
||||||
|
return applicationModel:paginate(pageNum, pageSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据应用id获取应用信息
|
||||||
|
function _M.getSystemApplication(id)
|
||||||
|
return applicationModel.find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据组织id获取应用信息
|
||||||
|
function _M.getOrganizationApplication(id)
|
||||||
|
--todo
|
||||||
|
return applicationModel.find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据用户id获取应用信息
|
||||||
|
function _M.getUserApplication(id)
|
||||||
|
--todo
|
||||||
|
return applicationModel.find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--增加应用信息到数据表
|
||||||
|
function _M.addSystemApplication(jsonData)
|
||||||
|
--解析json中的键和数据值
|
||||||
|
local name = jsonData['name']
|
||||||
|
|
||||||
|
--根据应用进行验证是否存在
|
||||||
|
local code, res = applicationModel:where("name", "=", name):get()
|
||||||
|
if code ~= 0 then
|
||||||
|
return 0x000001, res
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--用户存在时返回用户已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C,nil
|
||||||
|
end
|
||||||
|
--应用存在时返回应用已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C, nil
|
||||||
|
end
|
||||||
|
--键值为id产生uuid数据值,增加到json中
|
||||||
|
jsonData.id = helpers.getUuid()
|
||||||
|
local ret = helpers.convert_json(jsonData)
|
||||||
|
-- 创建一个应用
|
||||||
|
return applicationModel:create('{'..ret..'}')
|
||||||
|
end
|
||||||
|
|
||||||
|
--删除应用信息到数据表
|
||||||
|
function _M.deleteApplication(id)
|
||||||
|
--根据用户id进行验证用户是否存在
|
||||||
|
local ok = isExistApplication(id)
|
||||||
|
--用户不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
return applicationModel:delete(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--更新应用信息到数据表
|
||||||
|
function _M.updateApplication(id, jsonData)
|
||||||
|
--根据用户id进行验证用户是否存在
|
||||||
|
local ok = isExistApplication(id)
|
||||||
|
--用户不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
--对数据内容进行更新
|
||||||
|
return applicationModel:where('id', '=', id):update(jsonData)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _M
|
||||||
|
|
@ -4,9 +4,88 @@
|
||||||
--- DateTime: 2025/10/28 10:14
|
--- DateTime: 2025/10/28 10:14
|
||||||
--- 数据表模型文件
|
--- 数据表模型文件
|
||||||
|
|
||||||
|
local helpers = require("share.helpers")
|
||||||
--引用使用的库文件
|
--引用使用的库文件
|
||||||
local Model = require("share.model")
|
local model = require("share.model")
|
||||||
|
|
||||||
--创建一个数据表相关的模型
|
--创建一个数据表相关的模型
|
||||||
local Organization = Model:new('tbl_organization')
|
local departmentModel = model:new('sys_department')
|
||||||
return Organization
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
--判断组织是否存在
|
||||||
|
local function isExistDepartment(id)
|
||||||
|
--根据组织id进行验证组织是否存在
|
||||||
|
local code, res = departmentModel:find(id)
|
||||||
|
if code ~= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--组织不存在返回错误
|
||||||
|
if num <= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 查询数据表中的所有组织架构信息
|
||||||
|
function _M.getSystemDepartments(pageNum, pageSize)
|
||||||
|
return departmentModel:paginate(pageNum, pageSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据组织架构id获取组织架构信息
|
||||||
|
function _M.getSystemDepartment(id)
|
||||||
|
return departmentModel.find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--增加组织架构息到数据表
|
||||||
|
function _M.addSystemDepartment(jsonData)
|
||||||
|
--解析json中的键和数据值
|
||||||
|
local name = jsonData['name']
|
||||||
|
|
||||||
|
--根据组织名称进行验证组织是否存在
|
||||||
|
local code, res = departmentModel:where("name", "=", name):get()
|
||||||
|
if code ~= 0 then
|
||||||
|
return 0x000001,res
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--组织架构存在时返回组织架构已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C, nil
|
||||||
|
end
|
||||||
|
--键值为id产生uuid数据值,增加到json中
|
||||||
|
jsonData.id = helpers.getUuid()
|
||||||
|
local ret = helpers.convert_json(jsonData)
|
||||||
|
-- 创建一个组织架构
|
||||||
|
return departmentModel:create('{'..ret..'}')
|
||||||
|
end
|
||||||
|
|
||||||
|
--删除组织架构信息到数据表
|
||||||
|
function _M.deleteSystemDepartment(id)
|
||||||
|
--根据组织id进行验证组织是否存在
|
||||||
|
local ok = isExistDepartment(id)
|
||||||
|
--组织不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
return departmentModel:delete(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--更新组织架构信息到数据表
|
||||||
|
function _M.updateSystemDepartment(id, jsonData)
|
||||||
|
--根据组织id进行验证组织是否存在
|
||||||
|
local ok = isExistDepartment(id)
|
||||||
|
--组织不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
--对数据内容进行更新
|
||||||
|
return departmentModel:where('id', '=', id):update(jsonData)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,96 @@
|
||||||
--- DateTime: 2025/10/25 16:36
|
--- DateTime: 2025/10/25 16:36
|
||||||
--- 数据表模型文件
|
--- 数据表模型文件
|
||||||
|
|
||||||
|
local helpers = require("share.helpers")
|
||||||
--引用使用的库文件
|
--引用使用的库文件
|
||||||
local Model = require("share.model")
|
local model = require("share.model")
|
||||||
|
|
||||||
--创建一个数据表相关的模型
|
--创建一个数据表相关的模型
|
||||||
local Permission = Model:new('tbl_permission')
|
local permissionModel = model:new('sys_permission')
|
||||||
return Permission
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
--判断权限是否存在
|
||||||
|
local function isExistPermission(id)
|
||||||
|
--根据权限id进行验证权限是否存在
|
||||||
|
local code, res = permissionModel:find(id)
|
||||||
|
if code ~= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--权限不存在返回错误
|
||||||
|
if num <= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 查询数据表中的所有权限信息
|
||||||
|
function _M.getSystemPermissions(pageNum, pageSize)
|
||||||
|
return permissionModel:paginate(pageNum, pageSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据权限id获取权限信息
|
||||||
|
function _M.getSystemPermission(id)
|
||||||
|
return permissionModel.find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据角色id获取角色的权限
|
||||||
|
function _M.getSystemPermissionByRole(id)
|
||||||
|
--权限表与角色表进行表关系查询返回结果
|
||||||
|
--todo
|
||||||
|
return permissionModel.first(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--增加权限信息到数据表
|
||||||
|
function _M.addSystemPermission(jsonData)
|
||||||
|
--解析json中的键和数据值
|
||||||
|
local name = jsonData['name']
|
||||||
|
|
||||||
|
--根据权限名称进行验证权限是否存在
|
||||||
|
local code, res = permissionModel:where("name", "=", name):get()
|
||||||
|
if code ~= 0 then
|
||||||
|
return 0x000001,res
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--权限存在时返回权限已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C,nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--键值为id产生uuid数据值,增加到json中
|
||||||
|
jsonData.id = helpers.getUuid()
|
||||||
|
local ret = helpers.convert_json(jsonData)
|
||||||
|
-- 创建一个权限
|
||||||
|
return permissionModel:create('{'..ret..'}')
|
||||||
|
end
|
||||||
|
|
||||||
|
--删除权限信息到数据表
|
||||||
|
function _M.deleteSystemPermission(id)
|
||||||
|
--根据权限id进行验证权限是否存在
|
||||||
|
local ok = isExistPermission(id)
|
||||||
|
--权限不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
return permissionModel:delete(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--更新权限信息到数据表
|
||||||
|
function _M.updateSystemPermission(id, jsonData)
|
||||||
|
--根据权限id进行验证权限是否存在
|
||||||
|
local ok = isExistPermission(id)
|
||||||
|
--权限不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
--对数据内容进行更新
|
||||||
|
return permissionModel:where('id', '=', id):update(jsonData)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,89 @@
|
||||||
--- DateTime: 2025/10/25 16:36
|
--- DateTime: 2025/10/25 16:36
|
||||||
--- 数据表模型文件
|
--- 数据表模型文件
|
||||||
|
|
||||||
|
local helpers = require("share.helpers")
|
||||||
--引用使用的库文件
|
--引用使用的库文件
|
||||||
local Model = require("share.model")
|
local model = require("share.model")
|
||||||
|
|
||||||
--创建一个数据表相关的模型
|
--创建一个数据表相关的模型
|
||||||
local Role = Model:new('tbl_role')
|
local roleModel = model:new('sys_role')
|
||||||
return Role
|
|
||||||
|
local _M = {}
|
||||||
|
|
||||||
|
--判断角色是否存在
|
||||||
|
local function isExistRole(id)
|
||||||
|
--根据角色id进行验证角色是否存在
|
||||||
|
local code, res = roleModel:find(id)
|
||||||
|
if code ~= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--角色不存在返回错误
|
||||||
|
if num <= 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 查询数据表中的所有角色信息
|
||||||
|
function _M.getSystemRoles(pageNum, pageSize)
|
||||||
|
return roleModel:paginate(pageNum, pageSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
--根据角色id获取角色信息
|
||||||
|
function _M.getSystemRole(id)
|
||||||
|
return roleModel:find(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--增加角色信息到数据表
|
||||||
|
function _M.addSystemRole(jsonData)
|
||||||
|
--解析json中的键和数据值
|
||||||
|
local roleName = jsonData['role_name']
|
||||||
|
|
||||||
|
--根据角色、手机号、邮箱进行验证角色是否存在
|
||||||
|
local code, res = roleModel:where("role_name", "=", roleName):get()
|
||||||
|
if code ~= 0 then
|
||||||
|
return 0x000001,res
|
||||||
|
end
|
||||||
|
local num = 0
|
||||||
|
if res ~= nil then
|
||||||
|
num = table.getn(res)
|
||||||
|
end
|
||||||
|
--角色存在时返回角色已经存在
|
||||||
|
if num > 0 then
|
||||||
|
return 0x01000C,nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--键值为id产生uuid数据值,增加到json中
|
||||||
|
jsonData.id = helpers.getUuid()
|
||||||
|
local ret = helpers.convert_json(jsonData)
|
||||||
|
-- 创建一个角色
|
||||||
|
return roleModel:create('{'..ret..'}')
|
||||||
|
end
|
||||||
|
|
||||||
|
--删除角色信息到数据表
|
||||||
|
function _M:deleteSystemRole(id)
|
||||||
|
--根据角色id进行验证角色是否存在
|
||||||
|
local ok = isExistRole(id)
|
||||||
|
--角色不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
return roleModel:delete(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
--更新角色信息到数据表
|
||||||
|
function _M:updateSystemRole(id, jsonData)
|
||||||
|
--根据角色id进行验证角色是否存在
|
||||||
|
local ok = isExistRole(id)
|
||||||
|
--角色不存在则返回
|
||||||
|
if ok == false then
|
||||||
|
return 0x000001,nil
|
||||||
|
end
|
||||||
|
--对数据内容进行更新
|
||||||
|
return roleModel:where('id', '=', id):update(jsonData)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _M
|
||||||
|
|
@ -31,17 +31,17 @@ local function isExistUser(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有用户信息
|
-- 查询数据表中的所有用户信息
|
||||||
function _M.getAllUser(pageNum, pageSize)
|
function _M.getSystemUsers(pageNum, pageSize)
|
||||||
return userModel:paginate(pageNum, pageSize)
|
return userModel:paginate(pageNum, pageSize)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据用户id获取用户信息
|
--根据用户id获取用户信息
|
||||||
function _M.getUser(id)
|
function _M.getSystemUser(id)
|
||||||
return userModel:find(id)
|
return userModel:find(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
--增加用户信息到数据表
|
--增加用户信息到数据表
|
||||||
function _M.addUser(jsonData)
|
function _M.addSystemUser(jsonData)
|
||||||
--解析json中的键和数据值
|
--解析json中的键和数据值
|
||||||
local userName = jsonData['username']
|
local userName = jsonData['username']
|
||||||
local phone = jsonData['phone']
|
local phone = jsonData['phone']
|
||||||
|
|
@ -69,7 +69,7 @@ function _M.addUser(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
--删除用户信息到数据表
|
--删除用户信息到数据表
|
||||||
function _M:deleteUser(id)
|
function _M:deleteSystemUser(id)
|
||||||
--根据用户id进行验证用户是否存在
|
--根据用户id进行验证用户是否存在
|
||||||
local ok = isExistUser(id)
|
local ok = isExistUser(id)
|
||||||
--用户不存在则返回
|
--用户不存在则返回
|
||||||
|
|
@ -80,7 +80,7 @@ function _M:deleteUser(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
--更新用户信息到数据表
|
--更新用户信息到数据表
|
||||||
function _M:updateUser(id, jsonData)
|
function _M:updateSystemUser(id, jsonData)
|
||||||
--根据用户id进行验证用户是否存在
|
--根据用户id进行验证用户是否存在
|
||||||
local ok = isExistUser(id)
|
local ok = isExistUser(id)
|
||||||
--用户不存在则返回
|
--用户不存在则返回
|
||||||
|
|
|
||||||
|
|
@ -3,65 +3,71 @@
|
||||||
--- Created by .
|
--- Created by .
|
||||||
--- DateTime: 2025/9/25 08:25
|
--- DateTime: 2025/9/25 08:25
|
||||||
--- 业务逻辑 对账户数据表进行数据表业务处理
|
--- 业务逻辑 对账户数据表进行数据表业务处理
|
||||||
local validator = require("util.validator")
|
local jsonschema = require("jsonschema")
|
||||||
local helpers = require("share.helpers")
|
local resp = require("util.response")
|
||||||
local account = require("model.account")
|
local accountDao = require("dao.account")
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
local dao = require("service.system.account")
|
-- 定义一个JSON Schema
|
||||||
local resp = require("util.response")
|
local schema = {
|
||||||
|
{type = "object", properties = {
|
||||||
|
{name = "name", type = "string"},
|
||||||
|
{name = "password", type = "string"},
|
||||||
|
{name = "real_name", type = "string"},
|
||||||
|
{name = "department", type = "string"},
|
||||||
|
{name = "office_phone", type = "string"},
|
||||||
|
{name = "telephone", type = "string"},
|
||||||
|
{name = "display_name", type = "string"},
|
||||||
|
}, required = {"username"}}
|
||||||
|
}
|
||||||
|
|
||||||
--获取所有账户信息
|
--获取所有账户信息
|
||||||
function _M.get_allaccount()
|
function _M.getSystemAccounts()
|
||||||
local code,ret = dao.getAllAccount()
|
local pageNum = ngx.var.pagenum or 1
|
||||||
|
local pageSize = ngx.var.pagesize or 10
|
||||||
|
local code,ret = accountDao.getSystemAccounts(pageNum, pageSize)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账户id获取账户信息
|
--根据账户id获取账户信息
|
||||||
function _M.get_account(m)
|
function _M.getSystemAccount(m)
|
||||||
local id = m.id
|
local id = m.id
|
||||||
local code,ret = dao.getAccount(id)
|
local code,ret = accountDao.getSystemAccount(id)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账户id获取账户信息
|
--根据账户id获取账户信息
|
||||||
function _M.add_account()
|
function _M.addSystemAccount()
|
||||||
--获取请求头并进行校验
|
|
||||||
if validator.checkReqHeader() == false then
|
|
||||||
local result = resp:json(0x000001)
|
|
||||||
resp:send(result)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = dao.addAccount(body_data)
|
local code, ret = accountDao.addSystemAccount(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账户id删除账户信息
|
--根据账户id删除账户信息
|
||||||
function _M.delete_account(m)
|
function _M.deleteSystemAccount(m)
|
||||||
local id = m.id
|
local code, ret = accountDao.deleteSystemAccount(m.id)
|
||||||
local code, ret = dao.deleteAccount(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账户id删除账户信息
|
--根据账户id删除账户信息
|
||||||
function _M.update_account(m)
|
function _M.updateSystemAccount(m)
|
||||||
local id = m.id
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
|
|
@ -72,84 +78,9 @@ function _M.update_account(m)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local code, ret = dao.updateAccount(id, body_data)
|
local code, ret = accountDao.updateSystemAccount(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有账户信息
|
|
||||||
function _M.getAllAccount()
|
|
||||||
return account:all()
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据账户id获取账户信息
|
|
||||||
function _M.getAccount(id)
|
|
||||||
return account.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--增加账户信息到数据表
|
|
||||||
function _M.addAccount(jsonData)
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--解析json中的键和数据值
|
|
||||||
local name = ""
|
|
||||||
for key, value in pairs(result) do
|
|
||||||
if key == "name" then name = value end
|
|
||||||
end
|
|
||||||
--根据账户进行验证是否存在
|
|
||||||
local code, res = account:where("name", "=", name):get()
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--账户存在时返回账户已经存在
|
|
||||||
if num > 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--键值为id产生uuid数据值,增加到json中
|
|
||||||
result.id = helpers.getUuid()
|
|
||||||
local ret = helpers.convert_json(result)
|
|
||||||
-- 创建一个账户
|
|
||||||
return account:create('{'..ret..'}')
|
|
||||||
end
|
|
||||||
|
|
||||||
--删除账户信息到数据表
|
|
||||||
function _M.deleteAccount(id)
|
|
||||||
return account:delete(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--更新账户信息到数据表
|
|
||||||
function _M.updateAccount(id, jsonData)
|
|
||||||
--根据账户id进行验证账户是否存在
|
|
||||||
local code, res = account:find(id)
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--账户不存在返回错误
|
|
||||||
if num <= 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--对数据内容进行更新
|
|
||||||
return account:where('id', '=', id):update(jsonData)
|
|
||||||
end
|
|
||||||
|
|
||||||
return _M
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -3,182 +3,102 @@
|
||||||
--- Created by .
|
--- Created by .
|
||||||
--- DateTime: 2025/9/27 16:02
|
--- DateTime: 2025/9/27 16:02
|
||||||
--- 业务逻辑 对应用数据表进行数据表业务处理
|
--- 业务逻辑 对应用数据表进行数据表业务处理
|
||||||
local validator = require("util.validator")
|
local jsonschema = require("jsonschema")
|
||||||
local helpers = require("share.helpers")
|
local resp = require("util.response")
|
||||||
local application = require("model.application")
|
local applicationDao = require("dao.application")
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
local dao = require("service.system.application")
|
-- 定义一个JSON Schema
|
||||||
local resp = require("util.response")
|
local schema = {
|
||||||
local validator = require("util.validator")
|
{type = "object", properties = {
|
||||||
|
{name = "name", type = "string"},
|
||||||
|
{name = "display_name", type = "string"},
|
||||||
|
{name = "logo", type = "string"},
|
||||||
|
{name = "title", type = "string"},
|
||||||
|
{name = "name", type = "string"},
|
||||||
|
{name = "favicon", type = "string"},
|
||||||
|
{name = "description", type = "string"},
|
||||||
|
{name = "homepage_url", type = "string"},
|
||||||
|
{name = "redirect_uris", type = "string"},
|
||||||
|
}, required = {"name", "redirect_uris"}}
|
||||||
|
}
|
||||||
|
|
||||||
--获取所有应用程序信息
|
--获取所有应用程序信息
|
||||||
function _M.get_allapplication()
|
function _M.getSystemApplications()
|
||||||
local code,ret = dao.getAllApplication()
|
--获取页码和请求的数据量
|
||||||
|
local pageNum = ngx.var.pagenum or 1
|
||||||
|
local pageSize = ngx.var.pagesize or 10
|
||||||
|
local code,ret = applicationDao.getSystemApplications()
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据应用id获取应用信息
|
--根据应用id获取应用信息
|
||||||
function _M.get_application(m)
|
function _M.getSystemApplication(m)
|
||||||
local id = m.id
|
local code,ret = applicationDao.getSystemApplication(m.id)
|
||||||
local code,ret = dao.getApplication(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织id获取权限的信息
|
--根据组织id获取应用信息
|
||||||
function _M.get_organization_application(m)
|
function _M.getOrganizationApplication(m)
|
||||||
local id = m.id
|
local code,ret = applicationDao.getOrganizationApplication(m.id)
|
||||||
local code,ret = dao.getOrganizationApplication(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据用户id获取权限的信息
|
--根据用户id获取应用的信息
|
||||||
function _M.get_user_application(m)
|
function _M.getUserApplication(m)
|
||||||
local id = m.id
|
local code,ret = applicationDao.getUserApplication(m.id)
|
||||||
local code,ret = dao.getUserApplication(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据应用id获取应用信息
|
--根据应用id获取应用信息
|
||||||
function _M.add_application()
|
function _M.addSystemApplication()
|
||||||
--获取请求头并进行校验
|
|
||||||
if validator.checkReqHeader() == false then
|
|
||||||
local result = resp:json(0x000001)
|
|
||||||
resp:send(result)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = dao.addApplication(body_data)
|
local code, ret = applicationDao.addApplication(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据应用id删除应用信息
|
--根据应用id删除应用信息
|
||||||
function _M.delete_application(m)
|
function _M.deleteSystemApplication(m)
|
||||||
local id = m.id
|
local code, ret = applicationDao.deleteApplication(m.id)
|
||||||
local code, ret = dao.deleteApplication(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据应用id删除应用信息
|
--根据应用id删除应用信息
|
||||||
function _M.update_application(m)
|
function _M.updateSystemApplication(m)
|
||||||
local id = m.id
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local code, ret = dao.updateApplication(id, body_data)
|
local code, ret = applicationDao.updateSystemApplication(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有应用信息
|
|
||||||
function _M.getAllApplication()
|
|
||||||
return application:all()
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据应用id获取应用信息
|
|
||||||
function _M.getApplication(id)
|
|
||||||
return application.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据组织id获取应用信息
|
|
||||||
function _M.getOrganizationApplication(id)
|
|
||||||
--todo
|
|
||||||
return application.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据用户id获取应用信息
|
|
||||||
function _M.getUserApplication(id)
|
|
||||||
--todo
|
|
||||||
return application.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--增加应用信息到数据表
|
|
||||||
function _M.addApplication(jsonData)
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--解析json中的键和数据值
|
|
||||||
local name = ""
|
|
||||||
for key, value in pairs(result) do
|
|
||||||
if key == "name" then name = value end
|
|
||||||
end
|
|
||||||
--根据应用进行验证是否存在
|
|
||||||
local code, res = application:where("name", "=", name):get()
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--应用存在时返回应用已经存在
|
|
||||||
if num > 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--键值为id产生uuid数据值,增加到json中
|
|
||||||
result.id = helpers.getUuid()
|
|
||||||
local ret = helpers.convert_json(result)
|
|
||||||
-- 创建一个应用
|
|
||||||
return application:create('{'..ret..'}')
|
|
||||||
end
|
|
||||||
|
|
||||||
--删除应用信息到数据表
|
|
||||||
function _M.deleteApplication(id)
|
|
||||||
return application:delete(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--更新应用信息到数据表
|
|
||||||
function _M.updateApplication(id, jsonData)
|
|
||||||
--根据应用id进行验证应用是否存在
|
|
||||||
local code, res = application:find(id)
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--应用不存在返回错误
|
|
||||||
if num <= 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--对数据内容进行更新
|
|
||||||
return application:where('id', '=', id):update(jsonData)
|
|
||||||
end
|
|
||||||
|
|
||||||
return _M
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -3,154 +3,87 @@
|
||||||
--- Created by .
|
--- Created by .
|
||||||
--- DateTime: 2025/9/28 10:22
|
--- DateTime: 2025/9/28 10:22
|
||||||
--- 业务逻辑 对组织架构数据表进行数据表业务处理
|
--- 业务逻辑 对组织架构数据表进行数据表业务处理
|
||||||
local validator = require("util.validator")
|
local jsonschema = require("jsonschema")
|
||||||
local helpers = require("share.helpers")
|
local resp = require("util.response")
|
||||||
local organization = require("model.organization")
|
local departmentDao = require("dao.department")
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
local dao = require("service.system.department")
|
-- 定义一个JSON Schema
|
||||||
local resp = require("util.response")
|
local schema = {
|
||||||
local validator = require("util.validator")
|
{type = "object", properties = {
|
||||||
|
{name = "name", type = "string"},
|
||||||
|
{name = "seq", type = "string"},
|
||||||
|
{name = "description", type = "string"},
|
||||||
|
{name = "create_by", type = "string"},
|
||||||
|
{name = "update_by", type = "string"},
|
||||||
|
{name = "parent_id", type = "string"},
|
||||||
|
{name = "leader", type = "string"},
|
||||||
|
{name = "status", type = "string"},
|
||||||
|
}, required = {"name"}}
|
||||||
|
}
|
||||||
|
|
||||||
--获取所有组织架构信息
|
--获取所有组织架构信息
|
||||||
function _M.get_allorganization()
|
function _M.getSystemDepartments()
|
||||||
local code,ret = dao.getAllOrganization()
|
--获取页码和请求的数据量
|
||||||
|
local pageNum = ngx.var.pagenum or 1
|
||||||
|
local pageSize = ngx.var.pagesize or 10
|
||||||
|
local code,ret = departmentDao.getSystemDepartments(pageNum, pageSize)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织id获取组织架构信息
|
--根据组织id获取组织架构信息
|
||||||
function _M.get_organization(m)
|
function _M.getSystemDepartment(m)
|
||||||
local id = m.id
|
local code,ret = departmentDao.getSystemDepartment(m.id)
|
||||||
local code,ret = dao.getOrganization(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织id添加组织架构信息
|
--根据组织id添加组织架构信息
|
||||||
function _M.add_organization()
|
function _M.addSystemDepartment()
|
||||||
--获取请求头并进行校验
|
|
||||||
if validator.checkReqHeader() == false then
|
|
||||||
local result = resp:json(0x000001)
|
|
||||||
resp:send(result)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = dao.addOrganization(body_data)
|
local code, ret = departmentDao.addSystemDepartment(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织id删除组织架构信息
|
--根据组织id删除组织架构信息
|
||||||
function _M.delete_organization(m)
|
function _M.deleteSystemDepartment(m)
|
||||||
local id = m.id
|
local code, ret = departmentDao.deleteSystemDepartment(m.id)
|
||||||
local code, ret = dao.deleteOrganization(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织id删除组织架构信息
|
--根据组织id删除组织架构信息
|
||||||
function _M.update_organization(m)
|
function _M.updateSystemDepartment(m)
|
||||||
local id = m.id
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local code, ret = dao.updateOrganization(id, body_data)
|
local code, ret = departmentDao.updateSystemDepartment(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有组织架构信息
|
|
||||||
function _M.getAllOrganization()
|
|
||||||
return organization:all()
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据组织架构id获取组织架构信息
|
|
||||||
function _M.getOrganization(id)
|
|
||||||
return organization.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--增加组织架构息到数据表
|
|
||||||
function _M.addOrganization(jsonData)
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--解析json中的键和数据值
|
|
||||||
local name = ""
|
|
||||||
for key, value in pairs(result) do
|
|
||||||
if key == "name" then name = value end
|
|
||||||
end
|
|
||||||
--根据组织架构进行验证是否存在
|
|
||||||
local code, res = organization:where("name", "=", name):get()
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--组织架构存在时返回组织架构已经存在
|
|
||||||
if num > 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--键值为id产生uuid数据值,增加到json中
|
|
||||||
result.id = helpers.getUuid()
|
|
||||||
local ret = helpers.convert_json(result)
|
|
||||||
-- 创建一个组织架构
|
|
||||||
return organization:create('{'..ret..'}')
|
|
||||||
end
|
|
||||||
|
|
||||||
--删除组织架构信息到数据表
|
|
||||||
function _M.deleteOrganization(id)
|
|
||||||
return organization:delete(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--更新组织架构信息到数据表
|
|
||||||
function _M.updateOrganization(id, jsonData)
|
|
||||||
--根据组织架构id进行验证组织架构是否存在
|
|
||||||
local code, res = organization:find(id)
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--账号不存在返回错误
|
|
||||||
if num <= 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--对数据内容进行更新
|
|
||||||
return organization:where('id', '=', id):update(jsonData)
|
|
||||||
end
|
|
||||||
|
|
||||||
return _M
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -3,169 +3,94 @@
|
||||||
--- Created by .
|
--- Created by .
|
||||||
--- DateTime: 2025/9/27 17:06
|
--- DateTime: 2025/9/27 17:06
|
||||||
--- 业务逻辑 对权限数据表进行数据表业务处理
|
--- 业务逻辑 对权限数据表进行数据表业务处理
|
||||||
local validator = require("util.validator")
|
local jsonschema = require("jsonschema")
|
||||||
local helpers = require("share.helpers")
|
local resp = require("util.response")
|
||||||
local permission = require("model.permission")
|
local permissionDao = require("dao.permission")
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
local dao = require("service.system.permission")
|
-- 定义一个JSON Schema
|
||||||
local resp = require("util.response")
|
local schema = {
|
||||||
local validator = require("util.validator")
|
{type = "object", properties = {
|
||||||
|
{name = "username", type = "string"},
|
||||||
|
{name = "phone", type = "string"},
|
||||||
|
{name = "email", type = "string"},
|
||||||
|
{name = "idcard", type = "string"},
|
||||||
|
{name = "name", type = "string"},
|
||||||
|
{name = "office_phone", type = "string"},
|
||||||
|
{name = "telephone", type = "string"},
|
||||||
|
{name = "display_name", type = "string"},
|
||||||
|
}, required = {"username", "phone", "email", "idcard"}}
|
||||||
|
}
|
||||||
|
|
||||||
--获取所有权限信息
|
--获取所有权限信息
|
||||||
function _M.get_allpermission()
|
function _M.getSystemPermissions()
|
||||||
local code,ret = dao.getAllPermission()
|
--获取页码和请求的数据量
|
||||||
|
local pageNum = ngx.var.pagenum or 1
|
||||||
|
local pageSize = ngx.var.pagesize or 10
|
||||||
|
local code,ret = permissionDao.getSystemPermissions(pageNum, pageSize)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据权限id获取权限信息
|
--根据权限id获取权限信息
|
||||||
function _M.get_permission(m)
|
function _M.get_permission(m)
|
||||||
local id = m.id
|
local code,ret = permissionDao.getPermission(m.id)
|
||||||
local code,ret = dao.getPermission(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据角色id获取使用的权限
|
--根据角色id获取使用的权限
|
||||||
function _M.get_permission_by_role(m)
|
function _M.getSystemPermissionByRole(m)
|
||||||
local id = m.id
|
local code,ret = dao.getPermissionByRole(m.id)
|
||||||
local code,ret = dao.getPermissionByRole(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账号id获取账号信息
|
--根据权限id获取账号信息
|
||||||
function _M.add_permission()
|
function _M.addSystemPermission()
|
||||||
--获取请求头并进行校验
|
|
||||||
if validator.checkReqHeader() == false then
|
|
||||||
local result = resp:json(0x000001)
|
|
||||||
resp:send(result)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = dao.addPermission(body_data)
|
local code, ret = permissionDao.addPermission(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账号id删除账号信息
|
--根据账号id删除账号信息
|
||||||
function _M.delete_permission(m)
|
function _M.deleteSystemPermission(m)
|
||||||
local id = m.id
|
local code, ret = permissionDao.deleteSystemPermission(m.id)
|
||||||
local code, ret = dao.deletePermission(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据账号id删除账号信息
|
--根据账号id删除账号信息
|
||||||
function _M.update_permission(m)
|
function _M.updateSystemPermission(m)
|
||||||
local id = m.id
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local code, ret = dao.updatePermission(id, body_data)
|
local code, ret = permissionDao.updatePermission(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有权限信息
|
|
||||||
function _M.getAllPermission()
|
|
||||||
return permission:all()
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据权限id获取权限信息
|
|
||||||
function _M.getPermission(id)
|
|
||||||
return permission.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据角色id获取角色的权限
|
|
||||||
function _M.getPermissionByRole(id)
|
|
||||||
--权限表与角色表进行表关系查询返回结果
|
|
||||||
--todo
|
|
||||||
return permission.first(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--增加权限信息到数据表
|
|
||||||
function _M.addPermission(jsonData)
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--解析json中的键和数据值
|
|
||||||
local name = ""
|
|
||||||
for key, value in pairs(result) do
|
|
||||||
if key == "name" then name = value end
|
|
||||||
end
|
|
||||||
--根据权限进行验证是否存在
|
|
||||||
local code, res = permission:where("name", "=", name):get()
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--权限存在时返回权限已经存在
|
|
||||||
if num > 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--键值为id产生uuid数据值,增加到json中
|
|
||||||
result.id = helpers.getUuid()
|
|
||||||
local ret = helpers.convert_json(result)
|
|
||||||
-- 创建一个权限
|
|
||||||
return permission:create('{'..ret..'}')
|
|
||||||
end
|
|
||||||
|
|
||||||
--删除权限信息到数据表
|
|
||||||
function _M.deletePermission(id)
|
|
||||||
return permission:delete(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--更新权限信息到数据表
|
|
||||||
function _M.updatePermission(id, jsonData)
|
|
||||||
--根据权限id进行验证权限是否存在
|
|
||||||
local code, res = permission:find(id)
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--权限不存在返回错误
|
|
||||||
if num <= 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--对数据内容进行更新
|
|
||||||
return permission:where('id', '=', id):update(jsonData)
|
|
||||||
end
|
|
||||||
|
|
||||||
return _M
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -3,154 +3,84 @@
|
||||||
--- Created by .
|
--- Created by .
|
||||||
--- DateTime: 2025/9/27 15:19
|
--- DateTime: 2025/9/27 15:19
|
||||||
--- 业务逻辑 对用户角色数据表进行数据表业务处理
|
--- 业务逻辑 对用户角色数据表进行数据表业务处理
|
||||||
local validator = require("util.validator")
|
local jsonschema = require("jsonschema")
|
||||||
local helpers = require("share.helpers")
|
local resp = require("util.response")
|
||||||
local role = require("model.role")
|
local roleDao = require("dao.role")
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
local dao = require("service.system.role")
|
-- 定义一个JSON Schema
|
||||||
local resp = require("util.response")
|
local schema = {
|
||||||
local validator = require("util.validator")
|
{type = "object", properties = {
|
||||||
|
{name = "role_name", type = "string"},
|
||||||
|
{name = "description", type = "string"},
|
||||||
|
{name = "create_by", type = "string"},
|
||||||
|
{name = "update_by", type = "string"},
|
||||||
|
}, required = {"role_name"}}
|
||||||
|
}
|
||||||
|
|
||||||
--获取所有角色信息
|
--获取所有角色信息
|
||||||
function _M.get_allrole()
|
function _M.getSystemRoles()
|
||||||
local code,ret = dao.getAllRole()
|
--获取页码和请求的数据量
|
||||||
|
--local args = ngx.req.get_uri_args()
|
||||||
|
local pageNum = ngx.var.pagenum or 1
|
||||||
|
local pageSize = ngx.var.pagesize or 10
|
||||||
|
local code,ret = roleDao.getSystemRoles(pageNum, pageSize)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据角色id获取角色信息
|
--根据角色id获取角色信息
|
||||||
function _M.get_role(m)
|
function _M.getSystemRole(m)
|
||||||
local id = m.id
|
local code,ret = roleDao.getSystemRole(m.id)
|
||||||
local code,ret = dao.getRole(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据角色id获取角色信息
|
--根据角色id获取角色信息
|
||||||
function _M.add_role()
|
function _M.addSystemRole()
|
||||||
--获取请求头并进行校验
|
|
||||||
if validator.checkReqHeader() == false then
|
|
||||||
local result = resp:json(0x000001)
|
|
||||||
resp:send(result)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = dao.addRole(body_data)
|
local code, ret = roleDao.addSystemRole(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据角色id删除角色信息
|
--根据角色id删除角色信息
|
||||||
function _M.delete_role(m)
|
function _M.deleteSystemRole(m)
|
||||||
local id = m.id
|
local code, ret = roleDao.deleteSystemRole(m.id)
|
||||||
local code, ret = dao.deleteRole(id)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据角色id删除角色信息
|
--根据角色id删除角色信息
|
||||||
function _M.update_role(m)
|
function _M.updateSystemRole(m)
|
||||||
local id = m.id
|
|
||||||
--读取请求体的数据
|
--读取请求体的数据
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
--获取请求数据
|
--获取请求数据
|
||||||
local body_data = ngx.req.get_body_data()
|
local body_data = ngx.req.get_body_data()
|
||||||
--判断请求体数据是否为空
|
-- 验证数据是否符合schema
|
||||||
if body_data == nil then
|
local ok, err = jsonschema:generate_validator(body_data, schema)
|
||||||
|
--验证失败则返回
|
||||||
|
if not ok then
|
||||||
local result = resp:json(0x000001)
|
local result = resp:json(0x000001)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local code, ret = dao.updateRole(id, body_data)
|
local code, ret = roleDao.updateSystemRole(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有角色信息
|
|
||||||
function _M.getAllRole()
|
|
||||||
return role:all()
|
|
||||||
end
|
|
||||||
|
|
||||||
--根据角色id获取角色信息
|
|
||||||
function _M.getRole(id)
|
|
||||||
return role.find(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--增加角色信息到数据表
|
|
||||||
function _M.addRole(jsonData)
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--解析json中的键和数据值
|
|
||||||
local name = ""
|
|
||||||
for key, value in pairs(result) do
|
|
||||||
if key == "name" then name = value end
|
|
||||||
end
|
|
||||||
--根据角色进行验证是否存在
|
|
||||||
local code, res = role:where("name", "=", name):get()
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--角色存在时返回账号已经存在
|
|
||||||
if num > 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--键值为id产生uuid数据值,增加到json中
|
|
||||||
result.id = helpers.getUuid()
|
|
||||||
local ret = helpers.convert_json(result)
|
|
||||||
-- 创建一个角色
|
|
||||||
return role:create('{'..ret..'}')
|
|
||||||
end
|
|
||||||
|
|
||||||
--删除角色信息到数据表
|
|
||||||
function _M.deleteRole(id)
|
|
||||||
return role:delete(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
--更新角色信息到数据表
|
|
||||||
function _M.updateRole(id, jsonData)
|
|
||||||
--根据角色id进行验证角色是否存在
|
|
||||||
local code, res = role:find(id)
|
|
||||||
if code ~= 0 then
|
|
||||||
return 0x000001, res
|
|
||||||
end
|
|
||||||
local num = 0
|
|
||||||
for _, row in ipairs(res) do
|
|
||||||
for key, value in pairs(row) do
|
|
||||||
num = num + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--角色不存在返回错误
|
|
||||||
if num <= 0 then
|
|
||||||
return 0x01000C, nil
|
|
||||||
end
|
|
||||||
--验证数据的正确性,错误时返回
|
|
||||||
local success, result = validator.checkJson(jsonData)
|
|
||||||
if success == false then
|
|
||||||
return 0x000001, result
|
|
||||||
end
|
|
||||||
--对数据内容进行更新
|
|
||||||
return role:where('id', '=', id):update(jsonData)
|
|
||||||
end
|
|
||||||
|
|
||||||
return _M
|
return _M
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@ function _M.getSystemUsers()
|
||||||
--local args = ngx.req.get_uri_args()
|
--local args = ngx.req.get_uri_args()
|
||||||
local pageNum = ngx.var.pagenum or 1
|
local pageNum = ngx.var.pagenum or 1
|
||||||
local pageSize = ngx.var.pagesize or 10
|
local pageSize = ngx.var.pagesize or 10
|
||||||
local code,ret = userDao.getAllUser(pageNum, pageSize)
|
local code,ret = userDao.getSystemUsers(pageNum, pageSize)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据用户id获取用户信息
|
--根据用户id获取用户信息
|
||||||
function _M.getSystemUser(m)
|
function _M.getSystemUser(m)
|
||||||
local code,ret = userDao.getUser(m.id)
|
local code,ret = userDao.getSystemUser(m.id)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
@ -56,14 +56,14 @@ function _M.addSystemUser()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--ngx.say(body_data)
|
--ngx.say(body_data)
|
||||||
local code, ret = userDao.addUser(body_data)
|
local code, ret = userDao.addSystemUser(body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据用户id删除用户信息
|
--根据用户id删除用户信息
|
||||||
function _M.deleteSystemUser(m)
|
function _M.deleteSystemUser(m)
|
||||||
local code, ret = userDao.deleteUser(m.id)
|
local code, ret = userDao.deleteSystemUser(m.id)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
@ -83,7 +83,7 @@ function _M.updateSystemUser(m)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--将数据更新到数据表中
|
--将数据更新到数据表中
|
||||||
local code, ret = userDao.updateUser(m.id, body_data)
|
local code, ret = userDao.updateSystemUser(m.id, body_data)
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user