Car.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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="test.car.mapper.CarMapper">
  4. <sql id="testActivitiAuditColumns">
  5. a.id AS "id",
  6. a.proc_ins_id AS "procInsId",
  7. a.user_id AS "user.id",
  8. a.office_id AS "office.id",
  9. a.post AS "post",
  10. a.sex AS "sex",
  11. a.edu AS "edu",
  12. a.content AS "content",
  13. a.olda AS "olda",
  14. a.oldb AS "oldb",
  15. a.oldc AS "oldc",
  16. a.newa AS "newa",
  17. a.newb AS "newb",
  18. a.newc AS "newc",
  19. a.add_num AS "addNum",
  20. a.exe_date AS "exeDate",
  21. a.create_by AS "createBy.id",
  22. a.create_date AS "createDate",
  23. a.update_by AS "updateBy.id",
  24. a.update_date AS "updateDate",
  25. a.remarks AS "remarks",
  26. a.del_flag AS "delFlag",
  27. user.name AS "user.name",
  28. office.name AS "office.name"
  29. </sql>
  30. <sql id="testActivitiAuditJoins">
  31. LEFT JOIN sys_user user ON user.id = a.user_id
  32. LEFT JOIN sys_office office ON office.id = a.office_id
  33. </sql>
  34. <select id="get" resultType="TestActivitiAudit" >
  35. SELECT
  36. <include refid="testActivitiAuditColumns"/>
  37. FROM test_activiti_audit a
  38. <include refid="testActivitiAuditJoins"/>
  39. WHERE a.id = #{id}
  40. </select>
  41. <select id="findList" resultType="TestActivitiAudit" >
  42. SELECT
  43. <include refid="testActivitiAuditColumns"/>
  44. FROM test_activiti_audit a
  45. <include refid="testActivitiAuditJoins"/>
  46. <where>
  47. a.del_flag = #{DEL_FLAG_NORMAL}
  48. ${dataScope}
  49. </where>
  50. <choose>
  51. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  52. ORDER BY ${page.orderBy}
  53. </when>
  54. <otherwise>
  55. ORDER BY a.update_date DESC
  56. </otherwise>
  57. </choose>
  58. </select>
  59. <select id="findAllList" resultType="TestActivitiAudit" >
  60. SELECT
  61. <include refid="testActivitiAuditColumns"/>
  62. FROM test_activiti_audit a
  63. <include refid="testActivitiAuditJoins"/>
  64. <where>
  65. a.del_flag = #{DEL_FLAG_NORMAL}
  66. ${dataScope}
  67. </where>
  68. <choose>
  69. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  70. ORDER BY ${page.orderBy}
  71. </when>
  72. <otherwise>
  73. ORDER BY a.update_date DESC
  74. </otherwise>
  75. </choose>
  76. </select>
  77. <insert id="insert">
  78. INSERT INTO test_activiti_audit(
  79. id,
  80. proc_ins_id,
  81. user_id,
  82. office_id,
  83. post,
  84. sex,
  85. edu,
  86. content,
  87. olda,
  88. oldb,
  89. oldc,
  90. newa,
  91. newb,
  92. newc,
  93. add_num,
  94. exe_date,
  95. create_by,
  96. create_date,
  97. update_by,
  98. update_date,
  99. remarks,
  100. del_flag
  101. ) VALUES (
  102. #{id},
  103. #{procInsId},
  104. #{user.id},
  105. #{office.id},
  106. #{post},
  107. #{sex},
  108. #{edu},
  109. #{content},
  110. #{olda},
  111. #{oldb},
  112. #{oldc},
  113. #{newa},
  114. #{newb},
  115. #{newc},
  116. #{addNum},
  117. #{exeDate},
  118. #{createBy.id},
  119. #{createDate},
  120. #{updateBy.id},
  121. #{updateDate},
  122. #{remarks},
  123. #{delFlag}
  124. )
  125. </insert>
  126. <update id="update">
  127. UPDATE test_activiti_audit SET
  128. proc_ins_id = #{procInsId},
  129. user_id = #{user.id},
  130. office_id = #{office.id},
  131. post = #{post},
  132. sex = #{sex},
  133. edu = #{edu},
  134. content = #{content},
  135. olda = #{olda},
  136. oldb = #{oldb},
  137. oldc = #{oldc},
  138. newa = #{newa},
  139. newb = #{newb},
  140. newc = #{newc},
  141. add_num = #{addNum},
  142. exe_date = #{exeDate},
  143. update_by = #{updateBy.id},
  144. update_date = #{updateDate},
  145. remarks = #{remarks}
  146. WHERE id = #{id}
  147. </update>
  148. <!--物理删除-->
  149. <update id="delete">
  150. DELETE FROM test_activiti_audit
  151. WHERE id = #{id}
  152. </update>
  153. <!--逻辑删除-->
  154. <update id="deleteByLogic">
  155. UPDATE test_activiti_audit SET
  156. del_flag = #{DEL_FLAG_DELETE}
  157. WHERE id = #{id}
  158. </update>
  159. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  160. <select id="findUniqueByProperty" resultType="TestActivitiAudit" statementType="STATEMENT">
  161. select * FROM test_activiti_audit where ${propertyName} = '${value}'
  162. </select>
  163. </mapper>