DeviceAlarmRuleMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.zcxk.smartcity.data.access.dao.DeviceAlarmRuleMapper">
  4. <!--auto generated Code-->
  5. <resultMap id="BaseResultMap" type="com.zcxk.smartcity.data.access.entity.DeviceAlarmRule">
  6. <result column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="channel_id" property="channelId" jdbcType="INTEGER"/>
  8. <result column="site_id" property="siteId" jdbcType="INTEGER"/>
  9. <result column="rule_source" property="ruleSource" jdbcType="VARCHAR"/>
  10. <result column="device_type" property="deviceType" jdbcType="INTEGER"/>
  11. <result column="rule_name" property="ruleName" jdbcType="VARCHAR"/>
  12. <result column="measuring_code" property="measuringCode" jdbcType="VARCHAR"/>
  13. <result column="expression" property="expression" jdbcType="VARCHAR"/>
  14. <result column="alarm_type_id" property="alarmTypeId" jdbcType="INTEGER"/>
  15. <result column="measuring_data_type" property="measuringDataType" jdbcType="INTEGER"/>
  16. <result column="status" property="status" jdbcType="INTEGER"/>
  17. <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
  18. <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
  19. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP"/>
  20. <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
  21. </resultMap>
  22. <sql id="where">
  23. <where>
  24. <if test="params.id != null">
  25. and id = #{params.id}
  26. </if>
  27. <if test="params.channelId != null ">
  28. and channel_id = #{params.channelId}
  29. </if>
  30. <if test="params.siteId != null">
  31. and site_id = #{params.siteId}
  32. </if>
  33. <if test="params.ruleSource != null and params.ruleSource != ''">
  34. and rule_source = #{params.ruleSource}
  35. </if>
  36. <if test="params.deviceType != null ">
  37. and device_type = #{params.deviceType}
  38. </if>
  39. <if test="params.status != null ">
  40. and status = #{params.status}
  41. </if>
  42. <if test="params.alarmTypeId != null ">
  43. and alarm_type_id = #{params.alarmTypeId}
  44. </if>
  45. </where>
  46. </sql>
  47. <!--auto generated Code-->
  48. <sql id="Base_Column_List">
  49. id,
  50. channel_id,
  51. site_id,
  52. rule_source,
  53. device_type,
  54. rule_name,
  55. measuring_code,
  56. expression,
  57. alarm_type_id,
  58. measuring_data_type,
  59. status,
  60. create_date,
  61. create_by,
  62. update_date,
  63. update_by
  64. </sql>
  65. <select id="findByAlarmTypeId" resultType="DeviceAlarmRule">
  66. select <include refid="Base_Column_List" /> from sc_device_alarm_rule
  67. where status = 1 and alarm_type_id = #{alarmTypeId}
  68. </select>
  69. <select id="singleQuery" resultType="DeviceAlarmRule">
  70. select <include refid="Base_Column_List" /> from sc_device_alarm_rule
  71. <include refid="where" />
  72. limit 1
  73. </select>
  74. <select id="list" resultType="DeviceAlarmRule">
  75. select <include refid="Base_Column_List" /> from sc_device_alarm_rule
  76. <include refid="where" />
  77. </select>
  78. </mapper>