TStYearplanMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.TStYearplanMapper">
  6. <resultMap type="TStYearplan" id="TStYearplanResult">
  7. <result property="id" column="id" />
  8. <result property="staffId" column="staff_id" />
  9. <result property="name" column="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="approveStatus" column="approve_status" />
  17. <result property="deptName" column="dept_name" />
  18. <result property="planYear" column="plan_year" />
  19. <result property="staffName" column="nick_name" />
  20. </resultMap>
  21. <sql id="selectTStYearplanVo">
  22. select d.id, d.staff_id,u.nick_name, d.name,d.plan_year, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.approve_status ,s.dept_name from t_st_yearplan d
  23. left join sys_dept s on s.dept_id = d.dept_id
  24. left join sys_user u on d.staff_id = u.staffid
  25. left join T_ST_SUCCESSOR suc on d.STAFF_ID = suc.STAFF_ID
  26. </sql>
  27. <select id="selectTStYearplanList" parameterType="TStYearplan" resultMap="TStYearplanResult">
  28. <include refid="selectTStYearplanVo"/>
  29. <where>
  30. <if test="staffId != null and staffId != ''"> and staff_id = #{staffId}</if>
  31. <if test="name != null and name != ''"> and name like concat(concat('%', #{name}), '%')</if>
  32. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  33. <if test="createdate != null "> and createdate = #{createdate}</if>
  34. <if test="updaterCode != null and updaterCode != ''"> and updater_code = #{updaterCode}</if>
  35. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  36. <if test="deptId != null "> and dept_id = #{deptId}</if>
  37. <if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
  38. <if test="planYear != null "> and plan_year = #{planYear}</if>
  39. <if test="mentorStaffId != null and mentorStaffId != ''"> and mentor_staff_id = #{mentorStaffId}</if>
  40. and d.del_flag = 0
  41. </where>
  42. <!-- 数据范围过滤 -->
  43. ${params.dataScope}
  44. </select>
  45. <select id="selectTStYearplanById" parameterType="Long" resultMap="TStYearplanResult">
  46. <include refid="selectTStYearplanVo"/>
  47. where d.id = #{id}
  48. </select>
  49. <select id="selectTStYearPlanExist" parameterType="TStYearplan" resultMap="TStYearplanResult">
  50. select
  51. d.id
  52. from t_st_yearplan d
  53. where d.staff_id = #{staffId} and d.plan_year = #{planYear}
  54. and d.del_flag = 0
  55. </select>
  56. <insert id="insertTStYearplan" parameterType="TStYearplan">
  57. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  58. SELECT seq_t_st_yearplan.NEXTVAL as id FROM DUAL
  59. </selectKey>
  60. insert into t_st_yearplan
  61. <trim prefix="(" suffix=")" suffixOverrides=",">
  62. <if test="id != null">id,</if>
  63. <if test="staffId != null">staff_id,</if>
  64. <if test="name != null">name,</if>
  65. <if test="delFlag != null">del_flag,</if>
  66. <if test="createrCode != null">creater_code,</if>
  67. <if test="createdate != null">createdate,</if>
  68. <if test="updaterCode != null">updater_code,</if>
  69. <if test="updatedate != null">updatedate,</if>
  70. <if test="deptId != null">dept_id,</if>
  71. <if test="approveStatus != null">approve_status,</if>
  72. <if test="planYear != null">plan_year,</if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="id != null">#{id},</if>
  76. <if test="staffId != null">#{staffId},</if>
  77. <if test="name != null">#{name},</if>
  78. <if test="delFlag != null">#{delFlag},</if>
  79. <if test="createrCode != null">#{createrCode},</if>
  80. <if test="createdate != null">#{createdate},</if>
  81. <if test="updaterCode != null">#{updaterCode},</if>
  82. <if test="updatedate != null">#{updatedate},</if>
  83. <if test="deptId != null">#{deptId},</if>
  84. <if test="approveStatus != null">#{approveStatus},</if>
  85. <if test="planYear != null">#{planYear},</if>
  86. </trim>
  87. </insert>
  88. <update id="updateTStYearplan" parameterType="TStYearplan">
  89. update t_st_yearplan
  90. <trim prefix="SET" suffixOverrides=",">
  91. <if test="staffId != null">staff_id = #{staffId},</if>
  92. <if test="name != null">name = #{name},</if>
  93. <if test="delFlag != null">del_flag = #{delFlag},</if>
  94. <if test="createrCode != null">creater_code = #{createrCode},</if>
  95. <if test="createdate != null">createdate = #{createdate},</if>
  96. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  97. <if test="updatedate != null">updatedate = #{updatedate},</if>
  98. <if test="deptId != null">dept_id = #{deptId},</if>
  99. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  100. <if test="planYear != null">plan_year = #{planYear},</if>
  101. </trim>
  102. where id = #{id}
  103. </update>
  104. <update id="deleteTStYearplanById" parameterType="Long">
  105. update t_st_yearplan set del_flag = 2 where id = #{id}
  106. </update>
  107. <update id="deleteTStYearplanByStaffId" parameterType="String">
  108. update t_st_yearplan set del_flag = 2 where staff_id = #{staffId}
  109. </update>
  110. <update id="deleteTStYearplanByIds" parameterType="String">
  111. update t_st_yearplan set del_flag = 2 where id in
  112. <foreach item="id" collection="array" open="(" separator="," close=")">
  113. #{id}
  114. </foreach>
  115. </update>
  116. </mapper>