UserControlEarlyWarningListLogDao.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.yx.face.dao.UserControlEarlyWarningListLogDao">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yx.face.model.entity.UserControlEarlyWarningListLog">
  6. <id column="id" property="id" />
  7. <result column="update_time" property="updateTime" />
  8. <result column="create_time" property="createTime" />
  9. <result column="admin_id" property="adminId" />
  10. <result column="status" property="status" />
  11. <result column="face_log_id" property="faceLogId" />
  12. <result column="control_early_warning_id" property="controlEarlyWarningId" />
  13. </resultMap>
  14. <!-- 通用查询结果列 -->
  15. <sql id="Base_Column_List">
  16. id, update_time, create_time, admin_id, status, face_log_id, control_early_warning_id
  17. </sql>
  18. <update id="updateEarlyWarningConfirm">
  19. UPDATE user_control_early_warning_list_log SET status = #{status} WHERE
  20. id = #{id}
  21. </update>
  22. <select id="getListLog" resultType="com.yx.face.model.vo.UserEarlyWarningLogVO">
  23. SELECT
  24. a.id,
  25. b.face_time AS faceTime,
  26. c.`name` AS snName,
  27. b.`name` AS `name`,
  28. b.cardid AS idNumber,
  29. b.photo,
  30. d.control_unit AS controlUnit,
  31. d.control_phone AS controlPhone,
  32. d.control_name AS controlName
  33. FROM
  34. user_control_early_warning_list_log AS a
  35. LEFT JOIN face_log AS b ON a.face_log_id = b.id
  36. LEFT JOIN face_device AS c ON b.device_sn = c.sn
  37. LEFT JOIN user_control_early_warning_list AS d ON a.control_early_warning_id = d.id
  38. LEFT JOIN admin e on e.id =a.admin_id
  39. <where>
  40. and a.`status` = 1
  41. <if test="type == 2">
  42. and e.province_id = #{provinceId}
  43. and e.type =5
  44. </if>
  45. <if test="type == 3">
  46. and e.province_id = #{provinceId}
  47. and e.type =5
  48. and e.tag_id = #{tagId}
  49. </if>
  50. <if test="type == 4">
  51. and e.city_id = #{cityId}
  52. and e.type = 5
  53. and e.tag_id = #{tagId}
  54. </if>
  55. <if test="type == 5">
  56. and e.id =#{adminId}
  57. </if>
  58. </where>
  59. ORDER BY a.id DESC
  60. </select>
  61. <select id="getListLogPageInfo" resultType="com.yx.face.model.vo.UserEarlyWarningLogVO">
  62. SELECT
  63. a.id,
  64. b.face_time AS faceTime,
  65. c.`name` AS snName,
  66. b.`name` AS `name`,
  67. b.cardid AS idNumber,
  68. b.photo,
  69. d.control_unit AS controlUnit,
  70. d.control_phone AS controlPhone,
  71. d.control_name AS controlName,
  72. a.status
  73. FROM
  74. user_control_early_warning_list_log AS a
  75. LEFT JOIN face_log AS b ON a.face_log_id = b.id
  76. LEFT JOIN face_device AS c ON b.device_sn = c.sn
  77. LEFT JOIN user_control_early_warning_list AS d ON a.control_early_warning_id = d.id
  78. LEFT JOIN admin e on e.id =a.admin_id
  79. <where>
  80. <if test="adminVo.type == 2">
  81. and e.province_id = #{adminVo.provinceId}
  82. and e.type =5
  83. </if>
  84. <if test="adminVo.type == 3">
  85. and e.province_id = #{adminVo.provinceId}
  86. and e.type =5
  87. and e.tag_id = #{adminVo.tagId}
  88. </if>
  89. <if test="adminVo.type == 4">
  90. and e.city_id = #{adminVo.cityId}
  91. and e.type = 5
  92. and e.tag_id = #{adminVo.tagId}
  93. </if>
  94. <if test="adminVo.type == 5">
  95. and e.id =#{adminVo.adminId}
  96. </if>
  97. <if test="qu.status != 0 ">
  98. and a.status =#{qu.status}
  99. </if>
  100. <if test="qu.name != '' and qu.name != null ">
  101. and d.early_warning_name =#{qu.name}
  102. </if>
  103. <if test="qu.idNumber != '' and qu.idNumber != null ">
  104. and d.early_warning_id_number =#{qu.idNumber}
  105. </if>
  106. <if test="qu.controlUnit != null and qu.controlUnit != '' ">
  107. and d.control_unit like concat('%',#{qu.controlUnit},'%')
  108. </if>
  109. <if test="qu.controlPhone != null and qu.controlPhone != '' ">
  110. and d.control_phone =#{qu.controlPhone}
  111. </if>
  112. <if test="qu.controlName != null and qu.controlName != '' ">
  113. and d.control_name =#{qu.controlName}
  114. </if>
  115. <if test="qu.startTime != null and qu.startTime != '' and qu.endTime != null and qu.endTime != '' ">
  116. AND <![CDATA[ b.face_time >= #{qu.startTime}]]>
  117. AND <![CDATA[ b.face_time < #{qu.endTime}]]>
  118. </if>
  119. <if test="qu.startTime == '' and qu.endTime != null and qu.endTime != '' ">
  120. AND <![CDATA[ b.face_time <= #{qu.endTime}]]>
  121. </if>
  122. </where>
  123. ORDER BY a.id DESC
  124. </select>
  125. <select id="getUserEarlyWarningLogExcel" resultType="com.yx.face.model.excel.UserEarlyWarningLogExcel">
  126. SELECT
  127. a.id,
  128. b.face_time AS faceTime,
  129. c.`name` AS snName,
  130. b.`name` AS `name`,
  131. b.cardid AS idNumber,
  132. b.photo,
  133. d.control_unit AS controlUnit,
  134. d.control_phone AS controlPhone,
  135. d.control_name AS controlName,
  136. a.status
  137. FROM
  138. user_control_early_warning_list_log AS a
  139. LEFT JOIN face_log AS b ON a.face_log_id = b.id
  140. LEFT JOIN face_device AS c ON b.device_sn = c.sn
  141. LEFT JOIN user_control_early_warning_list AS d ON a.control_early_warning_id = d.id
  142. LEFT JOIN admin e on e.id =a.admin_id
  143. <where>
  144. <if test="adminVo.type == 2">
  145. and e.province_id = #{adminVo.provinceId}
  146. and e.type =5
  147. </if>
  148. <if test="adminVo.type == 3">
  149. and e.province_id = #{adminVo.provinceId}
  150. and e.type =5
  151. and e.tag_id = #{adminVo.tagId}
  152. </if>
  153. <if test="adminVo.type == 4">
  154. and e.city_id = #{adminVo.cityId}
  155. and e.type = 5
  156. and e.tag_id = #{adminVo.tagId}
  157. </if>
  158. <if test="adminVo.type == 5">
  159. and e.id =#{adminVo.adminId}
  160. </if>
  161. <if test="qu.status != 0 ">
  162. and a.status =#{qu.status}
  163. </if>
  164. <if test="qu.name != '' and qu.name != null ">
  165. and d.early_warning_name =#{qu.name}
  166. </if>
  167. <if test="qu.idNumber != '' and qu.idNumber != null ">
  168. and d.early_warning_id_number =#{qu.idNumber}
  169. </if>
  170. <if test="qu.controlUnit != null and qu.controlUnit != '' ">
  171. and d.control_unit like concat('%',#{qu.controlUnit},'%')
  172. </if>
  173. <if test="qu.controlPhone != null and qu.controlPhone != '' ">
  174. and d.control_phone =#{qu.controlPhone}
  175. </if>
  176. <if test="qu.controlName != null and qu.controlName != '' ">
  177. and d.control_name =#{qu.controlName}
  178. </if>
  179. <if test="qu.startTime != null and qu.startTime != '' and qu.endTime != null and qu.endTime != '' ">
  180. AND <![CDATA[ b.face_time >= #{qu.startTime}]]>
  181. AND <![CDATA[ b.face_time < #{qu.endTime}]]>
  182. </if>
  183. <if test="qu.startTime == '' and qu.endTime != null and qu.endTime != '' ">
  184. AND <![CDATA[ b.face_time <= #{qu.endTime}]]>
  185. </if>
  186. </where>
  187. ORDER BY a.id DESC
  188. </select>
  189. </mapper>