WarnManageMapper.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.manage.mapper.WarnManageMapper">
  6. <resultMap type="WarnManage" id="WarnManageResult">
  7. <result property="warnId" column="warn_id"/>
  8. <result property="equipmentId" column="equipment_id"/>
  9. <result property="equipmentIp" column="equipment_ip"/>
  10. <result property="equipmentName" column="equipment_name"/>
  11. <result property="channelId" column="channel_id"/>
  12. <result property="channelNum" column="channel_num"/>
  13. <result property="algorithmType" column="algorithm_type"/>
  14. <result property="parameterSet" column="parameter_set"/>
  15. <result property="videoAddress" column="video_address"/>
  16. <result property="warnImage" column="warn_image"/>
  17. <result property="reportStatus" column="report_status"/>
  18. <result property="warnTime" column="warn_time"/>
  19. <result property="rangName" column="rang_name"/>
  20. <result property="deptId" column="dept_id"/>
  21. <result property="deptName" column="dept_name"/>
  22. <result property="delFlag" column="del_flag"/>
  23. <result property="createBy" column="create_by"/>
  24. <result property="createTime" column="create_time"/>
  25. <result property="updateBy" column="update_by"/>
  26. <result property="updateTime" column="update_time"/>
  27. <result property="remark" column="remark"/>
  28. </resultMap>
  29. <sql id="selectWarnManageVo">
  30. select warn_id,
  31. equipment_id,
  32. equipment_ip,
  33. equipment_name,
  34. channel_id,
  35. channel_num,
  36. algorithm_type,
  37. parameter_set,
  38. video_address,
  39. warn_image,
  40. report_status,
  41. warn_time,
  42. rang_name,
  43. del_flag,
  44. create_by,
  45. create_time,
  46. update_by,
  47. update_time,
  48. remark
  49. from warn_manage
  50. </sql>
  51. <select id="selectWarnManageList" parameterType="WarnManage" resultMap="WarnManageResult">
  52. select w.warn_id, w.equipment_ip, w.equipment_name, w.channel_id, w.channel_num, w.algorithm_type,
  53. w.parameter_set, w.video_address, w.warn_image, w.report_status, w.warn_time,w.rang_name, w.del_flag, w.create_time,
  54. e.dept_name,e.dept_id
  55. from warn_manage w left join equipment_manage e on e.equipment_id = w.equipment_id
  56. <where>
  57. w.del_flag = '0'
  58. <if test="equipmentIp != null and equipmentIp != ''">and w.equipment_ip = #{equipmentIp}</if>
  59. <if test="equipmentName != null and equipmentName != ''">and w.equipment_name like concat('%',
  60. #{equipmentName}, '%')
  61. </if>
  62. <if test="channelId != null ">and w.channel_id = #{channelId}</if>
  63. <if test="channelNum != null and channelNum != ''">and w.channel_num = #{channelNum}</if>
  64. <if test="algorithmType != null and algorithmType != ''">and w.algorithm_type = #{algorithmType}</if>
  65. <if test="parameterSet != null and parameterSet != ''">and w.parameter_set = #{parameterSet}</if>
  66. <if test="videoAddress != null and videoAddress != ''">and w.video_address = #{videoAddress}</if>
  67. <if test="warnImage != null and warnImage != ''">and w.warn_image = #{warnImage}</if>
  68. <if test="reportStatus != null and reportStatus != ''">and w.report_status = #{reportStatus}</if>
  69. <if test="rangName != null and rangName != ''">and w.rang_name like concat('%',#{rangName}, '%') </if>
  70. <if test="deptId != null ">and e.dept_id = #{deptId}</if>
  71. <if test="warnTime != null ">and date_format(w.warn_time,'%Y%m%d') =date_format(#{warnTime},'%Y%m%d')</if>
  72. <if test="params.month != null ">and date_format(w.warn_time,'%Y%m') =date_format(#{warnTime},'%Y%m')</if>
  73. <if test="params.year != null and params.year != ''"><!-- 年份检索 -->
  74. AND date_format(w.warn_time,'%Y') = #{params.year}
  75. </if>
  76. </where>
  77. order by w.create_time DESC
  78. </select>
  79. <select id="selectWarnManageDeptListByTime" parameterType="WarnManage" resultMap="WarnManageResult">
  80. select w.warn_id, w.equipment_ip, w.equipment_name, w.channel_id, w.channel_num, w.algorithm_type,
  81. w.parameter_set, w.video_address, w.warn_image, w.report_status, w.warn_time,w.rang_name, w.del_flag, w.create_time,
  82. e.dept_name,e.dept_id
  83. from warn_manage w left join equipment_manage e on e.equipment_id = w.equipment_id
  84. <where>
  85. w.del_flag = '0'
  86. <if test="warnTime != null ">and date_format(warn_time,'%Y%m') =date_format(#{warnTime},'%Y%m')</if>
  87. </where>
  88. </select>
  89. <select id="selectWarnManageByWarnId" parameterType="Long" resultMap="WarnManageResult">
  90. <include refid="selectWarnManageVo"/>
  91. where warn_id = #{warnId}
  92. </select>
  93. <insert id="insertWarnManage" parameterType="WarnManage" useGeneratedKeys="true" keyProperty="warnId">
  94. insert into warn_manage
  95. <trim prefix="(" suffix=")" suffixOverrides=",">
  96. <if test="equipmentId != null and equipmentId != ''">equipment_id,</if>
  97. <if test="equipmentIp != null and equipmentIp != ''">equipment_ip,</if>
  98. <if test="equipmentName != null and equipmentName != ''">equipment_name,</if>
  99. <if test="channelId != null">channel_id,</if>
  100. <if test="channelNum != null and channelNum != ''">channel_num,</if>
  101. <if test="algorithmType != null and algorithmType != ''">algorithm_type,</if>
  102. <if test="parameterSet != null and parameterSet != ''">parameter_set,</if>
  103. <if test="videoAddress != null">video_address,</if>
  104. <if test="warnImage != null">warn_image,</if>
  105. <if test="reportStatus != null">report_status,</if>
  106. <if test="warnTime != null">warn_time,</if>
  107. <if test="rangName != null">rang_name,</if>
  108. <if test="delFlag != null">del_flag,</if>
  109. <if test="createBy != null">create_by,</if>
  110. <if test="updateBy != null">update_by,</if>
  111. <if test="updateTime != null">update_time,</if>
  112. <if test="remark != null">remark,</if>
  113. create_time
  114. </trim>
  115. <trim prefix="values (" suffix=")" suffixOverrides=",">
  116. <if test="equipmentId != null and equipmentId != ''">#{equipmentId},</if>
  117. <if test="equipmentIp != null and equipmentIp != ''">#{equipmentIp},</if>
  118. <if test="equipmentName != null and equipmentName != ''">#{equipmentName},</if>
  119. <if test="channelId != null">#{channelId},</if>
  120. <if test="channelNum != null and channelNum != ''">#{channelNum},</if>
  121. <if test="algorithmType != null and algorithmType != ''">#{algorithmType},</if>
  122. <if test="parameterSet != null and parameterSet != ''">#{parameterSet},</if>
  123. <if test="videoAddress != null">#{videoAddress},</if>
  124. <if test="warnImage != null">#{warnImage},</if>
  125. <if test="reportStatus != null">#{reportStatus},</if>
  126. <if test="warnTime != null">#{warnTime},</if>
  127. <if test="rangName != null">#{rangName},</if>
  128. <if test="delFlag != null">#{delFlag},</if>
  129. <if test="createBy != null">#{createBy},</if>
  130. <if test="updateBy != null">#{updateBy},</if>
  131. <if test="updateTime != null">#{updateTime},</if>
  132. <if test="remark != null">#{remark},</if>
  133. sysdate()
  134. </trim>
  135. </insert>
  136. <update id="updateWarnManage" parameterType="WarnManage">
  137. update warn_manage
  138. <trim prefix="SET" suffixOverrides=",">
  139. <if test="equipmentId != null and equipmentId != ''">equipment_id = #{equipmentId},</if>
  140. <if test="equipmentIp != null and equipmentIp != ''">equipment_ip = #{equipmentIp},</if>
  141. <if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
  142. <if test="channelId != null">channel_id = #{channelId},</if>
  143. <if test="channelNum != null and channelNum != ''">channel_num = #{channelNum},</if>
  144. <if test="algorithmType != null and algorithmType != ''">algorithm_type = #{algorithmType},</if>
  145. <if test="parameterSet != null and parameterSet != ''">parameter_set = #{parameterSet},</if>
  146. <if test="videoAddress != null">video_address = #{videoAddress},</if>
  147. <if test="warnImage != null">warn_image = #{warnImage},</if>
  148. <if test="reportStatus != null">report_status = #{reportStatus},</if>
  149. <if test="warnTime != null">warn_time = #{warnTime},</if>
  150. <if test="rangName != null">rang_name = #{rangName},</if>
  151. <if test="delFlag != null">del_flag = #{delFlag},</if>
  152. <if test="createBy != null">create_by = #{createBy},</if>
  153. <if test="createTime != null">create_time = #{createTime},</if>
  154. <if test="updateBy != null">update_by = #{updateBy},</if>
  155. <if test="updateTime != null">update_time = #{updateTime},</if>
  156. <if test="remark != null">remark = #{remark},</if>
  157. </trim>
  158. where warn_id = #{warnId}
  159. </update>
  160. <delete id="deleteWarnManageByWarnId" parameterType="Long">
  161. delete
  162. from warn_manage
  163. where warn_id = #{warnId}
  164. </delete>
  165. <delete id="deleteWarnManageByWarnIds" parameterType="String">
  166. delete from warn_manage where warn_id in
  167. <foreach item="warnId" collection="array" open="(" separator="," close=")">
  168. #{warnId}
  169. </foreach>
  170. </delete>
  171. </mapper>