...
|
...
|
@@ -15,7 +15,7 @@ type DeviceController struct { |
|
|
func (controller *DeviceController) CreateDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
createDeviceCommand := &command.CreateDeviceCommand{}
|
|
|
controller.Unmarshal(createDeviceCommand)
|
|
|
Must(controller.Unmarshal(createDeviceCommand))
|
|
|
data, err := deviceService.CreateDevice(ParseOperateInfo(controller.BaseController), createDeviceCommand)
|
|
|
controller.Response(data, err)
|
|
|
}
|
...
|
...
|
@@ -23,7 +23,7 @@ func (controller *DeviceController) CreateDevice() { |
|
|
func (controller *DeviceController) UpdateDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
updateDeviceCommand := &command.UpdateDeviceCommand{}
|
|
|
controller.Unmarshal(updateDeviceCommand)
|
|
|
Must(controller.Unmarshal(updateDeviceCommand))
|
|
|
deviceId, _ := controller.GetInt(":deviceId")
|
|
|
updateDeviceCommand.DeviceId = deviceId
|
|
|
data, err := deviceService.UpdateDevice(updateDeviceCommand)
|
...
|
...
|
@@ -42,13 +42,21 @@ func (controller *DeviceController) GetDevice() { |
|
|
func (controller *DeviceController) RemoveDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
removeDeviceCommand := &command.RemoveDeviceCommand{}
|
|
|
controller.Unmarshal(removeDeviceCommand)
|
|
|
Must(controller.Unmarshal(removeDeviceCommand))
|
|
|
deviceId, _ := controller.GetInt(":deviceId")
|
|
|
removeDeviceCommand.DeviceId = deviceId
|
|
|
data, err := deviceService.RemoveDevice(removeDeviceCommand)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *DeviceController) BatchRemoveDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
removeDeviceCommand := &command.BatchRemoveDeviceCommand{}
|
|
|
Must(controller.Unmarshal(removeDeviceCommand))
|
|
|
data, err := deviceService.BatchRemoveDevice(removeDeviceCommand)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *DeviceController) ListDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
listDeviceQuery := &query.ListDeviceQuery{}
|
...
|
...
|
@@ -63,7 +71,7 @@ func (controller *DeviceController) ListDevice() { |
|
|
func (controller *DeviceController) SearchDevice() {
|
|
|
deviceService := service.NewDeviceService(nil)
|
|
|
listDeviceQuery := &query.SearchDeviceQuery{}
|
|
|
controller.Unmarshal(listDeviceQuery)
|
|
|
Must(controller.Unmarshal(listDeviceQuery))
|
|
|
total, data, err := deviceService.SearchDevice(ParseOperateInfo(controller.BaseController), listDeviceQuery)
|
|
|
ResponseGrid(controller.BaseController, total, data, err)
|
|
|
}
|
...
|
...
|
|