|
|
@ -1,4 +1,8 @@ |
|
|
|
const { getAllFactory } = require("../service/factory.service"); |
|
|
|
const { |
|
|
|
getAllFactory, |
|
|
|
addFactory, |
|
|
|
deleteFactoryById, |
|
|
|
} = require("../service/factory.service"); |
|
|
|
const Response = require("../utils/response"); |
|
|
|
|
|
|
|
class FactoryController { |
|
|
@ -6,6 +10,18 @@ class FactoryController { |
|
|
|
const res = await getAllFactory(); |
|
|
|
ctx.body = Response(0, "获取鸡苗厂家成功", res); |
|
|
|
} |
|
|
|
|
|
|
|
async add(ctx, next) { |
|
|
|
const { factory_name, factory_address } = ctx.request.body; |
|
|
|
const res = await addFactory(factory_name, factory_address); |
|
|
|
ctx.body = Response(0, "添加鸡苗厂家成功", res); |
|
|
|
} |
|
|
|
|
|
|
|
async deleteItem(ctx, next) { |
|
|
|
const { id } = ctx.request.body; |
|
|
|
const res = await deleteFactoryById(id); |
|
|
|
ctx.body = Response(0, "删除鸡苗厂家成功", res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = new FactoryController(); |