正在显示
4 个修改的文件
包含
187 行增加
和
1 行删除
| @@ -16,10 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -16,10 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 16 | <result property="mqtt_username" column="mqtt_username" /> | 16 | <result property="mqtt_username" column="mqtt_username" /> |
| 17 | <result property="product_name" column="product_name" /> | 17 | <result property="product_name" column="product_name" /> |
| 18 | 18 | ||
| 19 | + <result property="is_sync_db" column="is_sync_db" /> | ||
| 20 | + <result property="sync_db" column="sync_db" /> | ||
| 21 | + <result property="analysis_clas" column="analysis_clas" /> | ||
| 22 | + <result property="purification_clas" column="purification_clas" /> | ||
| 19 | </resultMap> | 23 | </resultMap> |
| 20 | 24 | ||
| 21 | <sql id="selectIotProductVo"> | 25 | <sql id="selectIotProductVo"> |
| 22 | - select `id`,`mqtt_username`,`mqtt_password`,`product_name`,`mqtt_salt`,`create_time`,`encryption_type`,`open_encryption`,`used`,`role_id` from iot_product | 26 | + select `id`,`mqtt_username`,`mqtt_password`,`product_name`,`mqtt_salt`,`create_time`,`encryption_type`,`open_encryption`,`used`,`role_id`,`is_sync_db`,`sync_db`,`analysis_clas`,`purification_clas` from iot_product |
| 23 | </sql> | 27 | </sql> |
| 24 | 28 | ||
| 25 | <select id="selectIotProductList" parameterType="IotProduct" resultMap="IotProductResult"> | 29 | <select id="selectIotProductList" parameterType="IotProduct" resultMap="IotProductResult"> |
| @@ -53,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -53,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 53 | <if test="used != null">used,</if> | 57 | <if test="used != null">used,</if> |
| 54 | <if test="mqtt_username != null and mqtt_username != ''">mqtt_username,</if> | 58 | <if test="mqtt_username != null and mqtt_username != ''">mqtt_username,</if> |
| 55 | <if test="product_name != null and product_name != ''">product_name,</if> | 59 | <if test="product_name != null and product_name != ''">product_name,</if> |
| 60 | + <if test="is_sync_db != null ">is_sync_db,</if> | ||
| 61 | + <if test="sync_db != null ">sync_db,</if> | ||
| 62 | + <if test="analysis_clas != null">analysis_clas,</if> | ||
| 63 | + <if test="purification_clas != null ">purification_clas,</if> | ||
| 56 | create_time, | 64 | create_time, |
| 57 | </trim> | 65 | </trim> |
| 58 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 66 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| @@ -65,6 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -65,6 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 65 | <if test="used != null">#{used},</if> | 73 | <if test="used != null">#{used},</if> |
| 66 | <if test="mqtt_username != null and mqtt_username != ''">#{mqtt_username},</if> | 74 | <if test="mqtt_username != null and mqtt_username != ''">#{mqtt_username},</if> |
| 67 | <if test="product_name != null and product_name != ''">#{product_name},</if> | 75 | <if test="product_name != null and product_name != ''">#{product_name},</if> |
| 76 | + <if test="is_sync_db != null">#{is_sync_db},</if> | ||
| 77 | + <if test="sync_db != null">#{sync_db},</if> | ||
| 78 | + <if test="analysis_clas != null">#{analysis_clas},</if> | ||
| 79 | + <if test="purification_clas != null">#{purification_clas},</if> | ||
| 68 | UNIX_TIMESTAMP(NOW()), | 80 | UNIX_TIMESTAMP(NOW()), |
| 69 | </trim> | 81 | </trim> |
| 70 | </insert> | 82 | </insert> |
| @@ -81,6 +93,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -81,6 +93,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 81 | <if test="used != null">used = #{used},</if> | 93 | <if test="used != null">used = #{used},</if> |
| 82 | <if test="mqtt_username != null and mqtt_username != ''">mqtt_username = #{mqtt_username},</if> | 94 | <if test="mqtt_username != null and mqtt_username != ''">mqtt_username = #{mqtt_username},</if> |
| 83 | <if test="product_name != null and product_name != ''">product_name = #{product_name},</if> | 95 | <if test="product_name != null and product_name != ''">product_name = #{product_name},</if> |
| 96 | + <if test="role_id != null">is_sync_db = #{is_sync_db},</if> | ||
| 97 | + <if test="role_id != null">role_id = #{sync_db},</if> | ||
| 98 | + <if test="role_id != null">analysis_clas = #{analysis_clas},</if> | ||
| 99 | + <if test="role_id != null">purification_clas = #{purification_clas},</if> | ||
| 84 | </trim> | 100 | </trim> |
| 85 | where id = #{id} | 101 | where id = #{id} |
| 86 | </update> | 102 | </update> |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE mapper | ||
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | +<mapper namespace="com.zhonglai.luhui.device.mapper.IotProtocolClassMapper"> | ||
| 6 | + | ||
| 7 | + <resultMap type="IotProtocolClass" id="IotProtocolClassResult"> | ||
| 8 | + <result property="id" column="id" /> | ||
| 9 | + <result property="type" column="type" /> | ||
| 10 | + <result property="name" column="name" /> | ||
| 11 | + <result property="case_model" column="case_model" /> | ||
| 12 | + <result property="classname" column="classname" /> | ||
| 13 | + <result property="create_time" column="create_time" /> | ||
| 14 | + </resultMap> | ||
| 15 | + | ||
| 16 | + <sql id="selectIotProtocolClassVo"> | ||
| 17 | + select `id`, `type`, `name`, `case_model`, `classname`, `create_time` from iot_protocol_class | ||
| 18 | + </sql> | ||
| 19 | + | ||
| 20 | + <select id="selectIotProtocolClassList" parameterType="IotProtocolClass" resultMap="IotProtocolClassResult"> | ||
| 21 | + <include refid="selectIotProtocolClassVo"/> | ||
| 22 | + <where> | ||
| 23 | + <if test="id != null "> and id = #{id}</if> | ||
| 24 | + <if test="type != null "> and type = #{type}</if> | ||
| 25 | + <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | ||
| 26 | + <if test="classname != null and classname != ''"> and classname like concat('%', #{classname}, '%')</if> | ||
| 27 | + </where> | ||
| 28 | + </select> | ||
| 29 | + | ||
| 30 | + <select id="selectIotProtocolClassById" parameterType="Integer" resultMap="IotProtocolClassResult"> | ||
| 31 | + <include refid="selectIotProtocolClassVo"/> | ||
| 32 | + where id = #{id} | ||
| 33 | + </select> | ||
| 34 | + | ||
| 35 | + <insert id="insertIotProtocolClass" parameterType="IotProtocolClass" useGeneratedKeys="true" keyProperty="id"> | ||
| 36 | + insert into iot_protocol_class | ||
| 37 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
| 38 | + <if test="type != null">`type`,</if> | ||
| 39 | + <if test="name != null">`name`,</if> | ||
| 40 | + <if test="case_model != null">`case_model`,</if> | ||
| 41 | + <if test="classname != null">`classname`,</if> | ||
| 42 | + <if test="create_time != null">`create_time`,</if> | ||
| 43 | + </trim> | ||
| 44 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
| 45 | + <if test="type != null">#{type},</if> | ||
| 46 | + <if test="name != null">#{name},</if> | ||
| 47 | + <if test="case_model != null">#{case_model},</if> | ||
| 48 | + <if test="classname != null">#{classname},</if> | ||
| 49 | + <if test="create_time != null">#{create_time},</if> | ||
| 50 | + </trim> | ||
| 51 | + </insert> | ||
| 52 | + | ||
| 53 | + <update id="updateIotProtocolClass" parameterType="IotProtocolClass"> | ||
| 54 | + update iot_protocol_class | ||
| 55 | + <trim prefix="SET" suffixOverrides=","> | ||
| 56 | + <if test="type != null">`type` = #{type},</if> | ||
| 57 | + <if test="name != null">`name` = #{name},</if> | ||
| 58 | + <if test="case_model != null">`case_model` = #{case_model},</if> | ||
| 59 | + <if test="classname != null">`classname` = #{classname},</if> | ||
| 60 | + <if test="create_time != null">`create_time` = #{create_time},</if> | ||
| 61 | + </trim> | ||
| 62 | + where id = #{id} | ||
| 63 | + </update> | ||
| 64 | + | ||
| 65 | + <delete id="deleteIotProtocolClassById" parameterType="Integer"> | ||
| 66 | + delete from iot_protocol_class where id = #{id} | ||
| 67 | + </delete> | ||
| 68 | + | ||
| 69 | + <delete id="deleteIotProtocolClassByIds" parameterType="String"> | ||
| 70 | + delete from iot_protocol_class where id in | ||
| 71 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | ||
| 72 | + #{id} | ||
| 73 | + </foreach> | ||
| 74 | + </delete> | ||
| 75 | +</mapper> |
| 1 | +package com.zhonglai.luhui.admin.controller.iot; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import javax.servlet.http.HttpServletResponse; | ||
| 5 | + | ||
| 6 | +import com.zhonglai.luhui.device.domain.IotProtocolClass; | ||
| 7 | +import com.zhonglai.luhui.device.service.IIotProtocolClassService; | ||
| 8 | +import io.swagger.annotations.Api; | ||
| 9 | +import io.swagger.annotations.ApiOperation; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.PutMapping; | ||
| 14 | +import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 16 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RestController; | ||
| 19 | +import com.ruoyi.common.annotation.Log; | ||
| 20 | +import com.zhonglai.luhui.action.BaseController; | ||
| 21 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 22 | +import com.ruoyi.common.enums.BusinessType; | ||
| 23 | +import com.ruoyi.common.core.page.TableDataInfo; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * 产品解析插件包Controller | ||
| 27 | + * | ||
| 28 | + * @author 钟来 | ||
| 29 | + * @date 2024-06-13 | ||
| 30 | + */ | ||
| 31 | +@Api(tags = "产品解析插件包") | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("/iot/IotProtocolClass") | ||
| 34 | +public class IotProtocolClassController extends BaseController | ||
| 35 | +{ | ||
| 36 | + @Autowired | ||
| 37 | + private IIotProtocolClassService iotProtocolClassService; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 查询产品解析插件包列表 | ||
| 41 | + */ | ||
| 42 | + @ApiOperation("查询产品解析插件包列表") | ||
| 43 | + @GetMapping("/list") | ||
| 44 | + public TableDataInfo list(IotProtocolClass iotProtocolClass) | ||
| 45 | + { | ||
| 46 | + startPage(); | ||
| 47 | + List<IotProtocolClass> list = iotProtocolClassService.selectIotProtocolClassList(iotProtocolClass); | ||
| 48 | + return getDataTable(list); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 获取产品解析插件包详细信息 | ||
| 54 | + */ | ||
| 55 | + @ApiOperation("获取产品解析插件包详细信息") | ||
| 56 | + @GetMapping(value = "/{id}") | ||
| 57 | + public AjaxResult getInfo(@PathVariable("id") Integer id) | ||
| 58 | + { | ||
| 59 | + return AjaxResult.success(iotProtocolClassService.selectIotProtocolClassById(id)); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 新增产品解析插件包 | ||
| 64 | + */ | ||
| 65 | + @ApiOperation("新增产品解析插件包") | ||
| 66 | + @Log(title = "产品解析插件包", businessType = BusinessType.INSERT) | ||
| 67 | + @PostMapping | ||
| 68 | + public AjaxResult add(@RequestBody IotProtocolClass iotProtocolClass) | ||
| 69 | + { | ||
| 70 | + return toAjax(iotProtocolClassService.insertIotProtocolClass(iotProtocolClass)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 修改产品解析插件包 | ||
| 75 | + */ | ||
| 76 | + @ApiOperation("修改产品解析插件包") | ||
| 77 | + @Log(title = "产品解析插件包", businessType = BusinessType.UPDATE) | ||
| 78 | + @PutMapping | ||
| 79 | + public AjaxResult edit(@RequestBody IotProtocolClass iotProtocolClass) | ||
| 80 | + { | ||
| 81 | + return toAjax(iotProtocolClassService.updateIotProtocolClass(iotProtocolClass)); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 删除产品解析插件包 | ||
| 86 | + */ | ||
| 87 | + @ApiOperation("删除产品解析插件包") | ||
| 88 | + @Log(title = "产品解析插件包", businessType = BusinessType.DELETE) | ||
| 89 | + @DeleteMapping("/{ids}") | ||
| 90 | + public AjaxResult remove(@PathVariable Integer[] ids) | ||
| 91 | + { | ||
| 92 | + return toAjax(iotProtocolClassService.deleteIotProtocolClassByIds(ids)); | ||
| 93 | + } | ||
| 94 | +} |
| @@ -188,6 +188,7 @@ public class IotThingsModelController extends BaseController | @@ -188,6 +188,7 @@ public class IotThingsModelController extends BaseController | ||
| 188 | IotProduct iotProduct = iIotProductService.selectIotProductById(oldiotThingsModel.getProduct_id()); | 188 | IotProduct iotProduct = iIotProductService.selectIotProductById(oldiotThingsModel.getProduct_id()); |
| 189 | iotThingsModel.setMqtt_username(iotProduct.getMqtt_username()); | 189 | iotThingsModel.setMqtt_username(iotProduct.getMqtt_username()); |
| 190 | terminalDataThingsModeService.saveIotThingsModel(JSON.parseObject(JSONObject.toJSONString(iotThingsModel),IotThingsModel.class)); | 190 | terminalDataThingsModeService.saveIotThingsModel(JSON.parseObject(JSONObject.toJSONString(iotThingsModel),IotThingsModel.class)); |
| 191 | + | ||
| 191 | return toAjax(ri); | 192 | return toAjax(ri); |
| 192 | } | 193 | } |
| 193 | 194 |
-
请 注册 或 登录 后发表评论