TTrainingrecordsMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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.training.mapper.TTrainingrecordsMapper">
  6. <resultMap type="TTrainingrecords" id="TTrainingrecordsResult">
  7. <result property="id" column="id" />
  8. <result property="plantCode" column="plant_code" />
  9. <result property="year" column="year" />
  10. <result property="name" column="name" />
  11. <result property="employeeid" column="employeeid" />
  12. <result property="classes" column="classes" />
  13. <result property="companysafe" column="companysafe" />
  14. <result property="plantsafe" column="plantsafe" />
  15. <result property="teamsafe" column="teamsafe" />
  16. <result property="sub" column="sub" />
  17. <result property="cracking" column="cracking" />
  18. <result property="hotarea" column="hotarea" />
  19. <result property="coldarea" column="coldarea" />
  20. <result property="aeupgu" column="aeupgu" />
  21. <result property="upscore" column="upscore" />
  22. <result property="downscore" column="downscore" />
  23. <result property="delFlag" column="del_flag" />
  24. <result property="createrCode" column="creater_code" />
  25. <result property="createdate" column="createdate" />
  26. <result property="updaterCode" column="updater_code" />
  27. <result property="updatedate" column="updatedate" />
  28. <result property="remarks" column="remarks" />
  29. <result property="deptId" column="dept_id" />
  30. <result property="deptName" column="dept_name" />
  31. <result property="onboard" column="onboard" />
  32. <result property="tds" column="tds" />
  33. <result property="postCard" column="post_card" />
  34. <result property="craft" column="craft" />
  35. <result property="staffId" column="staff_id" />
  36. <result property="company" column="company" />
  37. <result property="device" column="device" />
  38. </resultMap>
  39. <sql id="selectTTrainingrecordsVo">
  40. select d.id, d.plant_code,d.onboard, d.company, d.device, d.staff_id, d.tds,d.post_card,d.craft, d.year, d.name, d.employeeid, d.classes, d.companysafe, d.plantsafe, d.teamsafe, d.sub, d.cracking, d.hotarea, d.coldarea, d.aeupgu, d.upscore, d.downscore, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks, d.dept_id ,s.dept_name from t_trainingrecords d
  41. left join sys_dept s on s.dept_id = d.dept_id
  42. </sql>
  43. <select id="selectTTrainingrecordsList" parameterType="TTrainingrecords" resultMap="TTrainingrecordsResult">
  44. <include refid="selectTTrainingrecordsVo"/>
  45. LEFT JOIN t_staffmgr t on d.employeeid = t.staffid and t.del_flag = 0
  46. LEFT JOIN SYS_DICT_DATA sdd on t.ACTUALPOST = sdd.DICT_VALUE and sdd.DICT_TYPE = 'ACTUALPOST'
  47. LEFT JOIN SYS_DICT_DATA sdd2 on d.classes = sdd2.DICT_VALUE and sdd2.DICT_TYPE = 'TEAM_DIVIDE'
  48. <where>
  49. <if test="year != null "> and year = #{year}</if>
  50. <if test="name != null and name != ''"> and d.name like concat(concat('%', #{name}), '%')</if>
  51. <if test="employeeid != null and employeeid != ''"> and employeeid like concat(concat('%', #{employeeid}), '%')</if>
  52. <if test="classes != null and classes != ''"> and classes = #{classes}</if>
  53. <if test="onboard != null and onboard != ''"> and onboard = #{onboard}</if>
  54. <if test="tds != null and tds != ''"> and tds = #{tds}</if>
  55. <if test="postCard != null and postCard != ''"> and post_card = #{postCard}</if>
  56. <if test="craft != null and craft != ''"> and craft = #{craft}</if>
  57. <!-- 王子文 2022年8月15日 -->
  58. <!-- 新增检索条件:公司级培训、装置级培训 -->
  59. <if test="company != null and company != ''"> and company = #{company}</if>
  60. <if test="device != null and device != ''"> and device = #{device}</if>
  61. and d.del_flag = 0
  62. </where>
  63. <!-- 数据范围过滤 -->
  64. ${params.dataScope}
  65. order by sdd2.DICT_SORT ,sdd.DICT_SORT
  66. <!-- <if test="sortOrder == 'desc'">
  67. <if test="sortDate == 'companysafe'"> ORDER BY companysafe desc</if>
  68. <if test="sortDate == 'plantsafe'"> ORDER BY plantsafe desc</if>
  69. <if test="sortDate == 'teamsafe'"> ORDER BY teamsafe desc</if>
  70. </if>
  71. <if test="sortOrder == 'asc'">
  72. <if test="sortDate == 'companysafe'"> ORDER BY companysafe asc</if>
  73. <if test="sortDate == 'plantsafe'"> ORDER BY plantsafe asc</if>
  74. <if test="sortDate == 'teamsafe'"> ORDER BY teamsafe asc</if>
  75. </if>-->
  76. </select>
  77. <select id="selectList" parameterType="TTrainingrecords" resultMap="TTrainingrecordsResult">
  78. <include refid="selectTTrainingrecordsVo"/>
  79. <where>
  80. d.del_flag = 0
  81. </where>
  82. <!-- 数据范围过滤 -->
  83. ${params.dataScope}
  84. </select>
  85. <select id="selectTTrainingrecordsById" parameterType="Long" resultMap="TTrainingrecordsResult">
  86. <include refid="selectTTrainingrecordsVo"/>
  87. where id = #{id}
  88. </select>
  89. <select id="selectTTrainingrecordsBystaffId" parameterType="Long" resultMap="TTrainingrecordsResult">
  90. <include refid="selectTTrainingrecordsVo"/>
  91. where d.staff_id = #{id} and rownum <![CDATA[ <= ]]> 1
  92. </select>
  93. <insert id="insertTTrainingrecords" parameterType="TTrainingrecords">
  94. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  95. SELECT seq_t_trainingrecords.NEXTVAL as id FROM DUAL
  96. </selectKey>
  97. insert into t_trainingrecords
  98. <trim prefix="(" suffix=")" suffixOverrides=",">
  99. <if test="id != null">id,</if>
  100. <if test="plantCode != null and plantCode != ''">plant_code,</if>
  101. <if test="year != null">year,</if>
  102. <if test="name != null">name,</if>
  103. <if test="employeeid != null">employeeid,</if>
  104. <if test="classes != null">classes,</if>
  105. <if test="companysafe != null">companysafe,</if>
  106. <if test="plantsafe != null">plantsafe,</if>
  107. <if test="teamsafe != null">teamsafe,</if>
  108. <if test="sub == 'true'">boiler,</if>
  109. <if test="cracking == 'true'">cracking,</if>
  110. <if test="hotarea == 'true'">hotarea,</if>
  111. <if test="coldarea == 'true'">coldarea,</if>
  112. <if test="aeupgu == 'true'">aromatic,</if>
  113. <if test="upscore != null">upscore,</if>
  114. <if test="downscore != null">downscore,</if>
  115. <if test="delFlag != null">del_flag,</if>
  116. <if test="createrCode != null">creater_code,</if>
  117. <if test="createdate != null">createdate,</if>
  118. <if test="updaterCode != null">updater_code,</if>
  119. <if test="updatedate != null">updatedate,</if>
  120. <if test="remarks != null">remarks,</if>
  121. <if test="deptId != null">dept_id,</if>
  122. <if test="onboard != null">onboard,</if>
  123. <if test="tds != null">tds,</if>
  124. <if test="postCard != null">post_card ,</if>
  125. <if test="craft != null">craft,</if>
  126. <if test="company != null">company,</if>
  127. <if test="device != null">device,</if>
  128. <if test="staffId != null">staff_id,</if>
  129. </trim>
  130. <trim prefix="values (" suffix=")" suffixOverrides=",">
  131. <if test="id != null">#{id},</if>
  132. <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
  133. <if test="year != null">#{year},</if>
  134. <if test="name != null">#{name},</if>
  135. <if test="employeeid != null">#{employeeid},</if>
  136. <if test="classes != null">#{classes},</if>
  137. <if test="companysafe != null">#{companysafe},</if>
  138. <if test="plantsafe != null">#{plantsafe},</if>
  139. <if test="teamsafe != null">#{teamsafe},</if>
  140. <if test="sub == 'true'">10,</if>
  141. <if test="cracking == 'true'">10,</if>
  142. <if test="hotarea == 'true'">10,</if>
  143. <if test="coldarea == 'true'">10,</if>
  144. <if test="aeupgu == 'true'">10,</if>
  145. <if test="upscore != null">#{upscore},</if>
  146. <if test="downscore != null">#{downscore},</if>
  147. <if test="delFlag != null">#{delFlag},</if>
  148. <if test="createrCode != null">#{createrCode},</if>
  149. <if test="createdate != null">#{createdate},</if>
  150. <if test="updaterCode != null">#{updaterCode},</if>
  151. <if test="updatedate != null">#{updatedate},</if>
  152. <if test="remarks != null">#{remarks},</if>
  153. <if test="deptId != null">#{deptId},</if>
  154. <if test="onboard != null">#{onboard},</if>
  155. <if test="tds != null">#{tds},</if>
  156. <if test="postCard != null">#{postCard },</if>
  157. <if test="craft != null">#{craft},</if>
  158. <if test="company != null">#{company},</if>
  159. <if test="device != null">#{device},</if>
  160. <if test="staffId != null">#{staffId},</if>
  161. </trim>
  162. </insert>
  163. <update id="updateTTrainingrecords" parameterType="TTrainingrecords">
  164. update t_trainingrecords
  165. <trim prefix="SET" suffixOverrides=",">
  166. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  167. <if test="year != null">year = #{year},</if>
  168. <if test="name != null">name = #{name},</if>
  169. <if test="employeeid != null">employeeid = #{employeeid},</if>
  170. <if test="classes != null">classes = #{classes},</if>
  171. <if test="companysafe != null">companysafe = #{companysafe},</if>
  172. <if test="plantsafe != null">plantsafe = #{plantsafe},</if>
  173. <if test="teamsafe != null">teamsafe = #{teamsafe},</if>
  174. <if test="sub == 'true'">sub = 10,</if>
  175. <if test="cracking == 'true'">cracking = 10,</if>
  176. <if test="hotarea == 'true'">hotarea = 10,</if>
  177. <if test="coldarea == 'true'">coldarea = 10,</if>
  178. <if test="aeupgu == 'true'">aeupgu = 10,</if>
  179. <if test="sub == 'false'">sub = NULL,</if>
  180. <if test="cracking == 'false'">cracking = NULL,</if>
  181. <if test="hotarea == 'false'">hotarea = NULL,</if>
  182. <if test="coldarea == 'false'">coldarea = NULL,</if>
  183. <if test="aeupgu == 'false'">aeupgu = NULL,</if>
  184. <if test="upscore != null">upscore = #{upscore},</if>
  185. <if test="downscore != null">downscore = #{downscore},</if>
  186. <if test="delFlag != null">del_flag = #{delFlag},</if>
  187. <if test="createrCode != null">creater_code = #{createrCode},</if>
  188. <if test="createdate != null">createdate = #{createdate},</if>
  189. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  190. <if test="updatedate != null">updatedate = #{updatedate},</if>
  191. <if test="remarks != null">remarks = #{remarks},</if>
  192. <if test="deptId != null">dept_id = #{deptId},</if>
  193. <if test="onboard != null">onboard = #{onboard},</if>
  194. <if test="tds != null">tds = #{tds},</if>
  195. <if test="postCard != null">post_card = #{postCard },</if>
  196. <if test="craft != null">craft = #{craft},</if>
  197. <if test="company != null">company = #{company},</if>
  198. <if test="device != null">device = #{device},</if>
  199. <if test="staffId != null">staff_id = #{staffId},</if>
  200. </trim>
  201. where id = #{id}
  202. </update>
  203. <update id="deleteTTrainingrecordsById" parameterType="Long">
  204. update t_trainingrecords set del_flag = 2 where id = #{id}
  205. </update>
  206. <update id="deleteTTrainingrecordsByIds" parameterType="String">
  207. update t_trainingrecords set del_flag = 2 where id in
  208. <foreach item="id" collection="array" open="(" separator="," close=")">
  209. #{id}
  210. </foreach>
  211. </update>
  212. <select id="queryNeedDeleteIds" resultType="String">
  213. SELECT b.EMPLOYEEID from t_trainingrecords b where b.del_flag = 0
  214. minus
  215. SELECT a.STAFFID FROM "T_STAFFMGR" a where a.del_flag = 0 and unit in (10,20,30)
  216. </select>
  217. <select id="queryNeedInsertIds" resultType="String">
  218. SELECT a.STAFFID FROM "T_STAFFMGR" a where a.del_flag = 0 and unit in (10,20,30)
  219. minus
  220. SELECT b.EMPLOYEEID from t_trainingrecords b where b.del_flag = 0
  221. </select>
  222. </mapper>