TTrainingbccDeviceMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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.TTrainingbccDeviceMapper">
  6. <resultMap type="TTrainingbccDevice" id="TTrainingbccDeviceResult">
  7. <result property="id" column="id" />
  8. <result property="staffId" column="staff_id" />
  9. <result property="regularId" column="regular_id" />
  10. <result property="startDate" column="start_date" />
  11. <result property="remarks" column="remarks" />
  12. <result property="delFlag" column="del_flag" />
  13. <result property="createrCode" column="creater_code" />
  14. <result property="createdate" column="createdate" />
  15. <result property="updaterCode" column="updater_code" />
  16. <result property="updatedate" column="updatedate" />
  17. <result property="supplementary" column="supplementary" />
  18. <result property="learnState" column="learn_state" />
  19. <result property="examState" column="exam_state" />
  20. <result property="examId" column="exam_id" />
  21. <result property="examNum" column="exam_num" />
  22. <result property="learnTime" column="learn_time" />
  23. <result property="finishDate" column="finish_date" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="team" column="team" />
  26. </resultMap>
  27. <sql id="selectTTrainingbccDeviceVo">
  28. select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date from t_trainingbcc_device d
  29. left join t_staffmgr s on s.staffid = d.staff_id
  30. </sql>
  31. <select id="selectTTrainingbccDeviceList" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
  32. select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, s.team from t_trainingbcc_device d
  33. left join t_staffmgr s on s.staffid = d.staff_id
  34. left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
  35. <where>
  36. <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} and d.exam_state != 1 and ((ADD_MONTHS(TRUNC(SYSDATE, 'MM'), 1) > t.course_startdate and t.course_enddate >= SYSDATE) or (d.supplementary = 1 and d.exam_state = 0)) </if>
  37. <if test="regularId != null "> and d.regular_id = #{regularId}</if>
  38. <if test="startDate != null "> and d.start_date = #{startDate}</if>
  39. <if test="team != null and team != ''"> and s.team = #{team}</if>
  40. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  41. <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
  42. <if test="createdate != null "> and d.createdate = #{createdate}</if>
  43. <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
  44. <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
  45. <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
  46. <if test="learnState != null "> and d.learn_state = #{learnState}</if>
  47. <if test="examState != null "> and d.exam_state = #{examState}</if>
  48. <if test="examId != null "> and d.exam_id = #{examId}</if>
  49. <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
  50. <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
  51. and d.del_flag = 0
  52. </where>
  53. order by d.exam_state, d.start_date
  54. </select>
  55. <select id="selectTTrainingbccDeviceByReguar" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
  56. select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date, s.team from t_trainingbcc_device d
  57. left join t_staffmgr s on s.staffid = d.staff_id
  58. left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
  59. <where>
  60. <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} </if>
  61. <if test="regularId != null "> and d.regular_id = #{regularId}</if>
  62. <if test="startDate != null "> and d.start_date = #{startDate}</if>
  63. <if test="team != null and team != ''"> and s.team = #{team}</if>
  64. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  65. <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
  66. <if test="createdate != null "> and d.createdate = #{createdate}</if>
  67. <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
  68. <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
  69. <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
  70. <if test="learnState != null "> and d.learn_state = #{learnState}</if>
  71. <if test="examState != null "> and d.exam_state = #{examState}</if>
  72. <if test="examId != null "> and d.exam_id = #{examId}</if>
  73. <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
  74. <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
  75. and d.del_flag = 0
  76. </where>
  77. order by d.exam_state, d.start_date
  78. </select>
  79. <select id="sortSelectTTrainingbccDeviceList" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
  80. select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date from t_trainingbcc_device d
  81. left join t_staffmgr s on s.staffid = d.staff_id
  82. left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
  83. Left join SYS_DICT_DATA s0 on s.UNIT = s0.DICT_VALUE and s0.DICT_TYPE ='STAFF_UNIT'
  84. LEFT JOIN SYS_DICT_DATA s2 on s.ACTUALPOST = s2.DICT_VALUE and s2.DICT_TYPE = 'ACTUALPOST'
  85. LEFT JOIN SYS_DICT_DATA s1 on s.team = s1.DICT_VALUE and s1.DICT_TYPE = 'TEAM_DIVIDE'
  86. <where>
  87. <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} and d.exam_state != 1 and ((ADD_MONTHS(TRUNC(SYSDATE, 'MM'), 1) > t.course_startdate and t.course_enddate >= SYSDATE) or (d.supplementary = 1 and d.exam_state = 0)) </if>
  88. <if test="regularId != null "> and d.regular_id = #{regularId}</if>
  89. <if test="startDate != null "> and d.start_date = #{startDate}</if>
  90. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  91. <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
  92. <if test="createdate != null "> and d.createdate = #{createdate}</if>
  93. <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
  94. <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
  95. <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
  96. <if test="learnState != null "> and d.learn_state = #{learnState}</if>
  97. <if test="examState != null "> and d.exam_state = #{examState}</if>
  98. <if test="examId != null "> and d.exam_id = #{examId}</if>
  99. <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
  100. <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
  101. and d.del_flag = 0
  102. </where>
  103. ORDER BY d.del_flag, s0.DICT_SORT, s1.DICT_SORT ,s2.DICT_SORT
  104. </select>
  105. <select id="selectTTrainingbccDeviceById" parameterType="Long" resultMap="TTrainingbccDeviceResult">
  106. <include refid="selectTTrainingbccDeviceVo"/>
  107. where d.id = #{id}
  108. </select>
  109. <insert id="insertTTrainingbccDevice" parameterType="TTrainingbccDevice">
  110. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  111. SELECT seq_t_trainingbcc_device.NEXTVAL as id FROM DUAL
  112. </selectKey>
  113. insert into t_trainingbcc_device
  114. <trim prefix="(" suffix=")" suffixOverrides=",">
  115. <if test="id != null">id,</if>
  116. <if test="staffId != null">staff_id,</if>
  117. <if test="regularId != null">regular_id,</if>
  118. <if test="startDate != null">start_date,</if>
  119. <if test="remarks != null">remarks,</if>
  120. <if test="delFlag != null">del_flag,</if>
  121. <if test="createrCode != null">creater_code,</if>
  122. <if test="createdate != null">createdate,</if>
  123. <if test="updaterCode != null">updater_code,</if>
  124. <if test="updatedate != null">updatedate,</if>
  125. <if test="supplementary != null">supplementary,</if>
  126. <if test="learnState != null">learn_state,</if>
  127. <if test="examState != null">exam_state,</if>
  128. <if test="examId != null">exam_id,</if>
  129. <if test="learnTime != null">learn_time,</if>
  130. <if test="finishDate != null">finish_date,</if>
  131. </trim>
  132. <trim prefix="values (" suffix=")" suffixOverrides=",">
  133. <if test="id != null">#{id},</if>
  134. <if test="staffId != null">#{staffId},</if>
  135. <if test="regularId != null">#{regularId},</if>
  136. <if test="startDate != null">#{startDate},</if>
  137. <if test="remarks != null">#{remarks},</if>
  138. <if test="delFlag != null">#{delFlag},</if>
  139. <if test="createrCode != null">#{createrCode},</if>
  140. <if test="createdate != null">#{createdate},</if>
  141. <if test="updaterCode != null">#{updaterCode},</if>
  142. <if test="updatedate != null">#{updatedate},</if>
  143. <if test="supplementary != null">#{supplementary},</if>
  144. <if test="learnState != null">#{learnState},</if>
  145. <if test="examState != null">#{examState},</if>
  146. <if test="examId != null">#{examId},</if>
  147. <if test="learnTime != null">#{learnTime},</if>
  148. <if test="finishDate != null">#{finishDate},</if>
  149. </trim>
  150. </insert>
  151. <update id="updateTTrainingbccDevice" parameterType="TTrainingbccDevice">
  152. update t_trainingbcc_device
  153. <trim prefix="SET" suffixOverrides=",">
  154. <if test="staffId != null">staff_id = #{staffId},</if>
  155. <if test="regularId != null">regular_id = #{regularId},</if>
  156. <if test="startDate != null">start_date = #{startDate},</if>
  157. <if test="remarks != null">remarks = #{remarks},</if>
  158. <if test="delFlag != null">del_flag = #{delFlag},</if>
  159. <if test="createrCode != null">creater_code = #{createrCode},</if>
  160. <if test="createdate != null">createdate = #{createdate},</if>
  161. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  162. <if test="updatedate != null">updatedate = #{updatedate},</if>
  163. <if test="supplementary != null">supplementary = #{supplementary},</if>
  164. <if test="learnState != null">learn_state = #{learnState},</if>
  165. <if test="examState != null">exam_state = #{examState},</if>
  166. <if test="examId != null">exam_id = #{examId},</if>
  167. <if test="examNum != null">exam_num = #{examNum},</if>
  168. <if test="learnTime != null">learn_time = #{learnTime},</if>
  169. <if test="finishDate != null">finish_date = #{finishDate},</if>
  170. </trim>
  171. where id = #{id}
  172. </update>
  173. <update id="deleteTTrainingbccDeviceById" parameterType="Long">
  174. update t_trainingbcc_device set del_flag = 2 where id = #{id}
  175. </update>
  176. <update id="deleteTTrainingbccDeviceByStaff" parameterType="TTrainingbccDevice">
  177. update t_trainingbcc_device set del_flag = 2 where staff_id = #{staffId} and regular_id = #{regularId}
  178. </update>
  179. <update id="deleteTTrainingbccDeviceByIds" parameterType="String">
  180. update t_trainingbcc_device set del_flag = 2 where id in
  181. <foreach item="id" collection="array" open="(" separator="," close=")">
  182. #{id}
  183. </foreach>
  184. </update>
  185. <update id="deleteTTrainingbccDeviceByTrainingbcc" parameterType="String">
  186. update t_trainingbcc_device set del_flag = 2 where regular_id in
  187. <foreach item="id" collection="array" open="(" separator="," close=")">
  188. #{id}
  189. </foreach>
  190. </update>
  191. <select id="countTraining" parameterType="TTrainingbccDevice" resultType="int">
  192. select count(1) from t_trainingbcc_device
  193. <where>
  194. <if test="regularId != null "> and regular_id = #{regularId}</if>
  195. <if test="examState != null "> and exam_state = #{examState}</if>
  196. and del_flag = 0
  197. </where>
  198. </select>
  199. </mapper>