TestAuditDao.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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.oa.dao.TestAuditDao">
  4. <sql id="testAuditColumns">
  5. a.id,
  6. a.post,
  7. a.age,
  8. a.edu,
  9. a.content,
  10. a.olda,
  11. a.oldb,
  12. a.oldc,
  13. a.newa,
  14. a.newb,
  15. a.newc,
  16. a.add_num,
  17. a.exe_date,
  18. a.hr_text,
  19. a.lead_text,
  20. a.main_lead_text,
  21. a.proc_ins_id,
  22. u.id AS "user.id",
  23. u.name AS "user.name",
  24. o.id AS "office.id",
  25. o.name AS "office.name",
  26. a.create_by AS "createBy.id",
  27. a.create_date,
  28. a.update_by AS "updateBy.id",
  29. a.update_date,
  30. a.remarks,
  31. a.del_flag
  32. </sql>
  33. <sql id="testAuditJoins">
  34. JOIN sys_user u ON u.id=a.user_id
  35. JOIN sys_office o ON o.id=a.office_id
  36. </sql>
  37. <select id="get" resultType="TestAudit">
  38. SELECT
  39. <include refid="testAuditColumns"/>
  40. FROM oa_test_audit a
  41. <include refid="testAuditJoins"/>
  42. WHERE a.id = #{id}
  43. </select>
  44. <select id="getByProcInsId" resultType="TestAudit">
  45. SELECT
  46. <include refid="testAuditColumns"/>
  47. FROM oa_test_audit a
  48. <include refid="testAuditJoins"/>
  49. WHERE a.proc_ins_id = #{procInsId}
  50. </select>
  51. <select id="findList" resultType="TestAudit">
  52. SELECT
  53. <include refid="testAuditColumns"/>
  54. FROM oa_test_audit a
  55. <include refid="testAuditJoins"/>
  56. WHERE a.del_flag = #{DEL_FLAG_NORMAL}
  57. <if test="user != null and user.id != null and user.id != ''">
  58. AND u.id LIKE
  59. <if test="dbName == 'oracle'">'%'||#{user.id}||'%'</if>
  60. <if test="dbName == 'mysql'">CONCAT('%', #{user.id}, '%')</if>
  61. </if>
  62. ORDER BY a.update_date DESC
  63. </select>
  64. <select id="findAllList" resultType="TestAudit">
  65. SELECT
  66. <include refid="testAuditColumns"/>
  67. FROM oa_test_audit a
  68. <include refid="testAuditJoins"/>
  69. WHERE a.del_flag = #{DEL_FLAG_NORMAL}
  70. ORDER BY a.update_date DESC
  71. </select>
  72. <insert id="insert">
  73. INSERT INTO oa_test_audit(
  74. id,
  75. user_id,
  76. office_id,
  77. post,
  78. age,
  79. edu,
  80. content,
  81. olda,
  82. oldb,
  83. oldc,
  84. newa,
  85. newb,
  86. newc,
  87. add_num,
  88. exe_date,
  89. create_by,
  90. create_date,
  91. update_by,
  92. update_date,
  93. remarks,
  94. del_flag
  95. ) VALUES (
  96. #{id},
  97. #{user.id},
  98. #{office.id},
  99. #{post},
  100. #{age},
  101. #{edu},
  102. #{content},
  103. #{olda},
  104. #{oldb},
  105. #{oldc},
  106. #{newa},
  107. #{newb},
  108. #{newc},
  109. #{addNum},
  110. #{exeDate},
  111. #{createBy.id},
  112. #{createDate},
  113. #{updateBy.id},
  114. #{updateDate},
  115. #{remarks},
  116. #{delFlag}
  117. )
  118. </insert>
  119. <update id="update">
  120. UPDATE oa_test_audit SET
  121. user_id = #{user.id},
  122. office_id = #{office.id},
  123. post = #{post},
  124. age = #{age},
  125. edu = #{edu},
  126. content = #{content},
  127. olda = #{olda},
  128. oldb = #{oldb},
  129. oldc = #{oldc},
  130. newa = #{newa},
  131. newb = #{newb},
  132. newc = #{newc},
  133. add_num = #{addNum},
  134. exe_date = #{exeDate},
  135. update_by = #{updateBy.id},
  136. update_date = #{updateDate},
  137. remarks = #{remarks}
  138. WHERE id = #{id}
  139. </update>
  140. <update id="updateInsId">
  141. UPDATE oa_test_audit SET
  142. proc_ins_id = #{procInsId},
  143. update_by = #{updateBy.id},
  144. update_date = #{updateDate}
  145. WHERE id = #{id}
  146. </update>
  147. <update id="updateHrText">
  148. UPDATE oa_test_audit SET
  149. hr_text = #{hrText},
  150. update_by = #{updateBy.id},
  151. update_date = #{updateDate}
  152. WHERE id = #{id}
  153. </update>
  154. <update id="updateLeadText">
  155. UPDATE oa_test_audit SET
  156. lead_text = #{leadText},
  157. update_by = #{updateBy.id},
  158. update_date = #{updateDate}
  159. WHERE id = #{id}
  160. </update>
  161. <update id="updateMainLeadText">
  162. UPDATE oa_test_audit SET
  163. main_lead_text = #{mainLeadText},
  164. update_by = #{updateBy.id},
  165. update_date = #{updateDate}
  166. WHERE id = #{id}
  167. </update>
  168. <update id="delete">
  169. DELETE FROM oa_test_audit
  170. WHERE id = #{id}
  171. </update>
  172. <update id="deleteByLogic">
  173. UPDATE oa_test_audit SET
  174. del_flag = #{DEL_FLAG_DELETE}
  175. WHERE id = #{id}
  176. </update>
  177. </mapper>