OALeaveMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.test.activiti.mapper.OALeaveMapper">
  4. <sql id="oALeaveColumns">
  5. a.id AS "id",
  6. a.proc_ins_id AS "procInsId",
  7. a.leave_type AS "leaveType",
  8. a.start_time AS "startTime",
  9. a.end_time AS "endTime",
  10. a.reason AS "reason",
  11. a.create_by AS "createBy.id",
  12. a.create_date AS "createDate",
  13. a.update_by AS "updateBy.id",
  14. a.update_date AS "updateDate",
  15. a.remarks AS "remarks",
  16. a.del_flag AS "delFlag"
  17. </sql>
  18. <sql id="oALeaveJoins">
  19. LEFT JOIN sys_user updateBy ON updateBy.id = a.update_by
  20. </sql>
  21. <resultMap type="OALeave" id="OALeaveResult" autoMapping="true">
  22. <result column="reason" property="reason" typeHandler="com.jeeplus.core.mapper.ConvertBlobTypeHandler"/>
  23. </resultMap>
  24. <select id="get" resultMap="OALeaveResult" >
  25. SELECT
  26. <include refid="oALeaveColumns"/>
  27. FROM test_activiti_leave a
  28. <include refid="oALeaveJoins"/>
  29. WHERE a.id = #{id}
  30. </select>
  31. <select id="findList" resultMap="OALeaveResult" >
  32. SELECT
  33. <include refid="oALeaveColumns"/>
  34. FROM test_activiti_leave a
  35. <include refid="oALeaveJoins"/>
  36. <where>
  37. a.del_flag = #{DEL_FLAG_NORMAL}
  38. ${dataScope}
  39. </where>
  40. <choose>
  41. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  42. ORDER BY ${page.orderBy}
  43. </when>
  44. <otherwise>
  45. ORDER BY a.update_date DESC
  46. </otherwise>
  47. </choose>
  48. </select>
  49. <select id="findAllList" resultMap="OALeaveResult" >
  50. SELECT
  51. <include refid="oALeaveColumns"/>
  52. FROM test_activiti_leave a
  53. <include refid="oALeaveJoins"/>
  54. <where>
  55. a.del_flag = #{DEL_FLAG_NORMAL}
  56. ${dataScope}
  57. </where>
  58. <choose>
  59. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  60. ORDER BY ${page.orderBy}
  61. </when>
  62. <otherwise>
  63. ORDER BY a.update_date DESC
  64. </otherwise>
  65. </choose>
  66. </select>
  67. <insert id="insert">
  68. INSERT INTO test_activiti_leave(
  69. id,
  70. proc_ins_id,
  71. leave_type,
  72. start_time,
  73. end_time,
  74. reason,
  75. create_by,
  76. create_date,
  77. update_by,
  78. update_date,
  79. remarks,
  80. del_flag
  81. ) VALUES (
  82. #{id},
  83. #{procInsId},
  84. #{leaveType},
  85. #{startTime},
  86. #{endTime},
  87. #{reason},
  88. #{createBy.id},
  89. #{createDate},
  90. #{updateBy.id},
  91. #{updateDate},
  92. #{remarks},
  93. #{delFlag}
  94. )
  95. </insert>
  96. <update id="update">
  97. UPDATE test_activiti_leave SET
  98. proc_ins_id = #{procInsId},
  99. leave_type = #{leaveType},
  100. start_time = #{startTime},
  101. end_time = #{endTime},
  102. reason = #{reason},
  103. update_by = #{updateBy.id},
  104. update_date = #{updateDate},
  105. remarks = #{remarks}
  106. WHERE id = #{id}
  107. </update>
  108. <!--物理删除-->
  109. <update id="delete">
  110. DELETE FROM test_activiti_leave
  111. WHERE id = #{id}
  112. </update>
  113. <!--逻辑删除-->
  114. <update id="deleteByLogic">
  115. UPDATE test_activiti_leave SET
  116. del_flag = #{DEL_FLAG_DELETE}
  117. WHERE id = #{id}
  118. </update>
  119. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  120. <select id="findUniqueByProperty" resultType="OALeave" statementType="STATEMENT">
  121. select * FROM test_activiti_leave where ${propertyName} = '${value}'
  122. </select>
  123. </mapper>