LedgerUnsafeEventMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.sundot.airport.ledger.mapper.LedgerUnsafeEventMapper">
  4. <resultMap id="BaseResultMap" type="com.sundot.airport.ledger.domain.LedgerUnsafeEvent">
  5. <id property="id" column="id" />
  6. <result property="recordDate" column="record_date" />
  7. <result property="flightNo" column="flight_no" />
  8. <result property="deptName" column="dept_name" />
  9. <result property="deptId" column="dept_id" />
  10. <result property="teamName" column="team_name" />
  11. <result property="teamId" column="team_id" />
  12. <result property="groupName" column="group_name" />
  13. <result property="groupId" column="group_id" />
  14. <result property="responsibleName" column="responsible_name" />
  15. <result property="responsibleId" column="responsible_id" />
  16. <result property="eventType" column="event_type" />
  17. <result property="involvedItems" column="involved_items" />
  18. <result property="position" column="position" />
  19. <result property="positionId" column="position_id" />
  20. <result property="area" column="area" />
  21. <result property="areaId" column="area_id" />
  22. <result property="channelNo" column="channel_no" />
  23. <result property="image" column="image" />
  24. <result property="eventDesc" column="event_desc" />
  25. <result property="deductScore" column="deduct_score" />
  26. <result property="evidenceFile" column="evidence_file" />
  27. <result property="importBatch" column="import_batch" />
  28. <result property="sourceType" column="source_type" />
  29. <result property="createBy" column="create_by" />
  30. <result property="createTime" column="create_time" />
  31. <result property="updateBy" column="update_by" />
  32. <result property="updateTime" column="update_time" />
  33. <result property="syncFlag" column="sync_flag" />
  34. </resultMap>
  35. <sql id="selectVo">
  36. SELECT id, record_date, flight_no, dept_name, dept_id, team_name, team_id, group_name, group_id,
  37. responsible_name, responsible_id, event_type, involved_items,
  38. position, position_id, area, area_id, channel_no, image, event_desc,
  39. deduct_score, evidence_file,
  40. import_batch, source_type, create_by, create_time, update_by, update_time, sync_flag
  41. FROM ledger_unsafe_event
  42. WHERE del_flag = '0'
  43. </sql>
  44. <select id="selectList" parameterType="com.sundot.airport.ledger.domain.LedgerUnsafeEvent" resultMap="BaseResultMap">
  45. <include refid="selectVo"/>
  46. <if test="deptName != null and deptName != ''">AND dept_name LIKE CONCAT('%', #{deptName}, '%')</if>
  47. <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
  48. <if test="responsibleName != null and responsibleName != ''">AND responsible_name LIKE CONCAT('%', #{responsibleName}, '%')</if>
  49. <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
  50. <if test="params != null and params.beginTime != null and params.beginTime != ''">
  51. AND record_date &gt;= #{params.beginTime}
  52. </if>
  53. <if test="params != null and params.endTime != null and params.endTime != ''">
  54. AND record_date &lt;= #{params.endTime}
  55. </if>
  56. ORDER BY id DESC
  57. </select>
  58. <update id="updateSyncFlag">
  59. update ledger_unsafe_event
  60. set sync_flag = '1'
  61. where sync_flag = '0'
  62. </update>
  63. <select id="countSeizureStatsItem" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeItemVO">
  64. SELECT involved_items AS itemName, COUNT(*) AS itemNum
  65. FROM ledger_unsafe_event
  66. <where>
  67. <include refid="FILTER_CRITERIA_SQL"/>
  68. <!-- 过滤空物品脏数据 -->
  69. AND involved_items IS NOT NULL AND involved_items != ''
  70. </where>
  71. GROUP BY involved_items
  72. ORDER BY itemNum DESC
  73. </select>
  74. <select id="countSeizureStatsType" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeTypeVO">
  75. SELECT event_type AS eventType, COUNT(*) AS eventTypeNum
  76. FROM ledger_unsafe_event
  77. <where>
  78. <include refid="FILTER_CRITERIA_SQL"/>
  79. <!-- 过滤空类型脏数据 -->
  80. AND event_type IS NOT NULL AND event_type != ''
  81. </where>
  82. GROUP BY event_type
  83. ORDER BY eventTypeNum DESC
  84. </select>
  85. <select id="countSeizureStatsPost" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafePositionVO">
  86. SELECT position_id AS positionId, position AS positionName, COUNT(*) AS positionNum
  87. FROM ledger_unsafe_event
  88. <where>
  89. <include refid="FILTER_CRITERIA_SQL"/>
  90. <!-- 过滤空岗位脏数据 -->
  91. AND position IS NOT NULL AND position != ''
  92. </where>
  93. GROUP BY position_id, position
  94. ORDER BY positionNum DESC
  95. </select>
  96. <sql id="FILTER_CRITERIA_SQL">
  97. del_flag = '0'
  98. <if test="startDate != null and endDate != null">
  99. AND record_date BETWEEN #{startDate,jdbcType=DATE} AND #{endDate,jdbcType=DATE}
  100. </if>
  101. <!-- 三级联动筛选 -->
  102. <if test="deptId != null">AND dept_id = #{deptId}</if>
  103. <if test="teamId != null">AND team_id = #{teamId}</if>
  104. <if test="groupId != null">AND group_id = #{groupId}</if>
  105. </sql>
  106. </mapper>