TStPlanMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 d.year_plan_id,u1.nick_name as updateBy , u2.nick_name as createBy ,d.date_of_completion, suc.MENTOR_STAFF_ID, d.overall_comment, d.score, d.id, d.staff_id,d.APPROVE_STATUS, u.nick_name, d.plant_name, d.del_flag, d.createdate, d.updatedate, d.dept_id, d.start_date, d.end_date, d.class_hour, d.class_content, d.study_state ,s.dept_name from t_st_plan d
  30. left join sys_dept s on s.dept_id = d.dept_id
  31. left join sys_user u on d.staff_id = u.staffid
  32. LEFT JOIN SYS_USER u1 on d.updater_code = u1.USER_ID
  33. LEFT JOIN SYS_USER u2 on d.creater_code = u2.USER_ID
  34. left join T_ST_SUCCESSOR suc on d.STAFF_ID = suc.STAFF_ID
  35. </sql>
  36. <select id="selectTStPlanList" parameterType="TStPlan" resultMap="TStPlanResult">
  37. <include refid="selectTStPlanVo"/>
  38. <where>
  39. <if test="yearPlanId != null and yearPlanId != ''"> and d.year_plan_id = #{yearPlanId}</if>
  40. <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId}</if>
  41. <if test="plantName != null and plantName != ''"> and plant_name like concat(concat('%', #{plantName}), '%')</if>
  42. <if test="startDate != null "> and start_date = #{startDate}</if>
  43. <if test="endDate != null "> and end_date = #{endDate}</if>
  44. <if test="classHour != null and classHour != ''"> and class_hour = #{classHour}</if>
  45. <if test="studyState != null and studyState != ''"> and study_state = #{studyState}</if>
  46. <if test="mentorStaffId != null and mentorStaffId != ''"> and mentor_staff_id = #{mentorStaffId}</if>
  47. and d.del_flag = 0
  48. </where>
  49. <!-- 数据范围过滤 -->
  50. </select>
  51. <select id="selectTStPlanById" parameterType="Long" resultMap="TStPlanResult">
  52. <include refid="selectTStPlanVo"/>
  53. where d.id = #{id}
  54. </select>
  55. <insert id="insertTStPlan" parameterType="TStPlan">
  56. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  57. SELECT seq_t_st_plan.NEXTVAL as id FROM DUAL
  58. </selectKey>
  59. insert into t_st_plan
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="id != null">id,</if>
  62. <if test="staffId != null">staff_id,</if>
  63. <if test="plantName != null">plant_name,</if>
  64. <if test="delFlag != null">del_flag,</if>
  65. <if test="createrCode != null">creater_code,</if>
  66. <if test="createdate != null">createdate,</if>
  67. <if test="updaterCode != null">updater_code,</if>
  68. <if test="updatedate != null">updatedate,</if>
  69. <if test="deptId != null">dept_id,</if>
  70. <if test="startDate != null">start_date,</if>
  71. <if test="endDate != null">end_date,</if>
  72. <if test="classHour != null">class_hour,</if>
  73. <if test="classContent != null">class_content,</if>
  74. <if test="studyState != null">study_state,</if>
  75. <if test="approveStatus != null">APPROVE_STATUS,</if>
  76. <if test="yearPlanId != null">year_plan_id,</if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="id != null">#{id},</if>
  80. <if test="staffId != null">#{staffId},</if>
  81. <if test="plantName != null">#{plantName},</if>
  82. <if test="delFlag != null">#{delFlag},</if>
  83. <if test="createrCode != null">#{createrCode},</if>
  84. <if test="createdate != null">#{createdate},</if>
  85. <if test="updaterCode != null">#{updaterCode},</if>
  86. <if test="updatedate != null">#{updatedate},</if>
  87. <if test="deptId != null">#{deptId},</if>
  88. <if test="startDate != null">#{startDate},</if>
  89. <if test="endDate != null">#{endDate},</if>
  90. <if test="classHour != null">#{classHour},</if>
  91. <if test="classContent != null">#{classContent},</if>
  92. <if test="studyState != null">#{studyState},</if>
  93. <if test="approveStatus != null">#{approveStatus},</if>
  94. <if test="yearPlanId != null">#{yearPlanId},</if>
  95. </trim>
  96. </insert>
  97. <update id="updateTStPlan" parameterType="TStPlan">
  98. update t_st_plan
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="staffId != null">staff_id = #{staffId},</if>
  101. <if test="plantName != null">plant_name = #{plantName},</if>
  102. <if test="delFlag != null">del_flag = #{delFlag},</if>
  103. <if test="createrCode != null">creater_code = #{createrCode},</if>
  104. <if test="createdate != null">createdate = #{createdate},</if>
  105. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  106. <if test="updatedate != null">updatedate = #{updatedate},</if>
  107. <if test="deptId != null">dept_id = #{deptId},</if>
  108. <if test="startDate != null">start_date = #{startDate},</if>
  109. <if test="endDate != null">end_date = #{endDate},</if>
  110. <if test="classHour != null">class_hour = #{classHour},</if>
  111. <if test="classContent != null">class_content = #{classContent},</if>
  112. <if test="studyState != null">study_state = #{studyState},</if>
  113. <if test="score != null">
  114. score = #{score},
  115. <!-- 王子文 2022年4月22日 添加 -->
  116. <!-- 导师反馈的同时更新实际完成培训日期为当前日期 -->
  117. date_of_completion = SYSDATE,
  118. </if>
  119. <if test="overallComment != null">overall_comment = #{overallComment},</if>
  120. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  121. <if test="dateOfCompletion != null"></if>
  122. </trim>
  123. where id = #{id}
  124. </update>
  125. <update id="deleteTStPlanById" parameterType="Long">
  126. update t_st_plan set del_flag = 2 where id = #{id}
  127. </update>
  128. <update id="deleteTStPlanByIds" parameterType="String">
  129. update t_st_plan set del_flag = 2 where id in
  130. <foreach item="id" collection="array" open="(" separator="," close=")">
  131. #{id}
  132. </foreach>
  133. </update>
  134. </mapper>