修改bug。新增牛只,超链接
This commit is contained in:
191
backend/routes/cattle-type.js
Normal file
191
backend/routes/cattle-type.js
Normal file
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* 牛只类型路由
|
||||
* 处理cattle_type表相关的API请求
|
||||
*/
|
||||
|
||||
const express = require('express')
|
||||
const router = express.Router()
|
||||
const cattleTypeController = require('../controllers/cattleTypeController')
|
||||
const { requirePermission } = require('../middleware/permission')
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-type:
|
||||
* get:
|
||||
* summary: 获取所有牛只类型
|
||||
* tags: [CattleType]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* data:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: integer
|
||||
* name:
|
||||
* type: string
|
||||
* description:
|
||||
* type: string
|
||||
* created_at:
|
||||
* type: string
|
||||
* updated_at:
|
||||
* type: string
|
||||
* message:
|
||||
* type: string
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/',
|
||||
// requirePermission('cattle:archives:view'), // 临时注释掉认证
|
||||
cattleTypeController.getAllTypes
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-type/{id}:
|
||||
* get:
|
||||
* summary: 根据ID获取牛只类型
|
||||
* tags: [CattleType]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只类型ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* 404:
|
||||
* description: 牛只类型不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/:id',
|
||||
requirePermission('cattle:archives:view'),
|
||||
cattleTypeController.getTypeById
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-type:
|
||||
* post:
|
||||
* summary: 创建牛只类型
|
||||
* tags: [CattleType]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: 类型名称
|
||||
* description:
|
||||
* type: string
|
||||
* description: 类型描述
|
||||
* responses:
|
||||
* 201:
|
||||
* description: 创建成功
|
||||
* 400:
|
||||
* description: 请求参数错误
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.post('/',
|
||||
requirePermission('cattle:archives:create'),
|
||||
cattleTypeController.createType
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-type/{id}:
|
||||
* put:
|
||||
* summary: 更新牛只类型
|
||||
* tags: [CattleType]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只类型ID
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: 类型名称
|
||||
* description:
|
||||
* type: string
|
||||
* description: 类型描述
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 更新成功
|
||||
* 400:
|
||||
* description: 请求参数错误
|
||||
* 404:
|
||||
* description: 牛只类型不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.put('/:id',
|
||||
requirePermission('cattle:archives:update'),
|
||||
cattleTypeController.updateType
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-type/{id}:
|
||||
* delete:
|
||||
* summary: 删除牛只类型
|
||||
* tags: [CattleType]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只类型ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 删除成功
|
||||
* 404:
|
||||
* description: 牛只类型不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.delete('/:id',
|
||||
requirePermission('cattle:archives:delete'),
|
||||
cattleTypeController.deleteType
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
191
backend/routes/cattle-user.js
Normal file
191
backend/routes/cattle-user.js
Normal file
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* 牛只用途路由
|
||||
* 处理cattle_user表相关的API请求
|
||||
*/
|
||||
|
||||
const express = require('express')
|
||||
const router = express.Router()
|
||||
const cattleUserController = require('../controllers/cattleUserController')
|
||||
const { requirePermission } = require('../middleware/permission')
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-user:
|
||||
* get:
|
||||
* summary: 获取所有牛只用途
|
||||
* tags: [CattleUser]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* data:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: integer
|
||||
* name:
|
||||
* type: string
|
||||
* description:
|
||||
* type: string
|
||||
* created_at:
|
||||
* type: string
|
||||
* updated_at:
|
||||
* type: string
|
||||
* message:
|
||||
* type: string
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/',
|
||||
// requirePermission('cattle:archives:view'), // 临时注释掉认证
|
||||
cattleUserController.getAllUsers
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-user/{id}:
|
||||
* get:
|
||||
* summary: 根据ID获取牛只用途
|
||||
* tags: [CattleUser]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只用途ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* 404:
|
||||
* description: 牛只用途不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/:id',
|
||||
requirePermission('cattle:archives:view'),
|
||||
cattleUserController.getUserById
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-user:
|
||||
* post:
|
||||
* summary: 创建牛只用途
|
||||
* tags: [CattleUser]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: 用途名称
|
||||
* description:
|
||||
* type: string
|
||||
* description: 用途描述
|
||||
* responses:
|
||||
* 201:
|
||||
* description: 创建成功
|
||||
* 400:
|
||||
* description: 请求参数错误
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.post('/',
|
||||
requirePermission('cattle:archives:create'),
|
||||
cattleUserController.createUser
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-user/{id}:
|
||||
* put:
|
||||
* summary: 更新牛只用途
|
||||
* tags: [CattleUser]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只用途ID
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: 用途名称
|
||||
* description:
|
||||
* type: string
|
||||
* description: 用途描述
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 更新成功
|
||||
* 400:
|
||||
* description: 请求参数错误
|
||||
* 404:
|
||||
* description: 牛只用途不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.put('/:id',
|
||||
requirePermission('cattle:archives:update'),
|
||||
cattleUserController.updateUser
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/cattle-user/{id}:
|
||||
* delete:
|
||||
* summary: 删除牛只用途
|
||||
* tags: [CattleUser]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 牛只用途ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 删除成功
|
||||
* 404:
|
||||
* description: 牛只用途不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.delete('/:id',
|
||||
requirePermission('cattle:archives:delete'),
|
||||
cattleUserController.deleteUser
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
200
backend/routes/iot-jbq-client.js
Normal file
200
backend/routes/iot-jbq-client.js
Normal file
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* 智能耳标客户端路由
|
||||
* 处理iot_jbq_client表相关的API请求
|
||||
*/
|
||||
|
||||
const express = require('express')
|
||||
const router = express.Router()
|
||||
const iotJbqClientController = require('../controllers/iotJbqClientController')
|
||||
const { requirePermission } = require('../middleware/permission')
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/iot-jbq-client:
|
||||
* get:
|
||||
* summary: 获取所有智能耳标设备
|
||||
* tags: [IotJbqClient]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: cid
|
||||
* schema:
|
||||
* type: string
|
||||
* description: 设备CID
|
||||
* - in: query
|
||||
* name: page
|
||||
* schema:
|
||||
* type: integer
|
||||
* default: 1
|
||||
* description: 页码
|
||||
* - in: query
|
||||
* name: pageSize
|
||||
* schema:
|
||||
* type: integer
|
||||
* default: 10
|
||||
* description: 每页数量
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* data:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* pagination:
|
||||
* type: object
|
||||
* properties:
|
||||
* current:
|
||||
* type: integer
|
||||
* pageSize:
|
||||
* type: integer
|
||||
* total:
|
||||
* type: integer
|
||||
* message:
|
||||
* type: string
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/',
|
||||
// requirePermission('smart_eartag:view'), // 临时注释掉认证
|
||||
iotJbqClientController.getAllClients
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/iot-jbq-client/cid/{cid}:
|
||||
* get:
|
||||
* summary: 根据CID获取智能耳标设备
|
||||
* tags: [IotJbqClient]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: cid
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* description: 设备CID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* 404:
|
||||
* description: 设备不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/cid/:cid',
|
||||
// requirePermission('smart_eartag:view'), // 临时注释掉认证
|
||||
iotJbqClientController.getClientByCid
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/iot-jbq-client/{id}:
|
||||
* get:
|
||||
* summary: 根据ID获取智能耳标设备
|
||||
* tags: [IotJbqClient]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 设备ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 获取成功
|
||||
* 404:
|
||||
* description: 设备不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.get('/:id',
|
||||
// requirePermission('smart_eartag:view'), // 临时注释掉认证
|
||||
iotJbqClientController.getClientById
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/iot-jbq-client/{id}:
|
||||
* put:
|
||||
* summary: 更新智能耳标设备
|
||||
* tags: [IotJbqClient]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 设备ID
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* bandge_status:
|
||||
* type: integer
|
||||
* description: 绑定状态
|
||||
* bound_cattle_id:
|
||||
* type: integer
|
||||
* description: 绑定的牛只ID
|
||||
* bound_ear_number:
|
||||
* type: string
|
||||
* description: 绑定的耳标号
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 更新成功
|
||||
* 400:
|
||||
* description: 请求参数错误
|
||||
* 404:
|
||||
* description: 设备不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.put('/:id',
|
||||
// requirePermission('smart_eartag:update'), // 临时注释掉认证
|
||||
iotJbqClientController.updateClient
|
||||
)
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/iot-jbq-client/{id}:
|
||||
* delete:
|
||||
* summary: 删除智能耳标设备
|
||||
* tags: [IotJbqClient]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 设备ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 删除成功
|
||||
* 404:
|
||||
* description: 设备不存在
|
||||
* 500:
|
||||
* description: 服务器错误
|
||||
*/
|
||||
router.delete('/:id',
|
||||
// requirePermission('smart_eartag:delete'), // 临时注释掉认证
|
||||
iotJbqClientController.deleteClient
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user