TwinCalcAlarmsMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.ruoyi.biz.mapper.TwinCalcAlarmsMapper">
  6. <resultMap type="TwinCalcAlarms" id="TwinCalcAlarmsResult">
  7. <result property="id" column="ID"/>
  8. <result property="deviceId" column="DEVICE_ID"/>
  9. <result property="dataDate" column="DATA_DATE"/>
  10. <result property="hour" column="HOUR"/>
  11. <result property="startTime" column="START_TIME"/>
  12. <result property="endTime" column="END_TIME"/>
  13. <result property="alarmType" column="ALARM_TYPE"/>
  14. <result property="calcStatus" column="CALC_STATUS"/>
  15. <result property="createdBy" column="CREATED_BY"/>
  16. <result property="createdTime" column="CREATED_TIME"/>
  17. <result property="updatedBy" column="UPDATED_BY"/>
  18. <result property="updatedTime" column="UPDATED_TIME"/>
  19. <result property="remark" column="REMARK"/>
  20. </resultMap>
  21. <sql id="selectTwinCalcAlarmsVo">
  22. select ID,
  23. DEVICE_ID,
  24. DATA_DATE, HOUR, START_TIME, END_TIME, ALARM_TYPE, CALC_STATUS, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK
  25. from twin_calc_alarms
  26. </sql>
  27. <select id="selectTwinCalcAlarmsList" parameterType="TwinCalcAlarms" resultMap="TwinCalcAlarmsResult">
  28. <include refid="selectTwinCalcAlarmsVo"/>
  29. <where>
  30. <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
  31. <if test="params.beginDataDate != null and params.beginDataDate != '' and params.endDataDate != null and params.endDataDate != ''">
  32. and DATA_DATE between #{params.beginDataDate} and #{params.endDataDate}
  33. </if>
  34. <if test="hour != null and hour != ''">and HOUR = #{hour}</if>
  35. <if test="params.beginStartTime != null and params.beginStartTime != '' and params.endStartTime != null and params.endStartTime != ''">
  36. and START_TIME between #{params.beginStartTime} and #{params.endStartTime}
  37. </if>
  38. <if test="params.beginEndTime != null and params.beginEndTime != '' and params.endEndTime != null and params.endEndTime != ''">
  39. and END_TIME between #{params.beginEndTime} and #{params.endEndTime}
  40. </if>
  41. <if test="alarmType != null ">and ALARM_TYPE = #{alarmType}</if>
  42. <if test="calcStatus != null ">and CALC_STATUS = #{calcStatus}</if>
  43. <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
  44. <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
  45. <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
  46. <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
  47. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  48. <if test="params.sTime != null and params.eTime != null">
  49. and (start_time&lt;=#{params.eTime} and end_time>=#{params.sTime})
  50. </if>
  51. </where>
  52. </select>
  53. <select id="selectTwinCalcAlarmsById" parameterType="Long" resultMap="TwinCalcAlarmsResult">
  54. <include refid="selectTwinCalcAlarmsVo"/>
  55. where ID = #{id}
  56. </select>
  57. <insert id="insertTwinCalcAlarms" parameterType="TwinCalcAlarms" useGeneratedKeys="true" keyProperty="id">
  58. insert into twin_calc_alarms
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="deviceId != null">DEVICE_ID,</if>
  61. <if test="dataDate != null">DATA_DATE,</if>
  62. <if test="hour != null">HOUR,</if>
  63. <if test="startTime != null">START_TIME,</if>
  64. <if test="endTime != null">END_TIME,</if>
  65. <if test="alarmType != null">ALARM_TYPE,</if>
  66. <if test="calcStatus != null ">CALC_STATUS,</if>
  67. <if test="createdBy != null">CREATED_BY,</if>
  68. <if test="createdTime != null">CREATED_TIME,</if>
  69. <if test="updatedBy != null">UPDATED_BY,</if>
  70. <if test="updatedTime != null">UPDATED_TIME,</if>
  71. <if test="remark != null">REMARK,</if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="deviceId != null">#{deviceId},</if>
  75. <if test="dataDate != null">#{dataDate},</if>
  76. <if test="hour != null">#{hour},</if>
  77. <if test="startTime != null">#{startTime},</if>
  78. <if test="endTime != null">#{endTime},</if>
  79. <if test="alarmType != null">#{alarmType},</if>
  80. <if test="calcStatus != null ">#{calcStatus},</if>
  81. <if test="createdBy != null">#{createdBy},</if>
  82. <if test="createdTime != null">#{createdTime},</if>
  83. <if test="updatedBy != null">#{updatedBy},</if>
  84. <if test="updatedTime != null">#{updatedTime},</if>
  85. <if test="remark != null">#{remark},</if>
  86. </trim>
  87. </insert>
  88. <update id="updateTwinCalcAlarms" parameterType="TwinCalcAlarms">
  89. update twin_calc_alarms
  90. <trim prefix="SET" suffixOverrides=",">
  91. <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
  92. <if test="dataDate != null">DATA_DATE = #{dataDate},</if>
  93. <if test="hour != null">HOUR = #{hour},</if>
  94. <if test="startTime != null">START_TIME = #{startTime},</if>
  95. <if test="endTime != null">END_TIME = #{endTime},</if>
  96. <if test="alarmType != null">ALARM_TYPE = #{alarmType},</if>
  97. <if test="calcStatus != null ">CALC_STATUS = #{calcStatus},</if>
  98. <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
  99. <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
  100. <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
  101. <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
  102. <if test="remark != null">REMARK = #{remark},</if>
  103. </trim>
  104. where ID = #{id}
  105. </update>
  106. <delete id="deleteTwinCalcAlarmsById" parameterType="Long">
  107. delete
  108. from twin_calc_alarms
  109. where ID = #{id}
  110. </delete>
  111. <delete id="deleteTwinCalcAlarmsByIds" parameterType="String">
  112. delete from twin_calc_alarms where ID in
  113. <foreach item="id" collection="array" open="(" separator="," close=")">
  114. #{id}
  115. </foreach>
  116. </delete>
  117. </mapper>