DeviceAnalogVariableListMapper.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.bizmatics.persistence.mapper.DeviceAnalogVariableListMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.bizmatics.model.DeviceAnalogVariableList">
  6. <id column="id" property="id" />
  7. <result column="device_code" property="deviceCode" />
  8. <result column="variable_name" property="variableName" />
  9. <result column="variable_coding" property="variableCoding" />
  10. <result column="monitoring_equipment" property="monitoringEquipment" />
  11. <result column="communication_equipment" property="communicationEquipment" />
  12. <result column="data_address" property="dataAddress" />
  13. <result column="data_type" property="dataType" />
  14. <result column="coefficient" property="coefficient" />
  15. <result column="save_cycle" property="saveCycle" />
  16. <result column="create_time" property="createTime" />
  17. <result column="creator" property="creator" />
  18. <result column="enable" property="enable" />
  19. </resultMap>
  20. <select id="variableList" resultType="com.bizmatics.model.DeviceAnalogVariableList">
  21. SELECT
  22. a.*
  23. FROM
  24. device_analog_variable_list AS a
  25. inner JOIN device AS b ON a.device_code = b.device_code
  26. <where>
  27. b.enable =1
  28. and a.enable =1
  29. <if test="siteId != null and siteId !=0">
  30. and b.site_id = #{siteId}
  31. </if>
  32. <if test="id != null and id !=0">
  33. and a.id = #{id}
  34. </if>
  35. <if test="deviceCode != null and deviceCode !=''">
  36. and b.device_code = #{deviceCode}
  37. </if>
  38. <if test="deviceType != null and deviceType !=0">
  39. and b.device_type = #{deviceType}
  40. </if>
  41. <if test="screen != null and screen !=''">
  42. and ( a.variable_name LIKE CONCAT(CONCAT('%', #{screen}), '%') or a.variable_coding LIKE
  43. CONCAT(CONCAT('%', #{screen}), '%'))
  44. </if>
  45. </where>
  46. order by a.id
  47. <if test="startCurrent != null and startCurrent !=0 and current != null and current !=0">
  48. LIMIT #{startCurrent},#{current}
  49. </if>
  50. </select>
  51. </mapper>