OfficialDocumentReceivedHandleMapper.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. ),',', '>') AS receive_user_names,t1.is_handle,t4.name as handle_user_name,t1.handle_time,
  14. IFNULL((
  15. SELECT is_transfer FROM official_document_received_handle WHERE official_document_received_id = t1.id
  16. AND create_user_id = #{dto.loginUserId}
  17. ), 0) AS is_transfer
  18. FROM official_document_received t1
  19. INNER JOIN xjr_workflow_form_relation t2 ON t1.id = CAST(t2.form_key_value AS SIGNED)
  20. LEFT JOIN xjr_user t3 ON t1.handle_duty_user_id = t3.id
  21. LEFT JOIN xjr_user t4 ON t1.handle_user_id = t4.id
  22. LEFT JOIN official_document_received_handle t5 ON t1.id = t5.official_document_received_id
  23. LEFT JOIN xjr_dictionary_detail t6 ON t1.received_type = t6.code
  24. WHERE t2.current_state = 'COMPLETED'
  25. AND t1.delete_mark = 0
  26. <if test="dto.loginUserId != null">
  27. AND (t1.handle_duty_user_id = #{dto.loginUserId} or t5.receive_user_id = #{dto.loginUserId})
  28. </if>
  29. <if test="dto.handleUserName != null and dto.handleUserName != ''">
  30. AND t4.name like concat('%', #{dto.handleUserName},'%')
  31. </if>
  32. <if test="dto.handleDutyUserName != null and dto.handleDutyUserName != ''">
  33. AND t3.name like concat('%', #{dto.handleDutyUserName},'%')
  34. </if>
  35. <if test="dto.receivedTitle != null and dto.receivedTitle != ''">
  36. AND t1.received_title like concat('%', #{dto.receivedTitle},'%')
  37. </if>
  38. <if test="dto.isHandle != null">
  39. AND t1.is_handle = #{dto.isHandle}
  40. </if>
  41. <if test="dto.receivedType != null and dto.receivedType != ''">
  42. AND t1.received_type like concat('%', #{dto.receivedType},'%')
  43. </if>
  44. <if test="dto.receivedDateStart != null and dto.receivedDateEnd != ''">
  45. AND t1.received_date between and #{dto.receivedDateStart} and #{dto.receivedDateEnd}
  46. </if>
  47. <if test="dto.handleDateStart != null and dto.handleDateEnd != ''">
  48. AND DATE_FORMAT(t1.handle_time, '%Y-%m-%d') between and #{dto.handleDateStart} and #{dto.handleDateEnd}
  49. </if>
  50. order by t1.id desc
  51. </select>
  52. </mapper>