| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- require("app.app")
- local fwutils_config = require("fwutils.config")
- local develop_template = require("fwutils.develop.function.template")
- local M = {}
- M.get_by_id = function()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- succ(develop_template.get_by_id(pint("id"),conn))
- end
- M.add = function()
- local data = pjson()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- if develop_template.add(data,conn) then
- succ({})
- else
- error("")
- end
- end
- M.update = function()
- local data = pjson()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- if develop_template.update(data,conn) then
- succ({})
- else
- error("")
- end
- end
- M.delete = function()
- local data = pjson()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- if develop_template.delete(data.id,conn) then
- succ({})
- else
- error("")
- end
- end
- M.list = function()
- local data = pjson()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- local d = develop_template.list(data.search,data.limit,conn)
- succ(d)
- end
- M.refresh = function()
- local conn = mysql.new(_G[fwutils_config.db.mysql_pool_name]):get()
- develop_template.make_bytecode(conn)
- succ({})
- end
- M.exec = function()
- exec({
- get_by_id = M.get_by_id,
- list = M.list,
- add = M.add,
- update = M.update,
- delete = M.delete,
- refresh = M.refresh,
- })
- end
- return M
|