TTrainingDeviceMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.TTrainingDeviceMapper">
  6. <resultMap type="TTrainingDevice" id="TTrainingDeviceResult">
  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="courseCode" column="courseid" />
  18. <result property="item" column="course" />
  19. <result property="planTrainingdate" column="course_startdate" />
  20. <result property="lecturer" column="trainer" />
  21. <result property="lecturerName" column="name" />
  22. <result property="hour" column="duration" />
  23. <result property="year" column="years" />
  24. <result property="supplementary" column="supplementary" />
  25. </resultMap>
  26. <sql id="selectTTrainingDeviceVo">
  27. select d.id, s.name, t.courseid, t.course, t.course_startdate, t.trainer, t.duration, t.years, 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 from t_training_device d
  28. left join t_training t on t.id = d.regular_id
  29. left join t_staffmgr s on s.staffid = t.trainer
  30. </sql>
  31. <select id="selectTTrainingDeviceList" parameterType="TTrainingDevice" resultMap="TTrainingDeviceResult">
  32. <include refid="selectTTrainingDeviceVo"/>
  33. <where>
  34. <if test="staffId != null and staffId != ''"> and staff_id = #{staffId}</if>
  35. <if test="regularId != null "> and d.regular_id = #{regularId}</if>
  36. <if test="startDate != null "> and start_date = #{startDate}</if>
  37. <if test="year != null and year != ''"> and t.years = #{year}</if>
  38. <if test="trainingType != null and trainingType != ''"> and t.training_type = #{trainingType}</if>
  39. and d.del_flag = 0
  40. </where>
  41. </select>
  42. <select id="selectTTrainingDeviceById" parameterType="Long" resultMap="TTrainingDeviceResult">
  43. <include refid="selectTTrainingDeviceVo"/>
  44. where d.id = #{id}
  45. </select>
  46. <insert id="insertTTrainingDevice" parameterType="TTrainingDevice">
  47. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  48. SELECT seq_t_training_device.NEXTVAL as id FROM DUAL
  49. </selectKey>
  50. insert into t_training_device
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="id != null">id,</if>
  53. <if test="staffId != null">staff_id,</if>
  54. <if test="regularId != null">regular_id,</if>
  55. <if test="startDate != null">start_date,</if>
  56. <if test="remarks != null">remarks,</if>
  57. <if test="delFlag != null">del_flag,</if>
  58. <if test="createrCode != null">creater_code,</if>
  59. <if test="createdate != null">createdate,</if>
  60. <if test="updaterCode != null">updater_code,</if>
  61. <if test="updatedate != null">updatedate,</if>
  62. <if test="supplementary != null">supplementary,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="id != null">#{id},</if>
  66. <if test="staffId != null">#{staffId},</if>
  67. <if test="regularId != null">#{regularId},</if>
  68. <if test="startDate != null">#{startDate},</if>
  69. <if test="remarks != null">#{remarks},</if>
  70. <if test="delFlag != null">#{delFlag},</if>
  71. <if test="createrCode != null">#{createrCode},</if>
  72. <if test="createdate != null">#{createdate},</if>
  73. <if test="updaterCode != null">#{updaterCode},</if>
  74. <if test="updatedate != null">#{updatedate},</if>
  75. <if test="supplementary != null">#{supplementary},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateTTrainingDevice" parameterType="TTrainingDevice">
  79. update t_training_device
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="staffId != null">staff_id = #{staffId},</if>
  82. <if test="regularId != null">regular_id = #{regularId},</if>
  83. <if test="startDate != null">start_date = #{startDate},</if>
  84. <if test="startDate == null">start_date = NULL,</if>
  85. <if test="remarks != null">remarks = #{remarks},</if>
  86. <if test="delFlag != null">del_flag = #{delFlag},</if>
  87. <if test="createrCode != null">creater_code = #{createrCode},</if>
  88. <if test="createdate != null">createdate = #{createdate},</if>
  89. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  90. <if test="updatedate != null">updatedate = #{updatedate},</if>
  91. <if test="supplementary != null">supplementary = #{supplementary},</if>
  92. </trim>
  93. where id = #{id}
  94. </update>
  95. <update id="deleteTTrainingDeviceById" parameterType="Long">
  96. update t_training_device set del_flag = 2 where id = #{id}
  97. </update>
  98. <update id="deleteTTrainingDevice" parameterType="TTrainingDevice">
  99. update t_training_device set del_flag = 2 where regular_id = #{regularId}
  100. </update>
  101. <update id="deleteTTrainingDeviceByIds" parameterType="String">
  102. update t_training_device set del_flag = 2 where id in
  103. <foreach item="id" collection="array" open="(" separator="," close=")">
  104. #{id}
  105. </foreach>
  106. </update>
  107. </mapper>