TInspectionRecordMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.inspection.mapper.TInspectionRecordMapper">
  6. <resultMap type="TInspectionRecord" id="TInspectionRecordResult">
  7. <result property="id" column="id" />
  8. <result property="devname" column="devname" />
  9. <result property="devno" column="devno" />
  10. <result property="region" column="region" />
  11. <result property="reason" column="reason" />
  12. <result property="inspectionTime" column="inspection_time" />
  13. <result property="pastTime" column="past_time" />
  14. <result property="pasterCode" column="paster_code" />
  15. <result property="treatment" column="treatment" />
  16. <result property="deptId" column="dept_id" />
  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="deptName" column="dept_name" />
  24. <result property="regionId" column="region_id" />
  25. </resultMap>
  26. <sql id="selectTInspectionRecordVo">
  27. select d.id, d.devname, d.devno, d.region, d.reason, d.inspection_time, d.past_time, d.paster_code, d.treatment, d.dept_id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks ,d.region_id,s.dept_name from t_inspection_record d
  28. left join sys_dept s on s.dept_id = d.dept_id
  29. </sql>
  30. <select id="selectTInspectionRecordList" parameterType="TInspectionRecord" resultMap="TInspectionRecordResult">
  31. <include refid="selectTInspectionRecordVo"/>
  32. <where>
  33. <if test="devname != null and devname != ''"> and devname like concat(concat('%', #{devname}), '%')</if>
  34. <if test="devno != null and devno != ''"> and devno = #{devno}</if>
  35. <if test="region != null and region != ''"> and region = #{region}</if>
  36. <if test="reason != null and reason != ''"> and reason = #{reason}</if>
  37. <if test="inspectionTime != null "> and inspection_time = #{inspectionTime}</if>
  38. <if test="pastTime != null "> and past_time = #{pastTime}</if>
  39. <if test="pasterCode != null and pasterCode != ''"> and paster_code = #{pasterCode}</if>
  40. <if test="treatment != null and treatment != ''"> and treatment = #{treatment}</if>
  41. <if test="deptId != null "> and dept_id = #{deptId}</if>
  42. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  43. <if test="createdate != null "> and createdate = #{createdate}</if>
  44. <if test="createyear != null "> and to_char(createdate,'yyyy')= #{createyear}</if>
  45. <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
  46. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  47. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  48. and d.del_flag = 0
  49. </where>
  50. <!-- 数据范围过滤 -->
  51. ${params.dataScope}
  52. </select>
  53. <select id="selectTInspectionRecordById" parameterType="Long" resultMap="TInspectionRecordResult">
  54. <include refid="selectTInspectionRecordVo"/>
  55. where id = #{id}
  56. </select>
  57. <insert id="insertTInspectionRecord" parameterType="TInspectionRecord">
  58. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  59. SELECT seq_t_inspection_record.NEXTVAL as id FROM DUAL
  60. </selectKey>
  61. insert into t_inspection_record
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="id != null">id,</if>
  64. <if test="devname != null">devname,</if>
  65. <if test="devno != null">devno,</if>
  66. <if test="region != null">region,</if>
  67. <if test="reason != null">reason,</if>
  68. <if test="inspectionTime != null">inspection_time,</if>
  69. <if test="pastTime != null">past_time,</if>
  70. <if test="pasterCode != null">paster_code,</if>
  71. <if test="treatment != null">treatment,</if>
  72. <if test="deptId != null">dept_id,</if>
  73. <if test="delFlag != null">del_flag,</if>
  74. <if test="createrCode != null">creater_code,</if>
  75. <if test="createdate != null">createdate,</if>
  76. <if test="updaterCode != null">updater_code,</if>
  77. <if test="updatedate != null">updatedate,</if>
  78. <if test="remarks != null">remarks,</if>
  79. <if test="regionId != null">region_id,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="id != null">#{id},</if>
  83. <if test="devname != null">#{devname},</if>
  84. <if test="devno != null">#{devno},</if>
  85. <if test="region != null">#{region},</if>
  86. <if test="reason != null">#{reason},</if>
  87. <if test="inspectionTime != null">#{inspectionTime},</if>
  88. <if test="pastTime != null">#{pastTime},</if>
  89. <if test="pasterCode != null">#{pasterCode},</if>
  90. <if test="treatment != null">#{treatment},</if>
  91. <if test="deptId != null">#{deptId},</if>
  92. <if test="delFlag != null">#{delFlag},</if>
  93. <if test="createrCode != null">#{createrCode},</if>
  94. <if test="createdate != null">#{createdate},</if>
  95. <if test="updaterCode != null">#{updaterCode},</if>
  96. <if test="updatedate != null">#{updatedate},</if>
  97. <if test="remarks != null">#{remarks},</if>
  98. <if test="regionId != null">#{regionId},</if>
  99. </trim>
  100. </insert>
  101. <update id="updateTInspectionRecord" parameterType="TInspectionRecord">
  102. update t_inspection_record
  103. <trim prefix="SET" suffixOverrides=",">
  104. <if test="devname != null">devname = #{devname},</if>
  105. <if test="devno != null">devno = #{devno},</if>
  106. <if test="region != null">region = #{region},</if>
  107. <if test="reason != null">reason = #{reason},</if>
  108. <if test="inspectionTime != null">inspection_time = #{inspectionTime},</if>
  109. <if test="pastTime != null">past_time = #{pastTime},</if>
  110. <if test="pasterCode != null">paster_code = #{pasterCode},</if>
  111. <if test="treatment != null">treatment = #{treatment},</if>
  112. <if test="deptId != null">dept_id = #{deptId},</if>
  113. <if test="delFlag != null">del_flag = #{delFlag},</if>
  114. <if test="createrCode != null">creater_code = #{createrCode},</if>
  115. <if test="createdate != null">createdate = #{createdate},</if>
  116. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  117. <if test="updatedate != null">updatedate = #{updatedate},</if>
  118. <if test="remarks != null">remarks = #{remarks},</if>
  119. <if test="regionId != null">region_id = #{regionId},</if>
  120. </trim>
  121. where id = #{id}
  122. </update>
  123. <update id="deleteTInspectionRecordById" parameterType="Long">
  124. update t_inspection_record set del_flag = -1 where id = #{id}
  125. </update>
  126. <update id="deleteTInspectionRecordByIds" parameterType="String">
  127. update t_inspection_record set del_flag = -1 where id in
  128. <foreach item="id" collection="array" open="(" separator="," close=")">
  129. #{id}
  130. </foreach>
  131. </update>
  132. <select id="selectByRegionId" parameterType="Long" resultMap="TInspectionRecordResult">
  133. <include refid="selectTInspectionRecordVo"/>
  134. and d.region_id = #{regionId} and d.del_flag=0
  135. </select>
  136. <update id="deleteTInspectionRecordByRegionId" parameterType="Long">
  137. update t_inspection_record set del_flag = -1 where region_id = #{regionId}
  138. </update>
  139. <update id="deleteTInspectionRecordByRegionIds" parameterType="String">
  140. update t_inspection_record set del_flag = -1 where region_id in
  141. <foreach item="regionId" collection="array" open="(" separator="," close=")">
  142. #{regionId}
  143. </foreach>
  144. </update>
  145. </mapper>