正在显示
12 个修改的文件
包含
193 行增加
和
26 行删除
| @@ -54,7 +54,7 @@ public class IotDeviceControlController { | @@ -54,7 +54,7 @@ public class IotDeviceControlController { | ||
| 54 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 54 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 55 | @ResponseBody | 55 | @ResponseBody |
| 56 | @PostMapping("/firmwareUp/{imei}") | 56 | @PostMapping("/firmwareUp/{imei}") |
| 57 | - public String firmwareUp(HttpServletResponse response,@PathVariable String imei,String firmwareVersion) throws IOException { | 57 | + public String firmwareUp(HttpServletResponse response,@PathVariable String imei,String firmwareVersion,Integer code) throws IOException { |
| 58 | String url = getServiceAdrres(response,imei); | 58 | String url = getServiceAdrres(response,imei); |
| 59 | if(null == url) | 59 | if(null == url) |
| 60 | { | 60 | { |
| @@ -63,11 +63,9 @@ public class IotDeviceControlController { | @@ -63,11 +63,9 @@ public class IotDeviceControlController { | ||
| 63 | Map<String,Object> map = new HashMap<>(); | 63 | Map<String,Object> map = new HashMap<>(); |
| 64 | Map<String,Object> valueMap = new HashMap<>(); | 64 | Map<String,Object> valueMap = new HashMap<>(); |
| 65 | valueMap.put("firmwareVersion",firmwareVersion); | 65 | valueMap.put("firmwareVersion",firmwareVersion); |
| 66 | - map.put("0",valueMap); | ||
| 67 | - Response response1 = HttpUtils.postFromBody(url, builder -> { | ||
| 68 | - | ||
| 69 | - }, formBody -> { | ||
| 70 | - formBody.add("map", JSONObject.toJSONString(map)); | 66 | + valueMap.put("code",code); |
| 67 | + Response response1 = HttpUtils.postJsonBody(url, formBody -> { | ||
| 68 | + formBody.put("0", valueMap); | ||
| 71 | }); | 69 | }); |
| 72 | return response1.body().string(); | 70 | return response1.body().string(); |
| 73 | } | 71 | } |
| @@ -90,11 +88,8 @@ public class IotDeviceControlController { | @@ -90,11 +88,8 @@ public class IotDeviceControlController { | ||
| 90 | Map<String,Object> map = new HashMap<>(); | 88 | Map<String,Object> map = new HashMap<>(); |
| 91 | Map<String,Object> valueMap = new HashMap<>(); | 89 | Map<String,Object> valueMap = new HashMap<>(); |
| 92 | valueMap.put("restart",restart); | 90 | valueMap.put("restart",restart); |
| 93 | - map.put("0",valueMap); | ||
| 94 | - Response response1 = HttpUtils.postFromBody(url, builder -> { | ||
| 95 | - | ||
| 96 | - }, formBody -> { | ||
| 97 | - formBody.add("map", JSONObject.toJSONString(map)); | 91 | + Response response1 = HttpUtils.postJsonBody(url, formBody -> { |
| 92 | + formBody.put("0",valueMap); | ||
| 98 | }); | 93 | }); |
| 99 | return response1.body().string(); | 94 | return response1.body().string(); |
| 100 | } | 95 | } |
| @@ -234,14 +229,10 @@ public class IotDeviceControlController { | @@ -234,14 +229,10 @@ public class IotDeviceControlController { | ||
| 234 | { | 229 | { |
| 235 | return null; | 230 | return null; |
| 236 | } | 231 | } |
| 237 | - Map<String,Object> map = new HashMap<>(); | ||
| 238 | Map<String,Object> valueMap = new HashMap<>(); | 232 | Map<String,Object> valueMap = new HashMap<>(); |
| 239 | valueMap.put("summary",JSONObject.parseObject(summary)); | 233 | valueMap.put("summary",JSONObject.parseObject(summary)); |
| 240 | - map.put("0",valueMap); | ||
| 241 | - Response response1 = HttpUtils.postFromBody(url, builder -> { | ||
| 242 | - | ||
| 243 | - }, formBody -> { | ||
| 244 | - formBody.add("map", JSONObject.toJSONString(map)); | 234 | + Response response1 = HttpUtils.postJsonBody(url,formBody -> { |
| 235 | + formBody.put("0", valueMap); | ||
| 245 | }); | 236 | }); |
| 246 | return response1.body().string(); | 237 | return response1.body().string(); |
| 247 | } | 238 | } |
| @@ -302,10 +293,14 @@ public class IotDeviceControlController { | @@ -302,10 +293,14 @@ public class IotDeviceControlController { | ||
| 302 | { | 293 | { |
| 303 | return null; | 294 | return null; |
| 304 | } | 295 | } |
| 305 | - Response response1 = HttpUtils.postFromBody(url, builder -> { | 296 | + Response response1 = HttpUtils.postJsonBody(url, builder -> { |
| 306 | 297 | ||
| 307 | }, formBody -> { | 298 | }, formBody -> { |
| 308 | - formBody.add("map", JSONObject.toJSONString(map)); | 299 | + for (String key:map.keySet()) |
| 300 | + { | ||
| 301 | + formBody.put(key, map.get(key)); | ||
| 302 | + } | ||
| 303 | + | ||
| 309 | }); | 304 | }); |
| 310 | return response1.body().string(); | 305 | return response1.body().string(); |
| 311 | } | 306 | } |
| @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; | @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; | ||
| 5 | 5 | ||
| 6 | import com.alibaba.fastjson.JSON; | 6 | import com.alibaba.fastjson.JSON; |
| 7 | import com.alibaba.fastjson.JSONObject; | 7 | import com.alibaba.fastjson.JSONObject; |
| 8 | +import com.ruoyi.system.domain.DistributionCurrencyModel; | ||
| 8 | import com.ruoyi.system.domain.IotProduct; | 9 | import com.ruoyi.system.domain.IotProduct; |
| 9 | import com.ruoyi.system.service.IIotProductService; | 10 | import com.ruoyi.system.service.IIotProductService; |
| 10 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | 11 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; |
| @@ -225,4 +226,19 @@ public class IotThingsModelController extends BaseController | @@ -225,4 +226,19 @@ public class IotThingsModelController extends BaseController | ||
| 225 | 226 | ||
| 226 | return toAjax(ri); | 227 | return toAjax(ri); |
| 227 | } | 228 | } |
| 229 | + | ||
| 230 | + @ApiOperation("分配通用模型") | ||
| 231 | + @PreAuthorize("@ss.hasPermi('iot:IotThingsModel:distributionTemplate')") | ||
| 232 | + @Log(title = "物模型模板", businessType = BusinessType.INSERT) | ||
| 233 | + @PostMapping("/distributionTemplate/{product_id}") | ||
| 234 | + public AjaxResult distributionTemplate(@PathVariable Integer product_id,Integer[] tmplatemModel_ids) | ||
| 235 | + { | ||
| 236 | + DistributionCurrencyModel distributionCurrencyModel = new DistributionCurrencyModel(); | ||
| 237 | + IotProduct iotProduct = iIotProductService.selectIotProductById(product_id); | ||
| 238 | + distributionCurrencyModel.setModel_ids(tmplatemModel_ids); | ||
| 239 | + distributionCurrencyModel.setMqtt_username(iotProduct.getMqtt_username()); | ||
| 240 | + distributionCurrencyModel.setProduct_id(iotProduct.getId()); | ||
| 241 | + int ri = iotThingsModelService.distributionIotThingsModelTemplate(distributionCurrencyModel); | ||
| 242 | + return toAjax(ri); | ||
| 243 | + } | ||
| 228 | } | 244 | } |
lh-admin/src/main/java/com/zhonglai/luhui/admin/controller/iot/IotThingsModelTemplateController.java
| 1 | package com.zhonglai.luhui.admin.controller.iot; | 1 | package com.zhonglai.luhui.admin.controller.iot; |
| 2 | 2 | ||
| 3 | +import java.util.Date; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | import javax.servlet.http.HttpServletResponse; | 5 | import javax.servlet.http.HttpServletResponse; |
| 5 | 6 | ||
| 7 | +import com.alibaba.fastjson.JSON; | ||
| 8 | +import com.alibaba.fastjson.JSONObject; | ||
| 9 | +import com.ruoyi.system.domain.IotProduct; | ||
| 10 | +import com.ruoyi.system.domain.IotThingsModel; | ||
| 11 | +import com.ruoyi.system.service.IIotProductService; | ||
| 12 | +import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | ||
| 13 | +import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 14 | +import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | ||
| 6 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
| 7 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
| 8 | import org.springframework.security.access.prepost.PreAuthorize; | 17 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -38,6 +47,9 @@ public class IotThingsModelTemplateController extends BaseController | @@ -38,6 +47,9 @@ public class IotThingsModelTemplateController extends BaseController | ||
| 38 | @Autowired | 47 | @Autowired |
| 39 | private IIotThingsModelTemplateService iotThingsModelTemplateService; | 48 | private IIotThingsModelTemplateService iotThingsModelTemplateService; |
| 40 | 49 | ||
| 50 | + @Autowired | ||
| 51 | + private IIotProductService iIotProductService; | ||
| 52 | + | ||
| 41 | /** | 53 | /** |
| 42 | * 查询物模型模板列表 | 54 | * 查询物模型模板列表 |
| 43 | */ | 55 | */ |
| @@ -83,9 +95,43 @@ public class IotThingsModelTemplateController extends BaseController | @@ -83,9 +95,43 @@ public class IotThingsModelTemplateController extends BaseController | ||
| 83 | @PreAuthorize("@ss.hasPermi('iot:IotThingsModelTemplate:add')") | 95 | @PreAuthorize("@ss.hasPermi('iot:IotThingsModelTemplate:add')") |
| 84 | @Log(title = "物模型模板", businessType = BusinessType.INSERT) | 96 | @Log(title = "物模型模板", businessType = BusinessType.INSERT) |
| 85 | @PostMapping | 97 | @PostMapping |
| 86 | - public AjaxResult add(@RequestBody IotThingsModelTemplate iotThingsModelTemplate) | 98 | + public AjaxResult add(@RequestBody IotThingsModelAddApi iotThingsModelAddApi) |
| 87 | { | 99 | { |
| 88 | - return toAjax(iotThingsModelTemplateService.insertIotThingsModelTemplate(iotThingsModelTemplate)); | 100 | + IotThingsModelTemplate iotThingsModel = JSONObject.parseObject(JSONObject.toJSONString(iotThingsModelAddApi.getIotThingsModel()),IotThingsModelTemplate.class); |
| 101 | + iotThingsModel.setCreate_by(getUsername()); | ||
| 102 | + ThingsModelItemBase thingsModelItemBase = null; | ||
| 103 | + switch (iotThingsModel.getData_type()) | ||
| 104 | + { | ||
| 105 | + case "integer": | ||
| 106 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), IntegerModelOutput.class); | ||
| 107 | + break; | ||
| 108 | + case "decimal": | ||
| 109 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), DecimalModelOutput.class); | ||
| 110 | + break; | ||
| 111 | + case "string": | ||
| 112 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), StringModelOutput.class); | ||
| 113 | + | ||
| 114 | + break; | ||
| 115 | + case "bool": | ||
| 116 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), BoolModelOutput.class); | ||
| 117 | + | ||
| 118 | + break; | ||
| 119 | + case "array": | ||
| 120 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), ArrayModelOutput.class); | ||
| 121 | + | ||
| 122 | + break; | ||
| 123 | + case "enum": | ||
| 124 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), EnumModelOutput.class); | ||
| 125 | + break; | ||
| 126 | + } | ||
| 127 | + if(null == thingsModelItemBase) | ||
| 128 | + { | ||
| 129 | + return AjaxResult.error("请输入数模型"); | ||
| 130 | + } | ||
| 131 | + iotThingsModel.setSpecs(JSONObject.toJSONString(thingsModelItemBase)); | ||
| 132 | + iotThingsModel.setCreate_time(new Date()); | ||
| 133 | + int ri = iotThingsModelTemplateService.insertIotThingsModelTemplate(iotThingsModel); | ||
| 134 | + return toAjax(ri); | ||
| 89 | } | 135 | } |
| 90 | 136 | ||
| 91 | /** | 137 | /** |
| @@ -95,9 +141,43 @@ public class IotThingsModelTemplateController extends BaseController | @@ -95,9 +141,43 @@ public class IotThingsModelTemplateController extends BaseController | ||
| 95 | @PreAuthorize("@ss.hasPermi('iot:IotThingsModelTemplate:edit')") | 141 | @PreAuthorize("@ss.hasPermi('iot:IotThingsModelTemplate:edit')") |
| 96 | @Log(title = "物模型模板", businessType = BusinessType.UPDATE) | 142 | @Log(title = "物模型模板", businessType = BusinessType.UPDATE) |
| 97 | @PutMapping | 143 | @PutMapping |
| 98 | - public AjaxResult edit(@RequestBody IotThingsModelTemplate iotThingsModelTemplate) | 144 | + public AjaxResult edit(@RequestBody IotThingsModelAddApi iotThingsModelAddApi) |
| 99 | { | 145 | { |
| 100 | - return toAjax(iotThingsModelTemplateService.updateIotThingsModelTemplate(iotThingsModelTemplate)); | 146 | + IotThingsModelTemplate iotThingsModel = JSONObject.parseObject(JSONObject.toJSONString(iotThingsModelAddApi.getIotThingsModel()),IotThingsModelTemplate.class); |
| 147 | + iotThingsModel.setCreate_by(getUsername()); | ||
| 148 | + ThingsModelItemBase thingsModelItemBase = null; | ||
| 149 | + switch (iotThingsModel.getData_type()) | ||
| 150 | + { | ||
| 151 | + case "integer": | ||
| 152 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), IntegerModelOutput.class); | ||
| 153 | + break; | ||
| 154 | + case "decimal": | ||
| 155 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), DecimalModelOutput.class); | ||
| 156 | + break; | ||
| 157 | + case "string": | ||
| 158 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), StringModelOutput.class); | ||
| 159 | + | ||
| 160 | + break; | ||
| 161 | + case "bool": | ||
| 162 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), BoolModelOutput.class); | ||
| 163 | + | ||
| 164 | + break; | ||
| 165 | + case "array": | ||
| 166 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), ArrayModelOutput.class); | ||
| 167 | + | ||
| 168 | + break; | ||
| 169 | + case "enum": | ||
| 170 | + thingsModelItemBase = JSONObject.parseObject(JSON.toJSONString(iotThingsModelAddApi.getThingsModelBase()), EnumModelOutput.class); | ||
| 171 | + break; | ||
| 172 | + } | ||
| 173 | + if(null == thingsModelItemBase) | ||
| 174 | + { | ||
| 175 | + return AjaxResult.error("请输入数模型"); | ||
| 176 | + } | ||
| 177 | + iotThingsModel.setSpecs(JSONObject.toJSONString(thingsModelItemBase)); | ||
| 178 | + int ri =iotThingsModelTemplateService.updateIotThingsModelTemplate(iotThingsModel); | ||
| 179 | + | ||
| 180 | + return toAjax(ri); | ||
| 101 | } | 181 | } |
| 102 | 182 | ||
| 103 | /** | 183 | /** |
| @@ -73,6 +73,10 @@ public class BusinessDataUpdateService { | @@ -73,6 +73,10 @@ public class BusinessDataUpdateService { | ||
| 73 | iotDevice.setListen_service_ip(SysParameter.service_ip+":"+port+contextPath); | 73 | iotDevice.setListen_service_ip(SysParameter.service_ip+":"+port+contextPath); |
| 74 | } | 74 | } |
| 75 | logger.info("更新网关数据{}",iotDevice); | 75 | logger.info("更新网关数据{}",iotDevice); |
| 76 | + if(null== iotDevice.getStatus() || 1 == iotDevice.getStatus() || 4==iotDevice.getStatus()) | ||
| 77 | + { | ||
| 78 | + iotDevice.setStatus(3); | ||
| 79 | + } | ||
| 76 | deviceService.updataDevice(iotDevice); | 80 | deviceService.updataDevice(iotDevice); |
| 77 | }else{ //终端 | 81 | }else{ //终端 |
| 78 | IotTerminal iotTerminal = translateTerminal(type,key,olddevice,jsData,isOperLog,operateHisList,list); | 82 | IotTerminal iotTerminal = translateTerminal(type,key,olddevice,jsData,isOperLog,operateHisList,list); |
ruoyi-framework/ruoyi-framework.iml
已删除
100644 → 0
| 1 | +package com.ruoyi.system.domain; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | + | ||
| 6 | +@ApiModel("通用模型分配") | ||
| 7 | +public class DistributionCurrencyModel { | ||
| 8 | + @ApiModelProperty("产品id") | ||
| 9 | + private Integer product_id; | ||
| 10 | + @ApiModelProperty("mqtt用户名/设备类型") | ||
| 11 | + private String mqtt_username; | ||
| 12 | + @ApiModelProperty("模型id集合(多个用英文逗号分割)") | ||
| 13 | + private Integer[] model_ids; | ||
| 14 | + | ||
| 15 | + @ApiModelProperty("模型id集合(多个用英文逗号分割)") | ||
| 16 | + private Integer model_id; | ||
| 17 | + | ||
| 18 | + public Integer getModel_id() { | ||
| 19 | + return model_id; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setModel_id(Integer model_id) { | ||
| 23 | + this.model_id = model_id; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public Integer getProduct_id() { | ||
| 27 | + return product_id; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setProduct_id(Integer product_id) { | ||
| 31 | + this.product_id = product_id; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getMqtt_username() { | ||
| 35 | + return mqtt_username; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setMqtt_username(String mqtt_username) { | ||
| 39 | + this.mqtt_username = mqtt_username; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public Integer[] getModel_ids() { | ||
| 43 | + return model_ids; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setModel_ids(Integer[] model_ids) { | ||
| 47 | + this.model_ids = model_ids; | ||
| 48 | + } | ||
| 49 | +} |
| 1 | package com.ruoyi.system.mapper; | 1 | package com.ruoyi.system.mapper; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.system.domain.DistributionCurrencyModel; | ||
| 4 | import com.ruoyi.system.domain.IotThingsModel; | 6 | import com.ruoyi.system.domain.IotThingsModel; |
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| @@ -58,4 +60,6 @@ public interface IotThingsModelMapper | @@ -58,4 +60,6 @@ public interface IotThingsModelMapper | ||
| 58 | * @return 结果 | 60 | * @return 结果 |
| 59 | */ | 61 | */ |
| 60 | public int deleteIotThingsModelByModel_ids(Integer[] model_ids); | 62 | public int deleteIotThingsModelByModel_ids(Integer[] model_ids); |
| 63 | + | ||
| 64 | + int distributionIotThingsModelTemplate(DistributionCurrencyModel distributionCurrencyModel); | ||
| 61 | } | 65 | } |
| 1 | package com.ruoyi.system.service; | 1 | package com.ruoyi.system.service; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.system.domain.DistributionCurrencyModel; | ||
| 4 | import com.ruoyi.system.domain.IotThingsModel; | 6 | import com.ruoyi.system.domain.IotThingsModel; |
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| @@ -60,4 +62,6 @@ public interface IIotThingsModelService | @@ -60,4 +62,6 @@ public interface IIotThingsModelService | ||
| 60 | public int deleteIotThingsModelByModel_id(Integer model_id); | 62 | public int deleteIotThingsModelByModel_id(Integer model_id); |
| 61 | 63 | ||
| 62 | List<IotThingsModel> selectIotThingsModelListByIds(Integer[] model_ids); | 64 | List<IotThingsModel> selectIotThingsModelListByIds(Integer[] model_ids); |
| 65 | + | ||
| 66 | + int distributionIotThingsModelTemplate(DistributionCurrencyModel distributionCurrencyModel); | ||
| 63 | } | 67 | } |
| 1 | package com.ruoyi.system.service; | 1 | package com.ruoyi.system.service; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.system.domain.DistributionCurrencyModel; | ||
| 4 | import com.ruoyi.system.domain.IotThingsModelTemplate; | 6 | import com.ruoyi.system.domain.IotThingsModelTemplate; |
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| 1 | package com.ruoyi.system.service.impl; | 1 | package com.ruoyi.system.service.impl; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.system.domain.DistributionCurrencyModel; | ||
| 4 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 6 | import com.ruoyi.system.mapper.IotThingsModelMapper; | 8 | import com.ruoyi.system.mapper.IotThingsModelMapper; |
| @@ -95,4 +97,9 @@ public class IotThingsModelServiceImpl implements IIotThingsModelService | @@ -95,4 +97,9 @@ public class IotThingsModelServiceImpl implements IIotThingsModelService | ||
| 95 | public List<IotThingsModel> selectIotThingsModelListByIds(Integer[] model_ids) { | 97 | public List<IotThingsModel> selectIotThingsModelListByIds(Integer[] model_ids) { |
| 96 | return iotThingsModelMapper.selectIotThingsModelListByIds(model_ids); | 98 | return iotThingsModelMapper.selectIotThingsModelListByIds(model_ids); |
| 97 | } | 99 | } |
| 100 | + | ||
| 101 | + @Override | ||
| 102 | + public int distributionIotThingsModelTemplate(DistributionCurrencyModel distributionCurrencyModel) { | ||
| 103 | + return iotThingsModelMapper.distributionIotThingsModelTemplate(distributionCurrencyModel); | ||
| 104 | + } | ||
| 98 | } | 105 | } |
| @@ -169,4 +169,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -169,4 +169,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 169 | #{model_id} | 169 | #{model_id} |
| 170 | </foreach> | 170 | </foreach> |
| 171 | </delete> | 171 | </delete> |
| 172 | + | ||
| 173 | + <insert id="distributionIotThingsModelTemplate" parameterType="DistributionCurrencyModel"> | ||
| 174 | + INSERT INTO `iot_things_model`(`model_name`,`identifier`,`type`,`data_type`,`specs`,`is_top`,`is_monitor`,`del_flag`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`,`product_id`,`mqtt_username`,`is_save_log`,`is_config`,`config_names`,`view_type`,`ascription`) SELECT `model_name`,`identifier`,`type`,`data_type`,`specs`,`is_top`,`is_monitor`,`del_flag`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`,#{product_id,jdbcType=INTEGER} `product_id`,#{mqtt_username,jdbcType=VARCHAR} `mqtt_username`,`is_save_log`,`is_config`,`config_names`,`view_type`,`ascription` FROM `iot_things_model_template` WHERE `model_id` IN | ||
| 175 | + <foreach item="model_id" collection="model_ids" open="(" separator="," close=")"> | ||
| 176 | + #{model_id} | ||
| 177 | + </foreach> | ||
| 178 | + </insert> | ||
| 172 | </mapper> | 179 | </mapper> |
| @@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 110 | <if test="product_id != null">product_id = #{product_id},</if> | 110 | <if test="product_id != null">product_id = #{product_id},</if> |
| 111 | <if test="remark != null">remark = #{remark},</if> | 111 | <if test="remark != null">remark = #{remark},</if> |
| 112 | <if test="specs != null">specs = #{specs},</if> | 112 | <if test="specs != null">specs = #{specs},</if> |
| 113 | - <if test="type != null">type = #{type},</if> | 113 | + <if test="type != null">`type` = #{type},</if> |
| 114 | <if test="update_by != null">update_by = #{update_by},</if> | 114 | <if test="update_by != null">update_by = #{update_by},</if> |
| 115 | <if test="update_time != null">update_time = #{update_time},</if> | 115 | <if test="update_time != null">update_time = #{update_time},</if> |
| 116 | <if test="view_type != null">view_type = #{view_type},</if> | 116 | <if test="view_type != null">view_type = #{view_type},</if> |
| @@ -128,4 +128,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -128,4 +128,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 128 | #{model_id} | 128 | #{model_id} |
| 129 | </foreach> | 129 | </foreach> |
| 130 | </delete> | 130 | </delete> |
| 131 | + | ||
| 131 | </mapper> | 132 | </mapper> |
-
请 注册 或 登录 后发表评论