TStSuccessorMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.TStSuccessorMapper">
  6. <resultMap type="TStSuccessor" id="TStSuccessorResult">
  7. <result property="id" column="id" />
  8. <result property="staffId" column="staff_id" />
  9. <result property="remarks" column="remarks" />
  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="actualpost" column="actualpost" />
  17. <result property="mentorStaffId" column="mentor_staff_id" />
  18. <result property="state" column="state" />
  19. <result property="deptName" column="dept_name" />
  20. </resultMap>
  21. <sql id="selectTStSuccessorVo">
  22. select d.id, d.staff_id,t.name as staffName,m.name as mentorStaffName, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.actualpost, d.mentor_staff_id, d.state ,s.dept_name
  23. from t_st_successor d
  24. left join sys_dept s on s.dept_id = d.dept_id
  25. left join t_staffmgr t on t.staffid = d.staff_id
  26. left join t_staffmgr m on m.staffid = d.mentor_staff_id
  27. </sql>
  28. <!--王子文 2022年4月18日-->
  29. <!--根据导师ID查询学员列表-->
  30. <select id="selectSuccessorListByMentorId" parameterType="TStSuccessor" resultMap="TStSuccessorResult">
  31. <include refid="selectTStSuccessorVo"/>
  32. <where>
  33. <if test="mentorStaffId != null and mentorStaffId != ''"> and mentor_staff_id = #{mentorStaffId}</if>
  34. and d.del_flag = 0
  35. </where>
  36. <!-- 数据范围过滤 -->
  37. </select>
  38. <!--根据学员ID查询导师列表-->
  39. <select id="selectMentorListByStaffId" parameterType="String" resultMap="TStSuccessorResult">
  40. <include refid="selectTStSuccessorVo"/>
  41. <where>
  42. <if test="mentorStaffId != null and mentorStaffId != ''"> and staff_id = #{staffId}</if>
  43. and d.del_flag = 0
  44. </where>
  45. <!-- 数据范围过滤 -->
  46. </select>
  47. <select id="selectTStSuccessorList" parameterType="TStSuccessor" resultMap="TStSuccessorResult">
  48. <include refid="selectTStSuccessorVo"/>
  49. <where>
  50. <if test="staffId != null and staffId != ''"> and staff_id = #{staffId}</if>
  51. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  52. <if test="mentorStaffId != null and mentorStaffId != ''"> and mentor_staff_id = #{mentorStaffId}</if>
  53. and d.del_flag = 0
  54. </where>
  55. <!-- 数据范围过滤 -->
  56. ${params.dataScope}
  57. </select>
  58. <select id="selectTStSuccessorById" parameterType="Long" resultMap="TStSuccessorResult">
  59. <include refid="selectTStSuccessorVo"/>
  60. where d.id = #{id}
  61. </select>
  62. <insert id="insertTStSuccessor" parameterType="TStSuccessor">
  63. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  64. SELECT seq_t_st_successor.NEXTVAL as id FROM DUAL
  65. </selectKey>
  66. insert into t_st_successor
  67. <trim prefix="(" suffix=")" suffixOverrides=",">
  68. <if test="id != null">id,</if>
  69. <if test="staffId != null">staff_id,</if>
  70. <if test="remarks != null">remarks,</if>
  71. <if test="delFlag != null">del_flag,</if>
  72. <if test="createrCode != null">creater_code,</if>
  73. <if test="createdate != null">createdate,</if>
  74. <if test="updaterCode != null">updater_code,</if>
  75. <if test="updatedate != null">updatedate,</if>
  76. <if test="deptId != null">dept_id,</if>
  77. <if test="actualpost != null">actualpost,</if>
  78. <if test="mentorStaffId != null">mentor_staff_id,</if>
  79. <if test="state != null">state,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="id != null">#{id},</if>
  83. <if test="staffId != null">#{staffId},</if>
  84. <if test="remarks != null">#{remarks},</if>
  85. <if test="delFlag != null">#{delFlag},</if>
  86. <if test="createrCode != null">#{createrCode},</if>
  87. <if test="createdate != null">#{createdate},</if>
  88. <if test="updaterCode != null">#{updaterCode},</if>
  89. <if test="updatedate != null">#{updatedate},</if>
  90. <if test="deptId != null">#{deptId},</if>
  91. <if test="actualpost != null">#{actualpost},</if>
  92. <if test="mentorStaffId != null">#{mentorStaffId},</if>
  93. <if test="state != null">#{state},</if>
  94. </trim>
  95. </insert>
  96. <update id="updateTStSuccessor" parameterType="TStSuccessor">
  97. update t_st_successor
  98. <trim prefix="SET" suffixOverrides=",">
  99. <if test="staffId != null">staff_id = #{staffId},</if>
  100. <if test="remarks != null">remarks = #{remarks},</if>
  101. <if test="delFlag != null">del_flag = #{delFlag},</if>
  102. <if test="createrCode != null">creater_code = #{createrCode},</if>
  103. <if test="createdate != null">createdate = #{createdate},</if>
  104. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  105. <if test="updatedate != null">updatedate = #{updatedate},</if>
  106. <if test="deptId != null">dept_id = #{deptId},</if>
  107. <if test="actualpost != null">actualpost = #{actualpost},</if>
  108. <if test="mentorStaffId != null">mentor_staff_id = #{mentorStaffId},</if>
  109. <if test="state != null">state = #{state},</if>
  110. </trim>
  111. where id = #{id}
  112. </update>
  113. <update id="deleteTStSuccessorById" parameterType="Long">
  114. update t_st_successor set del_flag = 2 where id = #{id}
  115. </update>
  116. <update id="deleteTStSuccessorByIds" parameterType="String">
  117. update t_st_successor set del_flag = 2 where id in
  118. <foreach item="id" collection="array" open="(" separator="," close=")">
  119. #{id}
  120. </foreach>
  121. </update>
  122. </mapper>