OfficialDocumentReceivedHandleMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedHandleMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.oa.dto.OfficialDocumentReceivedHandlePageDto" resultType="com.xjrsoft.module.oa.vo.OfficialDocumentReceivedHandlePageVo">
  7. SELECT DISTINCT t1.id, t6.name AS receivedTypeCn, t1.received_title,t1.received_number,
  8. t1.received_date,t1.communication_org,t1.communication_number,t3.name AS handle_duty_user_name,
  9. REPLACE((
  10. SELECT GROUP_CONCAT(c2.name) FROM official_document_received_handle c1
  11. INNER JOIN xjr_user c2 ON c1.receive_user_id = c2.id
  12. WHERE c1.delete_mark = 0 AND c1.official_document_received_id = t1.id AND c1.is_transfer = 1
  13. ORDER BY c1.create_date
  14. ),',', '>') AS receive_user_names,t1.is_handle,t4.name AS handle_user_name,t1.handle_time,
  15. IFNULL((
  16. SELECT COUNT(*) > 0 FROM official_document_received_handle WHERE official_document_received_id = t1.id
  17. AND create_user_id = 14954825521605
  18. ), 0) AS is_transfer
  19. FROM official_document_received t1
  20. INNER JOIN xjr_workflow_form_relation t2 ON t1.id = CAST(t2.form_key_value AS SIGNED)
  21. LEFT JOIN xjr_user t3 ON t1.handle_duty_user_id = t3.id
  22. LEFT JOIN xjr_user t4 ON t1.handle_user_id = t4.id
  23. LEFT JOIN official_document_received_handle t5 ON t1.id = t5.official_document_received_id
  24. LEFT JOIN xjr_dictionary_detail t6 ON t1.received_type = t6.code
  25. WHERE t2.current_state = 'COMPLETED'
  26. AND t1.delete_mark = 0
  27. <if test="dto.loginUserId != null">
  28. AND (t1.handle_duty_user_id = #{dto.loginUserId} or t5.receive_user_id = #{dto.loginUserId})
  29. </if>
  30. <if test="dto.handleUserName != null and dto.handleUserName != ''">
  31. AND t4.name like concat('%', #{dto.handleUserName},'%')
  32. </if>
  33. <if test="dto.handleDutyUserName != null and dto.handleDutyUserName != ''">
  34. AND t3.name like concat('%', #{dto.handleDutyUserName},'%')
  35. </if>
  36. <if test="dto.receivedTitle != null and dto.receivedTitle != ''">
  37. AND t1.received_title like concat('%', #{dto.receivedTitle},'%')
  38. </if>
  39. <if test="dto.isHandle != null">
  40. AND t1.is_handle = #{dto.isHandle}
  41. </if>
  42. <if test="dto.receivedType != null and dto.receivedType != ''">
  43. AND t1.received_type like concat('%', #{dto.receivedType},'%')
  44. </if>
  45. <if test="dto.receivedDateStart != null and dto.receivedDateEnd != ''">
  46. AND t1.received_date between and #{dto.receivedDateStart} and #{dto.receivedDateEnd}
  47. </if>
  48. <if test="dto.handleDateStart != null and dto.handleDateEnd != ''">
  49. AND DATE_FORMAT(t1.handle_time, '%Y-%m-%d') between and #{dto.handleDateStart} and #{dto.handleDateEnd}
  50. </if>
  51. order by t1.id desc
  52. </select>
  53. </mapper>