CreateAll

   model name
This commit is contained in:
snoop 2017-06-09 19:29:45 +09:00
parent c17df5786a
commit 73addbda91
3 changed files with 24 additions and 3 deletions

View File

@ -26,7 +26,7 @@ func NewSensorItemService() *SensorItemService {
}
func (sis *SensorItemService) Create(si *SensorItem) (string, error) {
out, err := utils.InvokeDB("sensorItem", "create", si)
out, err := utils.InvokeDBByModel("sensorItem", "create", si, "com.loafle.overflow.sensor.model.SensorItem")
if err != nil {
return "", err

View File

@ -21,7 +21,7 @@ func NewSensorItemCategoryService() *SensorItemCategoryService {
}
func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error) {
out, err := utils.InvokeDB("sensorItemCategory", "create", sic)
out, err := utils.InvokeDBByModel("sensorItemCategory", "create", sic, "com.loafle.overflow.sensor.model.SensorItemCategory")
if err != nil {
return "", err

View File

@ -23,7 +23,7 @@ func NewSensorItemMappingService() *SensorItemMappingService {
}
func (sims *SensorItemMappingService) Create(sim *SensorItemMapping) (string, error) {
out, err := utils.InvokeDB("sensorItemMapping", "create", sim)
out, err := utils.InvokeDBByModel("sensorItemMapping", "create", sim, "com.loafle.overflow.sensor.model.SensorItemMapping")
if err != nil {
return "", err
@ -31,6 +31,27 @@ func (sims *SensorItemMappingService) Create(sim *SensorItemMapping) (string, er
return out, nil
}
func (sims *SensorItemMappingService) CreateAll(siml *[]*SensorItemMapping) (string, error) {
outlist := make([]string, 0)
for _, sim := range *siml {
out,err := sims.Create(sim)
if err != nil {
return "", err
}
outlist = append(outlist, out)
}
bytes,err := json.Marshal(outlist)
if err != nil {
return "", err
}
return string(bytes), nil
}
func (ss *SensorItemMappingService) List(s *sensor.Sensor) (string, error) {
out, err := utils.InvokeDBByModel("sensorItemMapping", "findAllBySensorId", s, "com.loafle.overflow.sensor.model.Sensor")