sensor etc added

This commit is contained in:
geek 2017-06-09 16:28:21 +09:00
parent aefe450b95
commit 674c5dcedb
4 changed files with 35 additions and 48 deletions

View File

@ -8,10 +8,10 @@ import (
)
type Sensor struct {
Id json.Number `json:"id,Number,omitempty"`
Target target.Target `json:"target,omitempty"`
Notification string `json:"notification,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
Id json.Number `json:"id,Number,omitempty"`
Target target.Target `json:"target,omitempty"`
Notification string `json:"notification,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorService struct {
@ -30,9 +30,7 @@ func (ss *SensorService) Create(s *Sensor) (string, error) {
return out, nil
}
func (ss *SensorService)List(t *target.Target) (string, error) {
func (ss *SensorService) List(t *target.Target) (string, error) {
out, err := utils.InvokeDBByModel("sensor", "findAllByTargetId", t, "com.loafle.overflow.target.model.Target")
@ -40,7 +38,6 @@ func (ss *SensorService)List(t *target.Target) (string, error) {
return "", err
}
return out, nil;
return out, nil
}

View File

@ -2,32 +2,31 @@ package sensorItem
import (
"encoding/json"
"github.com/golang/protobuf/ptypes/timestamp"
"git.loafle.net/overflow/crawler_go"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItemCategory"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
"git.loafle.net/overflow/overflow_proxy_service/proxy/target"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
"github.com/golang/protobuf/ptypes/timestamp"
)
type SensorItem struct {
Id json.Number `json:"id,Number,omitempty"`
Crawler crawler.Crawler `json:"crawler,omitempty"`
SensorItemCategory sensorItemCategory.SensorItemCategory `json:"sensorItemCategory,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DataType string `json:"dataType,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
Id json.Number `json:"id,Number,omitempty"`
Crawler crawler.Crawler `json:"crawler,omitempty"`
SensorItemCategory sensorItemCategory.SensorItemCategory `json:"sensorItemCategory,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DataType string `json:"dataType,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemService struct {
}
func NewSensorItemService() (*SensorItemService) {
func NewSensorItemService() *SensorItemService {
return &SensorItemService{}
}
func (sis *SensorItemService) Create(si *SensorItem) (string, error){
func (sis *SensorItemService) Create(si *SensorItem) (string, error) {
out, err := utils.InvokeDB("sensorItem", "create", si)
if err != nil {
@ -36,9 +35,7 @@ func (sis *SensorItemService) Create(si *SensorItem) (string, error){
return out, nil
}
func (ss *SensorItemService)List(cr *crawler.Crawler) (string, error) {
func (ss *SensorItemService) List(cr *crawler.Crawler) (string, error) {
out, err := utils.InvokeDBByModel("sensorItem", "findAllByCrawlerId", cr, "com.loafle.overflow.crawler.model.Crawler")
@ -46,7 +43,6 @@ func (ss *SensorItemService)List(cr *crawler.Crawler) (string, error) {
return "", err
}
return out, nil
return out, nil;
}
}

View File

@ -7,26 +7,24 @@ import (
)
type SensorItemCategory struct {
Id json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
Id json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemCategoryService struct {
}
func NewSensorItemCategoryService () (*SensorItemCategoryService ) {
func NewSensorItemCategoryService() *SensorItemCategoryService {
return &SensorItemCategoryService{}
}
func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error){
func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error) {
out, err := utils.InvokeDB("sensorItemCategory", "create", sic)
if err != nil {
return "", err
}
return out, nil
}
}

View File

@ -9,17 +9,16 @@ import (
)
type SensorItemMapping struct {
Id json.Number `json:"id,Number,omitempty"`
Sensor sensor.Sensor `json:"sensor,omitempty"`
SensorItem sensorItem.SensorItem `json:"sensorItem,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
Id json.Number `json:"id,Number,omitempty"`
Sensor sensor.Sensor `json:"sensor,omitempty"`
SensorItem sensorItem.SensorItem `json:"sensorItem,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemMappingService struct {
}
func NewSensorItemMappingService() (*SensorItemMappingService) {
func NewSensorItemMappingService() *SensorItemMappingService {
return &SensorItemMappingService{}
}
@ -32,9 +31,7 @@ func (sims *SensorItemMappingService) Create(sim *SensorItemMapping) (string, er
return out, nil
}
func (ss *SensorItemMappingService)List(s *sensor.Sensor) (string, error) {
func (ss *SensorItemMappingService) List(s *sensor.Sensor) (string, error) {
out, err := utils.InvokeDBByModel("sensorItemMapping", "findAllBySensorId", s, "com.loafle.overflow.sensor.model.Sensor")
@ -42,7 +39,6 @@ func (ss *SensorItemMappingService)List(s *sensor.Sensor) (string, error) {
return "", err
}
return out, nil
return out, nil;
}
}