EventLogMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.supervision.web.peopleGateManage.mapper.EventLogMapper">
  5. <resultMap id="EventLogResultMap" type="com.supervision.web.peopleGateManage.enity.EventLog">
  6. <id property="id" column="id"/>
  7. <result property="personId" column="person_id"/>
  8. <result property="jobNumber" column="job_number"/>
  9. <result property="name" column="name"/>
  10. <result property="cardNumber" column="card_number"/>
  11. <result property="door" column="door"/>
  12. <result property="remoteHost" column="remote_host"/>
  13. <result property="reader" column="reader"/>
  14. <result property="detectorId" column="detector_id"/>
  15. <result property="operation" column="operation"/>
  16. <result property="eventType" column="event_type"/>
  17. <result property="eventTime" column="event_time"/>
  18. <result property="createTime" column="create_time"/>
  19. </resultMap>
  20. <!-- 分页查询 -->
  21. <select id="selectByCondition" resultMap="EventLogResultMap">
  22. SELECT *
  23. FROM event_log
  24. <where>
  25. <if test="eventType != null and eventType != ''">
  26. AND event_type = #{eventType}
  27. </if>
  28. <if test="personId != null and personId != ''">
  29. AND person_id = #{personId}
  30. </if>
  31. <if test="jobNumber != null and jobNumber != ''">
  32. AND job_number = #{jobNumber}
  33. </if>
  34. <if test="name != null and name != ''">
  35. AND name LIKE CONCAT('%', #{name}, '%')
  36. </if>
  37. <if test="remoteHost != null and remoteHost != ''">
  38. AND remote_host LIKE CONCAT('%', #{remoteHost}, '%')
  39. </if>
  40. <if test="reader != null and reader != ''">
  41. AND reader LIKE CONCAT('%', #{reader}, '%')
  42. </if>
  43. <if test="detectorId != null and detectorId != ''">
  44. AND detector_id = #{detectorId}
  45. </if>
  46. <if test="operation != null and operation != ''">
  47. AND operation LIKE CONCAT('%', #{operation}, '%')
  48. </if>
  49. <!-- <if test="startTime != null and startTime != ''">-->
  50. <!-- AND event_time &gt;= #{startTime}-->
  51. <!-- </if>-->
  52. <!-- <if test="endTime != null and endTime != ''">-->
  53. <!-- AND event_time &lt;= #{endTime}-->
  54. <!-- </if>-->
  55. <if test="startTime != null and startTime != ''">
  56. AND event_time <![CDATA[ >= ]]> #{startTime}
  57. </if>
  58. <if test="endTime != null and endTime != ''">
  59. AND event_time <![CDATA[ <= ]]> #{endTime}
  60. </if>
  61. </where>
  62. ORDER BY event_time DESC
  63. LIMIT #{offset}, #{pageSize}
  64. </select>
  65. <!-- 总数查询 -->
  66. <select id="countByCondition" resultType="int">
  67. SELECT COUNT(*)
  68. FROM event_log
  69. <where>
  70. <if test="eventType != null and eventType != ''">
  71. AND event_type = #{eventType}
  72. </if>
  73. <if test="personId != null and personId != ''">
  74. AND person_id = #{personId}
  75. </if>
  76. <if test="jobNumber != null and jobNumber != ''">
  77. AND job_number = #{jobNumber}
  78. </if>
  79. <if test="name != null and name != ''">
  80. AND name LIKE CONCAT('%', #{name}, '%')
  81. </if>
  82. <if test="remoteHost != null and remoteHost != ''">
  83. AND remote_host LIKE CONCAT('%', #{remoteHost}, '%')
  84. </if>
  85. <if test="reader != null and reader != ''">
  86. AND reader LIKE CONCAT('%', #{reader}, '%')
  87. </if>
  88. <if test="detectorId != null and detectorId != ''">
  89. AND detector_id = #{detectorId}
  90. </if>
  91. <if test="operation != null and operation != ''">
  92. AND operation LIKE CONCAT('%', #{operation}, '%')
  93. </if>
  94. <if test="startTime != null and startTime != ''">
  95. AND event_time &gt;= #{startTime}
  96. </if>
  97. <if test="endTime != null and endTime != ''">
  98. AND event_time &lt;= #{endTime}
  99. </if>
  100. </where>
  101. </select>
  102. </mapper>