AuditMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.jsh.erp.datasource.mappers.AuditMapper">
  4. <select id="pendingApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
  5. SELECT
  6. a.*,
  7. a.business_number AS 'number',
  8. u.username AS 'initiatorName',
  9. an.node_order
  10. FROM audit_node an
  11. LEFT JOIN audit a ON an.audit_id = a.id
  12. LEFT JOIN jsh_user u ON a.submit_user = u.id
  13. <where>
  14. an.auditor_user = #{uid} AND an.audit_result = 0 AND a.delete_flag = 0
  15. <if test="number != null and number != ''">
  16. AND a.business_number LIKE CONCAT('%',#{number},'%')
  17. </if>
  18. <if test="type != null and type != ''">
  19. AND a.type LIKE CONCAT('%',#{type},'%')
  20. </if>
  21. <if test="initiatorName != null and initiatorName != ''">
  22. AND u.username LIKE CONCAT('%',#{initiatorName},'%')
  23. </if>
  24. </where>
  25. ORDER BY a.submit_time DESC
  26. </select>
  27. <select id="processedApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
  28. SELECT
  29. a.*,
  30. a.business_number AS 'number',
  31. an.audit_time,
  32. an.node_order,
  33. u.username AS 'initiatorName'
  34. FROM audit_node an
  35. LEFT JOIN audit a ON an.audit_id = a.id
  36. LEFT JOIN jsh_user u ON a.submit_user = u.id
  37. <where>
  38. an.auditor_user = #{uid} AND an.audit_result != 0 AND a.delete_flag = 0
  39. <if test="number != null and number != ''">
  40. AND a.business_number LIKE CONCAT('%',#{number},'%')
  41. </if>
  42. <if test="type != null and type != ''">
  43. AND a.type LIKE CONCAT('%',#{type},'%')
  44. </if>
  45. <if test="initiatorName != null and initiatorName != ''">
  46. AND u.username LIKE CONCAT('%',#{initiatorName},'%')
  47. </if>
  48. <if test="auditStatus != null">
  49. AND a.audit_status = #{auditStatus}
  50. </if>
  51. <if test="beginTime != null">
  52. AND an.audit_time >= #{beginTime}
  53. </if>
  54. <if test="endTime != null">
  55. AND an.audit_time &lt;= #{endTime}
  56. </if>
  57. </where>
  58. ORDER BY an.audit_time DESC
  59. </select>
  60. <select id="myApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
  61. SELECT
  62. a.*,
  63. a.business_number AS 'number',
  64. an.audit_time,
  65. an.node_order,
  66. u.username AS 'auditorName'
  67. FROM audit a
  68. LEFT JOIN (SELECT MAX(id) AS 'id',audit_id FROM audit_node GROUP BY audit_id) tb ON a.id = tb.audit_id
  69. LEFT JOIN audit_node an ON tb.id = an.id
  70. LEFT JOIN jsh_user u ON an.auditor_user = u.id
  71. <where>
  72. a.submit_user = #{uid} AND a.delete_flag = 0
  73. <if test="number != null and number != ''">
  74. AND a.business_number LIKE CONCAT('%',#{number},'%')
  75. </if>
  76. <if test="type != null and type != ''">
  77. AND a.type LIKE CONCAT('%',#{type},'%')
  78. </if>
  79. <if test="auditStatus != null">
  80. AND an.audit_result = #{auditStatus}
  81. </if>
  82. <if test="beginTime != null">
  83. AND an.audit_time >= #{beginTime}
  84. </if>
  85. <if test="endTime != null">
  86. AND an.audit_time &lt;= #{endTime}
  87. </if>
  88. </where>
  89. ORDER BY a.submit_time DESC
  90. </select>
  91. <select id="pdaList" parameterType="com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotHeadVO">
  92. SELECT
  93. dh.id,
  94. dh.number,
  95. dh.create_time,
  96. dh.goods_quantity,
  97. dh.goods_type_count,
  98. dh.oper_time,
  99. s.supplier AS supplier_name,
  100. dh.status,
  101. dh.receiver_address,
  102. dh.type,
  103. dh.oper_id,
  104. u.username AS 'operName'
  105. FROM audit_node an
  106. LEFT JOIN audit a ON an.audit_id = a.id
  107. LEFT JOIN jsh_depot_head dh ON a.business_id = dh.id
  108. LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
  109. LEFT JOIN jsh_user u ON dh.oper_id = u.id
  110. <where>
  111. an.auditor_user = #{uid}
  112. AND (a.type = '采购' OR a.type = '销售')
  113. AND an.delete_flag = 0
  114. <if test="number != null and number != ''">
  115. AND dh.number like CONCAT('%',#{number},'%')
  116. </if>
  117. <if test="status != null and status != ''">
  118. AND dh.status = #{status}
  119. </if>
  120. <if test="beginTime != null and beginTime != ''">
  121. AND dh.create_time between #{beginTime} and #{endTime}
  122. </if>
  123. <if test="depotId != null and depotId !=0">
  124. AND dh.depot_id = #{depotId}
  125. </if>
  126. </where>
  127. GROUP BY dh.id
  128. ORDER BY dh.create_time DESC
  129. </select>
  130. </mapper>