TCheckEnvironmentMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.project.check.mapper.TCheckEnvironmentMapper">
  6. <resultMap type="TCheckEnvironment" id="TCheckEnvironmentResult">
  7. <result property="id" column="id" />
  8. <result property="plantId" column="plant_id" />
  9. <result property="instrumentId" column="instrument_id" />
  10. <result property="assemblyCode" column="assembly_code" />
  11. <result property="backgroundValue" column="background_value" />
  12. <result property="ambientTemp" column="ambient_temp" />
  13. <result property="ambientHumidity" column="ambient_humidity" />
  14. <result property="atmos" column="atmos" />
  15. <result property="windDirection" column="wind_direction" />
  16. <result property="windSpeed" column="wind_speed" />
  17. <result property="tester" column="tester" />
  18. <result property="testTime" column="test_time" />
  19. <result property="remarks" column="remarks" />
  20. <result property="deptId" column="dept_id" />
  21. <result property="delFlag" column="del_flag" />
  22. <result property="createrCode" column="creater_code" />
  23. <result property="createdate" column="createdate" />
  24. <result property="updaterCode" column="updater_code" />
  25. <result property="updatedate" column="updatedate" />
  26. <result property="position1" column="position1" />
  27. <result property="position2" column="position2" />
  28. <result property="position3" column="position3" />
  29. <result property="position4" column="position4" />
  30. <result property="position5" column="position5" />
  31. </resultMap>
  32. <sql id="selectTCheckEnvironmentVo">
  33. select id, plant_id, instrument_id, assembly_code, background_value, ambient_temp, ambient_humidity, atmos, wind_direction, wind_speed, tester, test_time,position1,position2,position3,position4,position5, remarks, dept_id, del_flag, creater_code, createdate, updater_code, updatedate from t_check_environment
  34. </sql>
  35. <select id="selectTCheckEnvironmentList" parameterType="TCheckEnvironment" resultMap="TCheckEnvironmentResult">
  36. select d.*,su.user_name updater,bp.plant_code plantCode,bp.plant_name plantName,ci.model instrumentModel,ci.code instrumentCode from t_check_environment d
  37. left join sys_user su on su.user_id=d.updater_code
  38. left join t_base_plant bp on bp.plant_id =d.plant_id
  39. left join t_check_instrument ci on ci.id=d.instrument_id
  40. <where>
  41. <if test="plantId != null "> and plant_id = #{plantId}</if>
  42. <if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
  43. <if test="assemblyCode != null and assemblyCode != ''"> and assembly_code = #{assemblyCode}</if>
  44. <if test="backgroundValue != null and backgroundValue != ''"> and background_value = #{backgroundValue}</if>
  45. <if test="ambientTemp != null and ambientTemp != ''"> and ambient_temp = #{ambientTemp}</if>
  46. <if test="ambientHumidity != null and ambientHumidity != ''"> and ambient_humidity = #{ambientHumidity}</if>
  47. <if test="atmos != null and atmos != ''"> and atmos = #{atmos}</if>
  48. <if test="windDirection != null and windDirection != ''"> and wind_direction = #{windDirection}</if>
  49. <if test="windSpeed != null and windSpeed != ''"> and wind_speed = #{windSpeed}</if>
  50. <if test="tester != null and tester != ''"> and tester = #{tester}</if>
  51. <if test="testTime != null "> and test_time = #{testTime}</if>
  52. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  53. <if test="deptId != null "> and d.dept_id = #{deptId}</if>
  54. <if test="createrCode != null "> and d.creater_code = #{createrCode}</if>
  55. <if test="createdate != null "> and d.createdate = #{createdate}</if>
  56. <if test="updaterCode != null "> and d.updater_code = #{updaterCode}</if>
  57. <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
  58. <if test="instrumentCode != null "> and ci.code = #{instrumentCode}</if>
  59. <if test="plantName != null "> and bp.plant_name = #{plantName}</if>
  60. and d.del_flag = 0
  61. </where>
  62. <!-- 数据范围过滤 -->
  63. ${params.dataScopePlant}
  64. order by d.createdate desc
  65. </select>
  66. <select id="selectTCheckEnvironmentListByYear" parameterType="TCheckEnvironment" resultMap="TCheckEnvironmentResult">
  67. select d.*,su.user_name updater,bp.plant_code plantCode,bp.plant_name plantName,ci.model instrumentModel,ci.code instrumentCode from t_check_environment d
  68. left join sys_user su on su.user_id=d.updater_code
  69. left join t_base_plant bp on bp.plant_id =d.plant_id
  70. left join t_check_instrument ci on ci.id=d.instrument_id
  71. where d.updatedate > subdate(now(),interval 365 day) and d.del_flag = 0
  72. order by d.id desc
  73. </select>
  74. <select id="selectTCheckEnvironmentById" parameterType="Long" resultMap="TCheckEnvironmentResult">
  75. <include refid="selectTCheckEnvironmentVo"/>
  76. where id = #{id}
  77. </select>
  78. <insert id="insertTCheckEnvironment" parameterType="TCheckEnvironment" useGeneratedKeys="true" keyProperty="id">
  79. insert into t_check_environment
  80. <trim prefix="(" suffix=")" suffixOverrides=",">
  81. <if test="plantId != null">plant_id,</if>
  82. <if test="instrumentId != null">instrument_id,</if>
  83. <if test="assemblyCode != null">assembly_code,</if>
  84. <if test="backgroundValue != null">background_value,</if>
  85. <if test="ambientTemp != null">ambient_temp,</if>
  86. <if test="ambientHumidity != null">ambient_humidity,</if>
  87. <if test="atmos != null">atmos,</if>
  88. <if test="windDirection != null">wind_direction,</if>
  89. <if test="windSpeed != null">wind_speed,</if>
  90. <if test="tester != null">tester,</if>
  91. <if test="testTime != null">test_time,</if>
  92. <if test="remarks != null">remarks,</if>
  93. <if test="deptId != null">dept_id,</if>
  94. <if test="delFlag != null">del_flag,</if>
  95. <if test="createrCode != null">creater_code,</if>
  96. <if test="createdate != null">createdate,</if>
  97. <if test="updaterCode != null">updater_code,</if>
  98. <if test="updatedate != null">updatedate,</if>
  99. <if test="position1 != null">position1,</if>
  100. <if test="position2 != null">position2,</if>
  101. <if test="position3 != null">position3,</if>
  102. <if test="position4 != null">position4,</if>
  103. <if test="position5 != null">position5,</if>
  104. </trim>
  105. <trim prefix="values (" suffix=")" suffixOverrides=",">
  106. <if test="plantId != null">#{plantId},</if>
  107. <if test="instrumentId != null">#{instrumentId},</if>
  108. <if test="assemblyCode != null">#{assemblyCode},</if>
  109. <if test="backgroundValue != null">#{backgroundValue},</if>
  110. <if test="ambientTemp != null">#{ambientTemp},</if>
  111. <if test="ambientHumidity != null">#{ambientHumidity},</if>
  112. <if test="atmos != null">#{atmos},</if>
  113. <if test="windDirection != null">#{windDirection},</if>
  114. <if test="windSpeed != null">#{windSpeed},</if>
  115. <if test="tester != null">#{tester},</if>
  116. <if test="testTime != null">#{testTime},</if>
  117. <if test="remarks != null">#{remarks},</if>
  118. <if test="deptId != null">#{deptId},</if>
  119. <if test="delFlag != null">#{delFlag},</if>
  120. <if test="createrCode != null">#{createrCode},</if>
  121. <if test="createdate != null">#{createdate},</if>
  122. <if test="updaterCode != null">#{updaterCode},</if>
  123. <if test="updatedate != null">#{updatedate},</if>
  124. <if test="position1 != null">#{position1},</if>
  125. <if test="position2 != null">#{position2},</if>
  126. <if test="position3 != null">#{position3},</if>
  127. <if test="position4 != null">#{position4},</if>
  128. <if test="position5 != null">#{position5},</if>
  129. </trim>
  130. </insert>
  131. <update id="updateTCheckEnvironment" parameterType="TCheckEnvironment">
  132. update t_check_environment
  133. <trim prefix="SET" suffixOverrides=",">
  134. <if test="plantId != null">plant_id = #{plantId},</if>
  135. <if test="instrumentId != null">instrument_id = #{instrumentId},</if>
  136. <if test="assemblyCode != null">assembly_code = #{assemblyCode},</if>
  137. <if test="backgroundValue != null">background_value = #{backgroundValue},</if>
  138. <if test="ambientTemp != null">ambient_temp = #{ambientTemp},</if>
  139. <if test="ambientHumidity != null">ambient_humidity = #{ambientHumidity},</if>
  140. <if test="atmos != null">atmos = #{atmos},</if>
  141. <if test="windDirection != null">wind_direction = #{windDirection},</if>
  142. <if test="windSpeed != null">wind_speed = #{windSpeed},</if>
  143. <if test="tester != null">tester = #{tester},</if>
  144. <if test="testTime != null">test_time = #{testTime},</if>
  145. <if test="remarks != null">remarks = #{remarks},</if>
  146. <if test="deptId != null">dept_id = #{deptId},</if>
  147. <if test="delFlag != null">del_flag = #{delFlag},</if>
  148. <if test="createrCode != null">creater_code = #{createrCode},</if>
  149. <if test="createdate != null">createdate = #{createdate},</if>
  150. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  151. <if test="updatedate != null">updatedate = #{updatedate},</if>
  152. <if test="position1 != null">position1 = #{position1},</if>
  153. <if test="position2 != null">position2 = #{position2},</if>
  154. <if test="position3 != null">position3 = #{position3},</if>
  155. <if test="position4 != null">position4 = #{position4},</if>
  156. <if test="position5 != null">position5 = #{position5},</if>
  157. </trim>
  158. where id = #{id}
  159. </update>
  160. <delete id="deleteTCheckEnvironmentById" parameterType="Long">
  161. update t_check_environment set del_flag=1 where id = #{id}
  162. </delete>
  163. <delete id="deleteTCheckEnvironmentByIds" parameterType="String">
  164. update t_check_environment set del_flag=1 where id in
  165. <foreach item="id" collection="array" open="(" separator="," close=")">
  166. #{id}
  167. </foreach>
  168. </delete>
  169. </mapper>