You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
2.0 KiB

3 years ago
  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.iteaj.iboot.msn.iot.mapper.SignalMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.Signal">
  6. <result column="id" property="id" />
  7. <result column="name" property="name" />
  8. <result column="type" property="type" />
  9. <result column="encode" property="encode" />
  10. <result column="address" property="address" />
  11. <result column="message" property="message" />
  12. <result column="type_id" property="typeId" />
  13. <result column="model_id" property="modelId" />
  14. <result column="field_name" property="fieldName" />
  15. <result column="field_type" property="fieldType" />
  16. <result column="create_time" property="createTime" />
  17. </resultMap>
  18. <select id="detailByPage" resultMap="BaseResultMap">
  19. select a.id, a.name, a.address, a.model_id, a.field_name, a.field_type, a.create_time
  20. , a.message, a.encode, a.type, idm.type_id from iot_signal a
  21. left join iot_device_model idm on a.model_id = idm.id
  22. left join iot_device_type idt on idm.type_id=idt.id
  23. <where>
  24. <if test="entity.typeId!=null">
  25. and find_in_set(#{entity.typeId}, idt.path)
  26. </if>
  27. <if test="entity.modelId!=null">
  28. and a.model_id=#{entity.modelId}
  29. </if>
  30. <if test="entity.name!=null and entity.name != ''">
  31. and a.name like '%${entity.name}%'
  32. </if>
  33. <if test="entity.fieldName!=null and entity.fieldName != ''">
  34. and a.field_name like '%${entity.fieldName}%'
  35. </if>
  36. </where>
  37. </select>
  38. <select id="collectByPointGroupId" resultMap="BaseResultMap">
  39. select * from iot_signal a left join iot_group_point g on g.signal_id=a.id where g.group_id=#{groupId}
  40. </select>
  41. </mapper>