TStPlanMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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.spec.mapper.TStPlanMapper">
  6. <resultMap type="TStPlan" id="TStPlanResult">
  7. <result property="id" column="id" />
  8. <result property="staffId" column="staff_id" />
  9. <result property="staffName" column="nick_name" />
  10. <result property="delFlag" column="del_flag" />
  11. <result property="createrCode" column="creater_code" />
  12. <result property="createdate" column="createdate" />
  13. <result property="updaterCode" column="updater_code" />
  14. <result property="updatedate" column="updatedate" />
  15. <result property="deptId" column="dept_id" />
  16. <result property="startDate" column="start_date" />
  17. <result property="endDate" column="end_date" />
  18. <result property="classHour" column="class_hour" />
  19. <result property="classContent" column="class_content" />
  20. <result property="studyState" column="study_state" />
  21. <result property="deptName" column="dept_name" />
  22. <result property="score" column="score" />
  23. <result property="overallComment" column="overall_comment" />
  24. <result property="approveStatus" column="APPROVE_STATUS" />
  25. <result property="dateOfCompletion" column="date_of_completion" />
  26. <result property="yearPlanId" column="year_plan_id" />
  27. </resultMap>
  28. <sql id="selectTStPlanVo">
  29. select
  30. d.year_plan_id,
  31. d.date_of_completion,
  32. d.overall_comment,
  33. d.score,
  34. d.id,
  35. d.staff_id,
  36. d.APPROVE_STATUS,
  37. u.nick_name,
  38. d.plant_name,
  39. d.del_flag,
  40. d.createdate,
  41. d.updatedate,
  42. d.dept_id,
  43. d.start_date,
  44. d.end_date,
  45. d.class_hour,
  46. d.class_content,
  47. d.study_state,
  48. u1.nick_name as updateBy,
  49. u2.nick_name as createBy,
  50. s.dept_name,
  51. suc.MENTOR_STAFF_ID
  52. from t_st_plan d
  53. left join sys_dept s on s.dept_id = d.dept_id
  54. left join sys_user u on d.staff_id = u.staffid
  55. LEFT JOIN SYS_USER u1 on d.updater_code = u1.USER_ID
  56. LEFT JOIN SYS_USER u2 on d.creater_code = u2.USER_ID
  57. left join T_ST_SUCCESSOR suc on d.STAFF_ID = suc.STAFF_ID
  58. </sql>
  59. <!-- 查询月度培训计划列表 -->
  60. <select id="selectMonthlyTStPlanList" parameterType="TStFeedback" resultMap="TStPlanResult">
  61. <include refid="selectTStPlanVo"/>
  62. <where>
  63. d.staff_id = #{successorId}
  64. <if test="feedbackYear != null and feedbackYear != ''">
  65. and extract(year from d.start_date) = #{feedbackYear}
  66. </if>
  67. <if test="feedbackMonth != null and feedbackMonth != ''">
  68. and extract(month from d.start_date) &lt;= #{feedbackMonth}
  69. and extract(month from d.end_date) &gt;= #{feedbackMonth}
  70. </if>
  71. and d.del_flag = 0
  72. <!-- 数据范围过滤 -->
  73. ${params.dataScope}
  74. </where>
  75. order by d.start_date
  76. </select>
  77. <select id="selectTStPlanList" parameterType="TStPlan" resultMap="TStPlanResult">
  78. <include refid="selectTStPlanVo"/>
  79. <where>
  80. <if test="yearPlanId != null and yearPlanId != ''"> and d.year_plan_id = #{yearPlanId}</if>
  81. <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId}</if>
  82. <if test="plantName != null and plantName != ''"> and plant_name like concat(concat('%', #{plantName}), '%')</if>
  83. <if test="startDate != null "> and start_date = #{startDate}</if>
  84. <if test="endDate != null "> and end_date = #{endDate}</if>
  85. <if test="classHour != null and classHour != ''"> and class_hour = #{classHour}</if>
  86. <if test="studyState != null and studyState != ''"> and study_state = #{studyState}</if>
  87. <if test="mentorStaffId != null and mentorStaffId != ''"> and mentor_staff_id = #{mentorStaffId}</if>
  88. and d.del_flag = 0
  89. </where>
  90. <!-- 数据范围过滤 -->
  91. ${params.dataScope}
  92. </select>
  93. <select id="selectTStPlanById" parameterType="Long" resultMap="TStPlanResult">
  94. <include refid="selectTStPlanVo"/>
  95. where d.id = #{id}
  96. </select>
  97. <insert id="insertTStPlan" parameterType="TStPlan">
  98. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  99. SELECT seq_t_st_plan.NEXTVAL as id FROM DUAL
  100. </selectKey>
  101. insert into t_st_plan
  102. <trim prefix="(" suffix=")" suffixOverrides=",">
  103. <if test="id != null">id,</if>
  104. <if test="staffId != null">staff_id,</if>
  105. <if test="plantName != null">plant_name,</if>
  106. <if test="delFlag != null">del_flag,</if>
  107. <if test="createrCode != null">creater_code,</if>
  108. <if test="createdate != null">createdate,</if>
  109. <if test="updaterCode != null">updater_code,</if>
  110. <if test="updatedate != null">updatedate,</if>
  111. <if test="deptId != null">dept_id,</if>
  112. <if test="startDate != null">start_date,</if>
  113. <if test="endDate != null">end_date,</if>
  114. <if test="classHour != null">class_hour,</if>
  115. <if test="classContent != null">class_content,</if>
  116. <if test="studyState != null">study_state,</if>
  117. <if test="approveStatus != null">APPROVE_STATUS,</if>
  118. <if test="yearPlanId != null">year_plan_id,</if>
  119. </trim>
  120. <trim prefix="values (" suffix=")" suffixOverrides=",">
  121. <if test="id != null">#{id},</if>
  122. <if test="staffId != null">#{staffId},</if>
  123. <if test="plantName != null">#{plantName},</if>
  124. <if test="delFlag != null">#{delFlag},</if>
  125. <if test="createrCode != null">#{createrCode},</if>
  126. <if test="createdate != null">#{createdate},</if>
  127. <if test="updaterCode != null">#{updaterCode},</if>
  128. <if test="updatedate != null">#{updatedate},</if>
  129. <if test="deptId != null">#{deptId},</if>
  130. <if test="startDate != null">#{startDate},</if>
  131. <if test="endDate != null">#{endDate},</if>
  132. <if test="classHour != null">#{classHour},</if>
  133. <if test="classContent != null">#{classContent},</if>
  134. <if test="studyState != null">#{studyState},</if>
  135. <if test="approveStatus != null">#{approveStatus},</if>
  136. <if test="yearPlanId != null">#{yearPlanId},</if>
  137. </trim>
  138. </insert>
  139. <update id="updateTStPlan" parameterType="TStPlan">
  140. update t_st_plan
  141. <trim prefix="SET" suffixOverrides=",">
  142. <if test="staffId != null">staff_id = #{staffId},</if>
  143. <if test="plantName != null">plant_name = #{plantName},</if>
  144. <if test="delFlag != null">del_flag = #{delFlag},</if>
  145. <if test="createrCode != null">creater_code = #{createrCode},</if>
  146. <if test="createdate != null">createdate = #{createdate},</if>
  147. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  148. <if test="updatedate != null">updatedate = #{updatedate},</if>
  149. <if test="deptId != null">dept_id = #{deptId},</if>
  150. <if test="startDate != null">start_date = #{startDate},</if>
  151. <if test="endDate != null">end_date = #{endDate},</if>
  152. <if test="classHour != null">class_hour = #{classHour},</if>
  153. <if test="classContent != null">class_content = #{classContent},</if>
  154. <if test="studyState != null">study_state = #{studyState},</if>
  155. <if test="score != null">
  156. score = #{score},
  157. <!-- 导师反馈的同时更新实际完成培训日期为当前日期 -->
  158. date_of_completion = SYSDATE,
  159. </if>
  160. <if test="overallComment != null">overall_comment = #{overallComment},</if>
  161. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  162. <if test="dateOfCompletion != null"></if>
  163. </trim>
  164. where id = #{id}
  165. </update>
  166. <update id="deleteTStPlanById" parameterType="Long">
  167. update t_st_plan set del_flag = 2 where id = #{id}
  168. </update>
  169. <update id="deleteTStPlanByIds" parameterType="String">
  170. update t_st_plan set del_flag = 2 where id in
  171. <foreach item="id" collection="array" open="(" separator="," close=")">
  172. #{id}
  173. </foreach>
  174. </update>
  175. </mapper>