PdmMaintenanceProcessMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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.powerdistribution.mapper.PdmMaintenanceProcessMapper">
  6. <resultMap type="PdmMaintenanceProcess" id="PdmMaintenanceProcessResult">
  7. <result property="id" column="id" />
  8. <result property="planCode" column="plan_code" />
  9. <result property="planCodeW" column="plan_code_w" />
  10. <result property="powerOutageDevices" column="power_outage_devices" />
  11. <result property="perHourHouseholdsM" column="per_hour_households_m" />
  12. <result property="perHourHouseholdsW" column="per_hour_households_w" />
  13. <result property="city" column="city" />
  14. <result property="county" column="county" />
  15. <result property="station" column="station" />
  16. <result property="lineCode" column="line_code" />
  17. <result property="lineName" column="line_name" />
  18. <result property="perHourHouseholdsArtif" column="per_hour_households_artif" />
  19. <result property="declarAgency" column="declar_agency" />
  20. <result property="isMaintenance" column="is_maintenance" />
  21. <result property="isApprove" column="is_approve" />
  22. <result property="maintenanceFilePath" column="maintenance_file_path" />
  23. <result property="approveFilePath" column="approve_file_path" />
  24. <result property="maintenanceFileName" column="maintenance_file_name" />
  25. <result property="approveFileName" column="approve_file_name" />
  26. <result property="createBy" column="create_by" />
  27. <result property="createTime" column="create_time" />
  28. <result property="updateBy" column="update_by" />
  29. <result property="updateTime" column="update_time" />
  30. <result property="hourNum" column="hour_num" />
  31. <result property="examiAmount" column="exami_Amount" typeHandler="com.ruoyi.common.handler.ListTypeHandler" javaType="java.util.List" />
  32. <!--result property="manageAssistantAmt" column="manage_assistant_amt" />
  33. <result property="deptDirectorAmt" column="dept_director_amt" />
  34. <result property="deptDirectorAssistantAmt" column="dept_director_assistant_amt" />
  35. <result property="deptManageAmt" column="dept_manage_amt" />
  36. <result property="principAmt" column="princip_amt" />
  37. <result property="workPrincipAmt" column="work_princip_amt" />
  38. <result property="ownerAmt" column="owner_amt" /-->
  39. </resultMap>
  40. <sql id="selectPdmMaintenanceProcessVo">
  41. select id, plan_code,plan_code_w, power_outage_devices, per_hour_households_m, per_hour_households_w, SUBSTRING_INDEX(city, '国网湖南省电力有限公司', -1)city, SUBSTRING_INDEX(SUBSTRING_INDEX(county, '国网湖南省电力有限公司', -1),'国网衡阳供电公司',-1)county, SUBSTRING_INDEX(station, '国网湖南省电力有限公司', -1)station, line_code, line_name, per_hour_households_artif,SUBSTRING_INDEX(declar_agency, '国网衡阳供电公司', -1) declar_agency, is_maintenance, is_approve, maintenance_file_path,maintenance_file_name, approve_file_path,approve_file_name, create_by, create_time, update_by, update_time,std_org_no,week_start_dt,week_end_dt from pdm_maintenance_process
  42. </sql>
  43. <select id="selectPdmMaintenanceProcessList" parameterType="PdmMaintenanceProcess" resultMap="PdmMaintenanceProcessResult">
  44. select a.*,getExamiAmountFun((select ROUND(sum(hour_num)) from pdm_stop_records where std_org_no=a.std_org_no
  45. and poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241')
  46. and DATE_FORMAT(poweroff_start_tm, '%Y-%m-%d') &gt;= a.week_start_dt
  47. and DATE_FORMAT(poweroff_term_tm, '%Y-%m-%d') &lt;= a.week_end_dt),per_hour_households_w) exami_Amount from ( <include refid="selectPdmMaintenanceProcessVo"/>
  48. <where>
  49. <if test="planCode != null and planCode != ''"> and plan_code like concat('%', #{planCode}, '%')</if>
  50. <if test="planCodeW != null and planCodeW != ''"> and plan_code_w like concat('%', #{planCodeW}, '%')</if>
  51. <if test="powerOutageDevices != null "> and power_outage_devices = #{powerOutageDevices}</if>
  52. <if test="perHourHouseholdsM != null "> and per_hour_households_m = #{perHourHouseholdsM}</if>
  53. <if test="perHourHouseholdsW != null "> and per_hour_households_w = #{perHourHouseholdsW}</if>
  54. <if test="city != null and city != ''"> and city = #{city}</if>
  55. <if test="county != null and county != ''"> and county like concat('%', #{county}, '%')</if>
  56. <if test="station != null and station != ''"> and station like concat('%', #{station}, '%')</if>
  57. <if test="lineCode != null and lineCode != ''"> and line_code = #{lineCode}</if>
  58. <if test="lineName != null and lineName != ''"> and line_name like concat('%', #{lineName}, '%')</if>
  59. <if test="perHourHouseholdsArtif != null "> and per_hour_households_artif = #{perHourHouseholdsArtif}</if>
  60. <if test="declarAgency != null and declarAgency != ''"> and declar_agency = #{declarAgency}</if>
  61. <if test="isMaintenance != null and isMaintenance != ''"> and is_maintenance = #{isMaintenance}</if>
  62. <if test="isApprove != null and isApprove != ''"> and is_approve = #{isApprove}</if>
  63. <if test="maintenanceFilePath != null and maintenanceFilePath != ''"> and maintenance_file_path = #{maintenanceFilePath}</if>
  64. <if test="approveFilePath != null and approveFilePath != ''"> and approve_file_path = #{approveFilePath}</if>
  65. </where>
  66. )a order by plan_code,plan_code_w,station,line_name
  67. </select>
  68. <select id="selectPdmMaintenanceProcessById" parameterType="Long" resultMap="PdmMaintenanceProcessResult">
  69. <include refid="selectPdmMaintenanceProcessVo"/>
  70. where id = #{id}
  71. </select>
  72. <insert id="insertPdmMaintenanceProcess" parameterType="PdmMaintenanceProcess" useGeneratedKeys="true" keyProperty="id">
  73. insert into pdm_maintenance_process
  74. <trim prefix="(" suffix=")" suffixOverrides=",">
  75. <if test="planCode != null">plan_code,</if>
  76. <if test="powerOutageDevices != null">power_outage_devices,</if>
  77. <if test="perHourHouseholdsM != null">per_hour_households_m,</if>
  78. <if test="perHourHouseholdsW != null">per_hour_households_w,</if>
  79. <if test="city != null">city,</if>
  80. <if test="county != null">county,</if>
  81. <if test="station != null">station,</if>
  82. <if test="lineCode != null">line_code,</if>
  83. <if test="lineName != null">line_name,</if>
  84. <if test="perHourHouseholdsArtif != null">per_hour_households_artif,</if>
  85. <if test="declarAgency != null">declar_agency,</if>
  86. <if test="isMaintenance != null">is_maintenance,</if>
  87. <if test="isApprove != null">is_approve,</if>
  88. <if test="maintenanceFilePath != null">maintenance_file_path,</if>
  89. <if test="approveFilePath != null">approve_file_path,</if>
  90. <if test="createBy != null">create_by,</if>
  91. <if test="createTime != null">create_time,</if>
  92. <if test="updateBy != null">update_by,</if>
  93. <if test="updateTime != null">update_time,</if>
  94. </trim>
  95. <trim prefix="values (" suffix=")" suffixOverrides=",">
  96. <if test="planCode != null">#{planCode},</if>
  97. <if test="powerOutageDevices != null">#{powerOutageDevices},</if>
  98. <if test="perHourHouseholdsM != null">#{perHourHouseholdsM},</if>
  99. <if test="perHourHouseholdsW != null">#{perHourHouseholdsW},</if>
  100. <if test="city != null">#{city},</if>
  101. <if test="county != null">#{county},</if>
  102. <if test="station != null">#{station},</if>
  103. <if test="lineCode != null">#{lineCode},</if>
  104. <if test="lineName != null">#{lineName},</if>
  105. <if test="perHourHouseholdsArtif != null">#{perHourHouseholdsArtif},</if>
  106. <if test="declarAgency != null">#{declarAgency},</if>
  107. <if test="isMaintenance != null">#{isMaintenance},</if>
  108. <if test="isApprove != null">#{isApprove},</if>
  109. <if test="maintenanceFilePath != null">#{maintenanceFilePath},</if>
  110. <if test="approveFilePath != null">#{approveFilePath},</if>
  111. <if test="createBy != null">#{createBy},</if>
  112. <if test="createTime != null">#{createTime},</if>
  113. <if test="updateBy != null">#{updateBy},</if>
  114. <if test="updateTime != null">#{updateTime},</if>
  115. </trim>
  116. </insert>
  117. <update id="updatePdmMaintenanceProcess" parameterType="PdmMaintenanceProcess">
  118. update pdm_maintenance_process
  119. <trim prefix="SET" suffixOverrides=",">
  120. <if test="planCode != null">plan_code = #{planCode},</if>
  121. <if test="powerOutageDevices != null">power_outage_devices = #{powerOutageDevices},</if>
  122. <if test="perHourHouseholdsM != null">per_hour_households_m = #{perHourHouseholdsM},</if>
  123. <if test="perHourHouseholdsW != null">per_hour_households_w = #{perHourHouseholdsW},</if>
  124. <if test="city != null">city = #{city},</if>
  125. <if test="county != null">county = #{county},</if>
  126. <if test="station != null">station = #{station},</if>
  127. <if test="lineCode != null">line_code = #{lineCode},</if>
  128. <if test="lineName != null">line_name = #{lineName},</if>
  129. <if test="perHourHouseholdsArtif != null">per_hour_households_artif = #{perHourHouseholdsArtif},</if>
  130. <if test="declarAgency != null">declar_agency = #{declarAgency},</if>
  131. <if test="isMaintenance != null">is_maintenance = #{isMaintenance},</if>
  132. <if test="isApprove != null">is_approve = #{isApprove},</if>
  133. <if test="maintenanceFilePath != null">maintenance_file_path = #{maintenanceFilePath},</if>
  134. <if test="approveFilePath != null">approve_file_path = #{approveFilePath},</if>
  135. <if test="maintenanceFileName != null">maintenance_file_name = #{maintenanceFileName},</if>
  136. <if test="approveFileName != null">approve_file_name = #{approveFileName},</if>
  137. <if test="createBy != null">create_by = #{createBy},</if>
  138. <if test="createTime != null">create_time = #{createTime},</if>
  139. <if test="updateBy != null">update_by = #{updateBy},</if>
  140. <if test="updateTime != null">update_time = #{updateTime},</if>
  141. </trim>
  142. where id = #{id}
  143. </update>
  144. <delete id="deletePdmMaintenanceProcessById" parameterType="Long">
  145. delete from pdm_maintenance_process where id = #{id}
  146. </delete>
  147. <delete id="deletePdmMaintenanceProcessByIds" parameterType="String">
  148. delete from pdm_maintenance_process where id in
  149. <foreach item="id" collection="array" open="(" separator="," close=")">
  150. #{id}
  151. </foreach>
  152. </delete>
  153. </mapper>