WorkStaffTrainingDao.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.jeeplus.modules.workstaff.dao.WorkStaffTrainingDao">
  4. <sql id="workStaffTrainingColumns">
  5. a.id AS "id",
  6. a.create_by AS "createBy.id",
  7. a.create_date AS "createDate",
  8. a.update_by AS "updateBy.id",
  9. a.update_date AS "updateDate",
  10. a.remarks AS "remarks",
  11. a.del_flag AS "delFlag",
  12. a.staff_id AS "staff",
  13. a.name AS "name",
  14. a.agency AS "agency",
  15. a.address AS "address",
  16. a.start_date AS "startDate",
  17. a.end_date AS "endDate",
  18. a.type AS "type",
  19. a.hours AS "hours",
  20. a.certificate AS "certificate",
  21. a.file_path AS "filePath",
  22. a.file_name AS "fileName"
  23. </sql>
  24. <sql id="workStaffTrainingJoins">
  25. </sql>
  26. <select id="get" resultType="WorkStaffTraining" >
  27. SELECT
  28. <include refid="workStaffTrainingColumns"/>
  29. FROM work_staff_training a
  30. <include refid="workStaffTrainingJoins"/>
  31. WHERE a.id = #{id}
  32. </select>
  33. <select id="findList" resultType="WorkStaffTraining" >
  34. SELECT
  35. <include refid="workStaffTrainingColumns"/>
  36. FROM work_staff_training a
  37. <include refid="workStaffTrainingJoins"/>
  38. <where>
  39. a.del_flag = #{DEL_FLAG_NORMAL}
  40. <if test="staff !=null and staff !=''">
  41. AND a.staff_id = #{staff}
  42. </if>
  43. </where>
  44. <choose>
  45. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  46. ORDER BY ${page.orderBy}
  47. </when>
  48. <otherwise>
  49. ORDER BY a.update_date DESC
  50. </otherwise>
  51. </choose>
  52. </select>
  53. <select id="findAllList" resultType="WorkStaffTraining" >
  54. SELECT
  55. <include refid="workStaffTrainingColumns"/>
  56. FROM work_staff_training a
  57. <include refid="workStaffTrainingJoins"/>
  58. <where>
  59. a.del_flag = #{DEL_FLAG_NORMAL}
  60. </where>
  61. <choose>
  62. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  63. ORDER BY ${page.orderBy}
  64. </when>
  65. <otherwise>
  66. ORDER BY a.update_date DESC
  67. </otherwise>
  68. </choose>
  69. </select>
  70. <insert id="insert">
  71. INSERT INTO work_staff_training(
  72. id,
  73. create_by,
  74. create_date,
  75. update_by,
  76. update_date,
  77. remarks,
  78. del_flag,
  79. staff_id,
  80. name,
  81. agency,
  82. address,
  83. start_date,
  84. end_date,
  85. type,
  86. hours,
  87. certificate,
  88. file_path,
  89. file_name
  90. ) VALUES (
  91. #{id},
  92. #{createBy.id},
  93. #{createDate},
  94. #{updateBy.id},
  95. #{updateDate},
  96. #{remarks},
  97. #{delFlag},
  98. #{staff},
  99. #{name},
  100. #{agency},
  101. #{address},
  102. #{startDate},
  103. #{endDate},
  104. #{type},
  105. #{hours},
  106. #{certificate},
  107. #{filePath},
  108. #{fileName}
  109. )
  110. </insert>
  111. <update id="update">
  112. UPDATE work_staff_training SET
  113. update_by = #{updateBy.id},
  114. update_date = #{updateDate},
  115. remarks = #{remarks},
  116. staff_id = #{staff},
  117. name = #{name},
  118. agency = #{agency},
  119. address = #{address},
  120. start_date = #{startDate},
  121. end_date = #{endDate},
  122. type = #{type},
  123. hours = #{hours},
  124. certificate = #{certificate},
  125. file_path = #{filePath},
  126. file_name = #{fileName}
  127. WHERE id = #{id}
  128. </update>
  129. <!--物理删除-->
  130. <update id="delete">
  131. DELETE FROM work_staff_training
  132. WHERE id = #{id}
  133. </update>
  134. <!--逻辑删除-->
  135. <update id="deleteByLogic">
  136. UPDATE work_staff_training SET
  137. del_flag = #{DEL_FLAG_DELETE}
  138. WHERE id = #{id}
  139. </update>
  140. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  141. <select id="findUniqueByProperty" resultType="WorkStaffTraining" statementType="STATEMENT">
  142. select * FROM work_staff_training where ${propertyName} = '${value}'
  143. </select>
  144. <update id="updateFalt" parameterType="java.lang.String">
  145. UPDATE work_staff_training SET
  146. del_flag = '1'
  147. WHERE id in (select l.son_id from work_staff_achives_log l
  148. where l.staff_id=#{id} and l.module='培训经历' and l.type='删除')
  149. </update>
  150. </mapper>