ApplicationProcedureMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.template.mapper.ApplicationProcedureMapper">
  4. <select id="pageList" resultType="com.template.model.vo.ApplicationProcedureVo">
  5. SELECT
  6. apu.id as id,
  7. apu.user_name as usersName,
  8. apu.start_time as startTime,
  9. apu.end_time as endTime,
  10. apu.department as department,
  11. apu.change_user_name as changeUsersName,
  12. apu.reason_application as reasonApplication,
  13. apu.submission_time as submissionTime,
  14. apu.`status` as status,
  15. apu.approver_user_name as approverUserName,
  16. apu.examine_and_approve_time as examineAndApproveTime,
  17. apu.examine_and_approve_remark as examineAndApproveRemark
  18. FROM
  19. (
  20. SELECT
  21. ap.id,
  22. u.user_name AS user_name ,
  23. ap.start_time,
  24. ap.end_time,
  25. ap.department,
  26. u2.user_name as change_user_name,
  27. ap.reason_application,
  28. ap.submission_time,
  29. ap.`status`,
  30. u3.user_name as approver_user_name,
  31. ap.examine_and_approve_time,
  32. ap.examine_and_approve_remark
  33. FROM
  34. `application_procedure` ap
  35. LEFT JOIN users u ON ap.users_id = u.id
  36. LEFT JOIN users u2 ON ap.change_users_id = u2.id
  37. LEFT JOIN users u3 ON ap.approver_id = u3.id
  38. WHERE ap.deleted=0
  39. ) apu
  40. <where>
  41. <if test="submissionStartTime != null and submissionStartTime != '' and submissionEndTime != null and submissionEndTime != '' ">
  42. and apu.submission_time >= #{submissionStartTime} and #{submissionEndTime}>= apu.submission_time
  43. </if>
  44. <if test="key != null and key != ''">
  45. AND ( apu.user_name LIKE '%' #{key} '%' OR apu.reason_application LIKE '%' #{key} '%' )
  46. </if>
  47. <if test="examineAndApproveStartTime != null and examineAndApproveStartTime != '' and examineAndApproveEndTime != null and examineAndApproveEndTime != '' ">
  48. and apu.examine_and_approve_time >= #{examineAndApproveStartTime} and #{examineAndApproveEndTime}>= apu.examine_and_approve_time
  49. </if>
  50. <if test="type != null and type != ''">
  51. and apu.status= #{type}
  52. </if>
  53. <if test="department != null and department != ''">
  54. and apu.department= #{department}
  55. </if>
  56. </where>
  57. ORDER BY apu.submission_time
  58. </select>
  59. <select id="parentPageList" resultType="com.template.model.vo.ApplicationProcedureVo">
  60. SELECT
  61. apu.id as id,
  62. apu.user_name as usersName,
  63. apu.start_time as startTime,
  64. apu.end_time as endTime,
  65. apu.department as department,
  66. apu.change_user_name as changeUsersName,
  67. apu.reason_application as reasonApplication,
  68. apu.submission_time as submissionTime,
  69. apu.`status` as status,
  70. apu.approver_user_name as approverUserName,
  71. apu.examine_and_approve_time as examineAndApproveTime,
  72. apu.examine_and_approve_remark as examineAndApproveRemark
  73. FROM
  74. (
  75. SELECT
  76. ap.id,
  77. u.user_name AS user_name ,
  78. ap.start_time,
  79. ap.end_time,
  80. ap.department,
  81. u2.user_name as change_user_name,
  82. ap.reason_application,
  83. ap.submission_time,
  84. ap.`status`,
  85. u3.user_name as approver_user_name,
  86. ap.examine_and_approve_time,
  87. ap.examine_and_approve_remark
  88. FROM
  89. `application_procedure` ap
  90. LEFT JOIN users u ON ap.users_id = u.id
  91. LEFT JOIN users u2 ON ap.change_users_id = u2.id
  92. LEFT JOIN users u3 ON ap.approver_id = u3.id
  93. WHERE ap.deleted=0 AND FIND_IN_SET(ap.status,#{type})
  94. ) apu
  95. <where>
  96. <if test="submissionStartTime != null and submissionStartTime != '' and submissionEndTime != null and submissionEndTime != '' ">
  97. and apu.submission_time >= #{submissionStartTime} and #{submissionEndTime}>= apu.submission_time
  98. </if>
  99. <if test="key != null and key != ''">
  100. AND ( apu.user_name LIKE '%' #{key} '%' OR apu.reason_application LIKE '%' #{key} '%' )
  101. </if>
  102. <if test="examineAndApproveStartTime != null and examineAndApproveStartTime != '' and examineAndApproveEndTime != null and examineAndApproveEndTime != '' ">
  103. and apu.examine_and_approve_time >= #{examineAndApproveStartTime} and #{examineAndApproveEndTime}>= apu.examine_and_approve_time
  104. </if>
  105. <!--<if test="type != null and type != ''">
  106. and apu.status= #{type}
  107. </if>-->
  108. <if test="department != null and department != ''">
  109. and apu.department= #{department}
  110. </if>
  111. </where>
  112. ORDER BY apu.submission_time
  113. </select>
  114. </mapper>