WindExceptionCountMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.energy.manage.service.mappers.windexceptioncount.WindExceptionCountMapper">
  4. <resultMap id="resultMap" type="com.energy.manage.common.po.windexceptioncount.WindExceptionCountPo">
  5. <id column="id" property="id" jdbcType="BIGINT"/>
  6. <result column="batch_code" property="batchCode" jdbcType="VARCHAR"/>
  7. <result column="engine_code" property="engineCode" jdbcType="VARCHAR"/>
  8. <result column="analysis_type_code" property="analysisTypeCode" jdbcType="VARCHAR"/>
  9. <result column="err_count" property="errCount" jdbcType="INTEGER"/>
  10. <result column="handle_err_count" property="handleErrCount" jdbcType="INTEGER"/>
  11. <result column="create_by" property="createBy" jdbcType="INTEGER"/>
  12. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  13. <result column="update_by" property="updateBy" jdbcType="INTEGER"/>
  14. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  15. </resultMap>
  16. <select id="selectByCondition" parameterType="com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto" resultType="com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo">
  17. select
  18. count.id,
  19. count.batch_code,
  20. count.engine_code,
  21. engine.engine_name,
  22. type.type_name as analysis_type_name,
  23. count.analysis_type_code,
  24. count.err_count,
  25. count.handle_err_count,
  26. count.create_by,
  27. count.create_time,
  28. count.update_by,
  29. count.update_time
  30. from
  31. wind_exception_count count
  32. left join analysis_type type
  33. on count.analysis_type_code = type.type_code
  34. left join wind_engine_group engine
  35. on engine.engine_code = count.engine_code
  36. where
  37. count.is_delete = 0
  38. and count.batch_code = #{batchCode}
  39. <if test="engineCode != null and engineCode != ''">
  40. and count.engine_code = #{engineCode}
  41. </if>
  42. <if test="analysisTypeCode != null and analysisTypeCode != ''">
  43. and count.analysis_type_code = #{analysisTypeCode}
  44. </if>
  45. </select>
  46. <select id="selectByfieldCodes" parameterType="java.lang.String" resultType="com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo">
  47. select
  48. count.*,
  49. engine.engine_name,
  50. batch.field_code,
  51. batch.field_name
  52. from
  53. wind_exception_count count
  54. left join wind_field_batch batch
  55. on batch.batch_code = count.batch_code
  56. left join wind_engine_group engine
  57. on engine.engine_code = count.engine_code
  58. where
  59. batch.batch_code in (
  60. select distinct
  61. batch_code
  62. from
  63. wind_field_batch
  64. where
  65. field_code in
  66. <foreach collection="fieldCodes" open="(" separator="," close=")" item="fieldCode">
  67. #{fieldCode,jdbcType=VARCHAR}
  68. </foreach>
  69. );
  70. </select>
  71. <insert id="insertPoSelective" parameterType="com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto">
  72. insert into wind_exception_count
  73. <trim prefix="(" suffix=")" suffixOverrides=",">
  74. <if test="batchCode != null">
  75. batch_code,
  76. </if>
  77. <if test="engineCode != null">
  78. engine_code,
  79. </if>
  80. <if test="analysisTypeCode != null">
  81. analysis_type_code,
  82. </if>
  83. <if test="errCount != null">
  84. err_count,
  85. </if>
  86. <if test="handleErrCount!= null">
  87. handle_err_count,
  88. </if>
  89. <if test="createBy != null">
  90. create_by,
  91. </if>
  92. <if test="updateBy != null">
  93. update_by
  94. </if>
  95. </trim>
  96. <trim prefix="values (" suffix=")" suffixOverrides=",">
  97. <if test="batchCode != null">
  98. #{batchCode,jdbcType=VARCHAR},
  99. </if>
  100. <if test="engineCode != null">
  101. #{engineCode,jdbcType=VARCHAR},
  102. </if>
  103. <if test="analysisTypeCode != null">
  104. #{analysisTypeCode,jdbcType=VARCHAR},
  105. </if>
  106. <if test="errCount != null">
  107. #{errCount,jdbcType=INTEGER},
  108. </if>
  109. <if test="handleErrCount != null">
  110. #{handleErrCount,jdbcType=INTEGER},
  111. </if>
  112. <if test="createBy != null">
  113. #{createBy,jdbcType=INTEGER},
  114. </if>
  115. <if test="updateBy != null">
  116. #{updateBy,jdbcType=INTEGER}
  117. </if>
  118. </trim>
  119. </insert>
  120. <update id="updatePoSelecttive" parameterType="com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto">
  121. update wind_exception_count
  122. <set>
  123. <if test="errCount != null">
  124. err_count = #{errCount,jdbcType=INTEGER},
  125. </if>
  126. <if test="handleErrCount != null">
  127. handle_err_count = #{handleErrCount,jdbcType=INTEGER},
  128. </if>
  129. <if test="isDelete != null">
  130. is_delete = #{isDelete,jdbcType=INTEGER},
  131. </if>
  132. <if test="updateBy != null">
  133. update_by = #{updateBy,jdbcType=INTEGER}
  134. </if>
  135. </set>
  136. where id = #{id,jdbcType=BIGINT}
  137. </update>
  138. </mapper>