TAbnormalreportMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.reliability.mapper.TAbnormalreportMapper">
  6. <resultMap type="TAbnormalreport" id="TAbnormalreportResult">
  7. <result property="id" column="id" />
  8. <result property="plantCode" column="plant_code" />
  9. <result property="time" column="time" />
  10. <result property="team" column="team" />
  11. <result property="reporter" column="reporter" />
  12. <result property="reportno" column="reportno" />
  13. <result property="abnormalphen" column="abnormalphen" />
  14. <result property="treatprocess" column="treatprocess" />
  15. <result property="reason" column="reason" />
  16. <result property="measures" column="measures" />
  17. <result property="delFlag" column="del_flag" />
  18. <result property="createrCode" column="creater_code" />
  19. <result property="createdate" column="createdate" />
  20. <result property="updaterCode" column="updater_code" />
  21. <result property="updatedate" column="updatedate" />
  22. <result property="remarks" column="remarks" />
  23. <result property="deptId" column="dept_id" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="startDate" column="time" />
  26. <result property="endDate" column="time" />
  27. </resultMap>
  28. <sql id="selectTAbnormalreportVo">
  29. select d.id, d.plant_code, d.time, d.team, d.reporter, d.reportno, d.abnormalphen, d.treatprocess, d.reason, d.measures, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks, d.dept_id ,s.dept_name from t_abnormalreport d
  30. left join sys_dept s on s.dept_id = d.dept_id
  31. </sql>
  32. <select id="selectTAbnormalreportList" parameterType="TAbnormalreport" resultMap="TAbnormalreportResult">
  33. <include refid="selectTAbnormalreportVo"/>
  34. <where>
  35. <if test="team != null and team != ''"> and team = #{team}</if>
  36. <if test="reporter != null and reporter != ''"> and reporter like concat(concat('%', #{reporter}), '%')</if>
  37. <if test="reportno != null and reportno != ''"> and reportno like concat(concat('%', #{reportno}), '%')</if>
  38. <if test="startDate != null ">and time <![CDATA[>=]]> #{startDate}</if>
  39. <if test="endDate != null">and time <![CDATA[<=]]>#{endDate}</if>
  40. and d.del_flag = 0
  41. </where>
  42. <!-- 数据范围过滤 -->
  43. ${params.dataScope}
  44. order by d.time desc
  45. </select>
  46. <select id="selectTAbnormalreportById" parameterType="Long" resultMap="TAbnormalreportResult">
  47. <include refid="selectTAbnormalreportVo"/>
  48. where id = #{id}
  49. </select>
  50. <insert id="insertTAbnormalreport" parameterType="TAbnormalreport">
  51. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  52. SELECT seq_t_abnormalreport.NEXTVAL as id FROM DUAL
  53. </selectKey>
  54. insert into t_abnormalreport
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="id != null">id,</if>
  57. <if test="plantCode != null and plantCode != ''">plant_code,</if>
  58. <if test="time != null">time,</if>
  59. <if test="team != null">team,</if>
  60. <if test="reporter != null">reporter,</if>
  61. <if test="reportno != null">reportno,</if>
  62. <if test="abnormalphen != null">abnormalphen,</if>
  63. <if test="treatprocess != null">treatprocess,</if>
  64. <if test="reason != null">reason,</if>
  65. <if test="measures != null">measures,</if>
  66. <if test="delFlag != null">del_flag,</if>
  67. <if test="createrCode != null">creater_code,</if>
  68. <if test="createdate != null">createdate,</if>
  69. <if test="updaterCode != null">updater_code,</if>
  70. <if test="updatedate != null">updatedate,</if>
  71. <if test="remarks != null">remarks,</if>
  72. <if test="deptId != null">dept_id,</if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="id != null">#{id},</if>
  76. <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
  77. <if test="time != null">#{time},</if>
  78. <if test="team != null">#{team},</if>
  79. <if test="reporter != null">#{reporter},</if>
  80. <if test="reportno != null">#{reportno},</if>
  81. <if test="abnormalphen != null">#{abnormalphen},</if>
  82. <if test="treatprocess != null">#{treatprocess},</if>
  83. <if test="reason != null">#{reason},</if>
  84. <if test="measures != null">#{measures},</if>
  85. <if test="delFlag != null">#{delFlag},</if>
  86. <if test="createrCode != null">#{createrCode},</if>
  87. <if test="createdate != null">#{createdate},</if>
  88. <if test="updaterCode != null">#{updaterCode},</if>
  89. <if test="updatedate != null">#{updatedate},</if>
  90. <if test="remarks != null">#{remarks},</if>
  91. <if test="deptId != null">#{deptId},</if>
  92. </trim>
  93. </insert>
  94. <update id="updateTAbnormalreport" parameterType="TAbnormalreport">
  95. update t_abnormalreport
  96. <trim prefix="SET" suffixOverrides=",">
  97. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  98. <if test="time != null">time = #{time},</if>
  99. <if test="team != null">team = #{team},</if>
  100. <if test="reporter != null">reporter = #{reporter},</if>
  101. <if test="reportno != null">reportno = #{reportno},</if>
  102. <if test="abnormalphen != null">abnormalphen = #{abnormalphen},</if>
  103. <if test="treatprocess != null">treatprocess = #{treatprocess},</if>
  104. <if test="reason != null">reason = #{reason},</if>
  105. <if test="measures != null">measures = #{measures},</if>
  106. <if test="delFlag != null">del_flag = #{delFlag},</if>
  107. <if test="createrCode != null">creater_code = #{createrCode},</if>
  108. <if test="createdate != null">createdate = #{createdate},</if>
  109. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  110. <if test="updatedate != null">updatedate = #{updatedate},</if>
  111. <if test="remarks != null">remarks = #{remarks},</if>
  112. <if test="deptId != null">dept_id = #{deptId},</if>
  113. </trim>
  114. where id = #{id}
  115. </update>
  116. <update id="deleteTAbnormalreportById" parameterType="Long">
  117. update t_abnormalreport set del_flag = 2 where id = #{id}
  118. </update>
  119. <update id="deleteTAbnormalreportByIds" parameterType="String">
  120. update t_abnormalreport set del_flag = 2 where id in
  121. <foreach item="id" collection="array" open="(" separator="," close=")">
  122. #{id}
  123. </foreach>
  124. </update>
  125. <select id="selectYearData" resultType="com.ruoyi.project.common.domain.DataEntity">
  126. SELECT count(1) as dataNum,TO_CHAR(d.time,'YYYY') as dataName FROM t_abnormalreport d
  127. <where>
  128. and d.del_flag = 0
  129. </where>
  130. <!-- 数据范围过滤 -->
  131. ${params.dataScope}
  132. GROUP BY TO_CHAR(d.time,'YYYY')
  133. order by dataName
  134. </select>
  135. <select id="teamData" resultType="com.ruoyi.project.common.domain.DataEntity">
  136. SELECT count(1) as dataNum,d.team as dataName FROM t_abnormalreport d
  137. <where>
  138. and d.del_flag = 0
  139. </where>
  140. <!-- 数据范围过滤 -->
  141. ${params.dataScope}
  142. GROUP BY d.team
  143. order by dataName
  144. </select>
  145. </mapper>