SpStatementInlandLowMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.shcd.mapper.SpStatementInlandLowMapper">
  6. <resultMap id="BaseResultMap" type="com.shcd.entity.SpStatementInlandLow">
  7. <result property="id" column="ID" jdbcType="VARCHAR"/>
  8. <result property="district" column="DISTRICT" jdbcType="VARCHAR"/>
  9. <result property="boatUseNumberMonth" column="BOAT_USE_NUMBER_MONTH" jdbcType="DECIMAL"/>
  10. <result property="boatUseNumberChain" column="BOAT_USE_NUMBER_CHAIN" jdbcType="DECIMAL"/>
  11. <result property="boatUseNumberYearTotal" column="BOAT_USE_NUMBER_YEAR_TOTAL"
  12. jdbcType="DECIMAL"/>
  13. <result property="powerConnHoursMonth" column="POWER_CONN_HOURS_MONTH" jdbcType="DECIMAL"/>
  14. <result property="powerConnHoursYearTotal" column="POWER_CONN_HOURS_YEAR_TOTAL"
  15. jdbcType="DECIMAL"/>
  16. <result property="electricityUsageMonth" column="ELECTRICITY_USAGE_MONTH" jdbcType="DECIMAL"/>
  17. <result property="electricityUsageYearTotal" column="ELECTRICITY_USAGE_YEAR_TOTAL"
  18. jdbcType="DECIMAL"/>
  19. <result property="sort" column="SORT" jdbcType="DECIMAL"/>
  20. <result property="owningArea" column="OWNING_AREA" jdbcType="VARCHAR"/>
  21. <result property="deleteFlag" column="DELETE_FLAG" jdbcType="DECIMAL"/>
  22. <result property="createUser" column="CREATE_USER" jdbcType="VARCHAR"/>
  23. <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
  24. <result property="reportDate" column="REPORT_DATE" jdbcType="TIMESTAMP"/>
  25. <result property="type" column="TYPE" jdbcType="DECIMAL"/>
  26. <result property="column2" column="COLUMN2" jdbcType="VARCHAR"/>
  27. <result property="column3" column="COLUMN3" jdbcType="VARCHAR"/>
  28. <result property="column4" column="COLUMN4" jdbcType="VARCHAR"/>
  29. </resultMap>
  30. <delete id="deleteAllCurrentMonthReport1" parameterType="String">
  31. DELETE
  32. FROM GHJG_PORT_MANAGE.SP_STATEMENT_INLAND_LOW T
  33. WHERE T.TYPE = 1
  34. AND T.REPORT_DATE = TO_DATE(#{reportDate}, 'yyyy-MM')
  35. </delete>
  36. <delete id="deleteAllCurrentMonthReport2">
  37. DELETE
  38. FROM GHJG_PORT_MANAGE.SP_STATEMENT_INLAND_LOW T
  39. WHERE T.TYPE = 2
  40. AND T.REPORT_DATE = TO_DATE(#{reportDate}, 'yyyy-MM')
  41. </delete>
  42. <select id="getOriginDataFromPage" resultType="com.shcd.entity.ShorePowerDeviceUsage">
  43. select T.* from GHJG_PORT_MANAGE.SHORE_POWER_DEVICE_USAGE T
  44. where T.Delete_Flag = 0
  45. <if test="district != '' and district != null">
  46. and T.DISTRICT = #{district}
  47. </if>
  48. <if test="owningArea != '' and owningArea != null">
  49. and T.Owning_Area = #{owningArea}
  50. </if>
  51. <if test="reportDateStart != '' and reportDateStart != null">
  52. and T.Report_Date &gt;= to_date(#{reportDateStart},'yyyy-MM')
  53. </if>
  54. <if test="reportDateEnd != '' and reportDateEnd != null">
  55. and T.Report_Date &lt;= to_Date(#{reportDateEnd},'yyyy-MM')
  56. </if>
  57. order by T.Sort asc,T.OWNING_AREA desc
  58. </select>
  59. <select id="getCurrentYearOriginDataFromPage" resultType="com.shcd.entity.ShorePowerDeviceUsage">
  60. SELECT T.DISTRICT district,
  61. SUM(T.SHORE_POWER_BOAT_USE_NUMBER) shorePowerBoatUseNumber,
  62. SUM(T.POWER_CONN_HOURS) powerConnHours,
  63. SUM(T.ELECTRICITY_CONSUMPTION) electricityConsumption
  64. FROM GHJG_PORT_MANAGE.SHORE_POWER_DEVICE_USAGE T
  65. WHERE EXTRACT(YEAR FROM T.REPORT_DATE) = EXTRACT(YEAR FROM SYSDATE)
  66. GROUP BY T.DISTRICT
  67. </select>
  68. <select id="getLastMonthReportData" parameterType="String"
  69. resultType="com.shcd.entity.SpStatementInlandLow">
  70. SELECT T.*
  71. FROM GHJG_PORT_MANAGE.SP_STATEMENT_INLAND_LOW T
  72. WHERE T.DELETE_FLAG = 0
  73. AND T.DISTRICT = '合计'
  74. <if test="date != '' and date != null">
  75. and T.Report_Date &gt;= to_date(#{date},'yyyy-MM') and T.Report_Date &lt;=
  76. to_Date(#{date},'yyyy-MM')
  77. </if>
  78. <if test="type != '' and type != null">
  79. AND T.TYPE = ${type}
  80. </if>
  81. </select>
  82. <select id="selectDataFromShorePower" resultType="com.shcd.vo.ShorePowerConnRecordInfoVo">
  83. SELECT PORT.AREA area,
  84. SUM(T.ELECT) elect,
  85. SUM(ROUND((T.ENDTIME - T.STARTTIME) * 24, 2)) duration,
  86. COUNT(T.CONNRECORDSEQ) total
  87. FROM GHJG_PORT_MANAGE.SHORE_POWER_CONN_RECORD_INFO T
  88. LEFT JOIN GHJG_PORT_MANAGE.SHORE_POWER_PORT_INFO_NEW PORT
  89. ON PORT.PORTID = T.PORTID
  90. WHERE (T.CONNTYPE = '低压(标准化)'
  91. AND PORT.AREA is not null
  92. and PORT.AREA != 1
  93. AND PORT.PORTID != '1146')
  94. AND ((T.ENDTIME &lt;=
  95. TO_DATE(#{reportDateEnd}, 'yyyy-MM-dd HH24:mi:ss')
  96. AND T.ENDTIME &gt;=
  97. TO_DATE(#{reportDateStart}, 'yyyy-MM-dd HH24:mi:ss'))
  98. <if
  99. test="lastReportDateEnd != '' and lastReportDateEnd != null and lastReportDateStart != '' and lastReportDateStart != null">
  100. OR (T.ENDTIME &lt;= TO_DATE(#{lastReportDateEnd}, 'yyyy-MM-dd HH24:mi:ss') AND
  101. T.ENDTIME &gt;=
  102. TO_DATE(#{lastReportDateStart}, 'yyyy-MM-dd HH24:mi:ss') AND T.MODIFYTIME &lt;=
  103. TO_DATE(#{reportDateEnd}, 'yyyy-MM-dd HH24:mi:ss')
  104. AND T.MODIFYTIME &gt;=
  105. TO_DATE(#{reportDateStart}, 'yyyy-MM-dd HH24:mi:ss'))
  106. </if>
  107. )
  108. GROUP BY PORT.AREA
  109. </select>
  110. <select id="selectCurrentYearDataFromShorePower"
  111. resultType="com.shcd.vo.ShorePowerConnRecordInfoVo">
  112. SELECT PORT.AREA area,
  113. SUM(T.ELECT) elect,
  114. SUM(T.DURATION) duration,
  115. COUNT(T.CONNRECORDSEQ) total
  116. FROM GHJG_PORT_MANAGE.SHORE_POWER_CONN_RECORD_INFO T
  117. LEFT JOIN GHJG_PORT_MANAGE.SHORE_POWER_PORT_INFO_NEW PORT ON PORT.PORTID = T.PORTID
  118. WHERE EXTRACT(YEAR FROM T.Modifytime) = EXTRACT(YEAR FROM SYSDATE)
  119. and T.CONNTYPE = '低压'
  120. GROUP BY PORT.AREA
  121. </select>
  122. <select id="getAllLastMonthReportData" parameterType="String"
  123. resultType="com.shcd.entity.SpStatementInlandLow">
  124. SELECT T.*
  125. FROM GHJG_PORT_MANAGE.SP_STATEMENT_INLAND_LOW T
  126. WHERE T.DELETE_FLAG = 0
  127. <if test="date != '' and date != null">
  128. and T.Report_Date &gt;= to_date(#{date},'yyyy-MM') and T.Report_Date &lt;=
  129. to_Date(#{date},'yyyy-MM')
  130. </if>
  131. <if test="type != '' and type != null">
  132. AND T.TYPE = ${type}
  133. </if>
  134. </select>
  135. </mapper>