--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by . --- DateTime: 2025/9/27 16:02 --- 业务逻辑 对应用数据表进行数据表业务处理 local resp = require("util.response") local applicationDao = require("dao.application") local validatorJson = require("validator.system.application") local _M = {} --获取所有应用程序信息 function _M.getSystemApplications() --获取页码和请求的数据量 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) resp:send(result) end --根据应用id获取应用信息 function _M.getSystemApplication(m) local code,ret = applicationDao.getSystemApplication(m.id) local result = resp:json(code, ret) resp:send(result) end --根据组织id获取应用信息 function _M.getOrganizationApplication(m) local code,ret = applicationDao.getOrganizationApplication(m.id) local result = resp:json(code, ret) resp:send(result) end --根据用户id获取应用的信息 function _M.getUserApplication(m) local code,ret = applicationDao.getUserApplication(m.id) local result = resp:json(code, ret) resp:send(result) end --根据应用id获取应用信息 function _M.addSystemApplication() --读取请求体的数据 ngx.req.read_body() --获取请求数据 local body_data = ngx.req.get_body_data() -- 验证数据是否符合schema local ok = validatorJson.validatorJson(body_data) --验证失败则返回 if not ok then local result = resp:json(0x000001) resp:send(result) return end --ngx.say(body_data) local code, ret = applicationDao.addApplication(body_data) local result = resp:json(code, ret) resp:send(result) end --根据应用id删除应用信息 function _M.deleteSystemApplication(m) local code, ret = applicationDao.deleteApplication(m.id) local result = resp:json(code, ret) resp:send(result) end --根据应用id删除应用信息 function _M.updateSystemApplication(m) --读取请求体的数据 ngx.req.read_body() --获取请求数据 local body_data = ngx.req.get_body_data() -- 验证数据是否符合schema local ok = validatorJson.validatorJson(body_data) --验证失败则返回 if not ok then local result = resp:json(0x000001) resp:send(result) return end local code, ret = applicationDao.updateSystemApplication(m.id, body_data) local result = resp:json(code, ret) resp:send(result) end return _M