IotProductMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.middle.platform.manage.biz.mapper.IotProductMapper">
  4. <resultMap id="BaseResultMap" type="com.middle.platform.manage.biz.entity.IotProduct">
  5. <!--@mbg.generated-->
  6. <!--@Table iot_product-->
  7. <id column="id" jdbcType="BIGINT" property="id"/>
  8. <result column="code" jdbcType="VARCHAR" property="code"/>
  9. <result column="name" jdbcType="VARCHAR" property="name"/>
  10. <result column="secret" jdbcType="VARCHAR" property="secret"/>
  11. <result column="node_type" jdbcType="TINYINT" property="nodeType"/>
  12. <result column="network_type" jdbcType="TINYINT" property="networkType"/>
  13. <result column="report_protocol" jdbcType="TINYINT" property="reportProtocol"/>
  14. <result column="vendors" jdbcType="TINYINT" property="vendors"/>
  15. <result column="data_format" jdbcType="TINYINT" property="dataFormat"/>
  16. <result column="auth_type" jdbcType="TINYINT" property="authType"/>
  17. <result column="tag" jdbcType="VARCHAR" property="tag"/>
  18. <result column="size" jdbcType="INTEGER" property="size"/>
  19. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  20. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  21. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  22. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  23. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  24. <result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime"/>
  25. <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. <!--@mbg.generated-->
  29. id,
  30. code,
  31. `name`,
  32. secret,
  33. node_type,
  34. network_type,
  35. report_protocol,
  36. data_format,
  37. vendors,
  38. auth_type,
  39. tag,
  40. `size`,
  41. remark,
  42. create_by,
  43. create_time,
  44. update_by,
  45. update_time,
  46. delete_time,
  47. del_flag
  48. </sql>
  49. <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotProductVo">
  50. select *
  51. from iot_product ip
  52. <where>
  53. <if test="keywords != null and keywords != ''">
  54. and ip.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
  55. </if>
  56. and ip.del_flag = 0
  57. </where>
  58. </select>
  59. <select id="queryTotalNumberOfProducts" resultType="int">
  60. select count(id) as num
  61. from iot_product
  62. <where>
  63. del_flag = 0
  64. </where>
  65. </select>
  66. <select id="list" resultType="com.middle.platform.manage.biz.domain.vo.IotProductDownVo">
  67. select ip.id, ip.name, ip.code
  68. from iot_product ip
  69. <where>
  70. and ip.del_flag = 0
  71. </where>
  72. </select>
  73. <select id="selectProduct" resultType="com.middle.platform.manage.api.pojo.ProductVo">
  74. select ip.id,
  75. ip.code,
  76. ip.data_format,
  77. id.guid
  78. from iot_product ip
  79. inner join iot_device id on ip.id = id.product_id and id.del_flag = 0
  80. <where>
  81. <if test="productKey != null and productKey != ''">
  82. and ip.code = #{productKey,jdbcType=VARCHAR}
  83. </if>
  84. <if test="deviceSn != null and deviceSn != ''">
  85. and id.sn = #{deviceSn,jdbcType=VARCHAR}
  86. </if>
  87. and id.enable_flag = 1
  88. and ip.del_flag = 0
  89. </where>
  90. </select>
  91. <select id="queryProductTopic" resultType="com.middle.platform.manage.api.pojo.TopicVo">
  92. select iu.url, iu.permission, iu.func
  93. from iot_product ip
  94. inner join iot_url iu on ip.id = iu.product_id and iu.del_flag = 0
  95. <where>
  96. <if test="type != null">
  97. and iu.type = #{type,jdbcType=INTEGER}
  98. </if>
  99. and iu.permission in (1, 3)
  100. and ip.del_flag = 0
  101. </where>
  102. </select>
  103. </mapper>