赫艾后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
5.5 KiB

3 years ago
3 years ago
3 years ago
  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.heai.modules.taskmanage.dao.TaskDetailDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.heai.modules.taskmanage.entity.TaskDetailEntity" id="taskListMap">
  6. <result property="id" column="id"/>
  7. <result property="department" column="department"/>
  8. <result property="status" column="status"/>
  9. <result property="createdDate" column="created_date"/>
  10. <result property="createdBy" column="created_by"/>
  11. <result property="updatedDate" column="updated_date"/>
  12. <result property="updatedBy" column="updated_by"/>
  13. </resultMap>
  14. <select id="taskDetailList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
  15. select td.id
  16. , tl.project
  17. , tl.customer
  18. , isnull(u2.username,tl.task_initiator) task_initiator
  19. , tl.task_description
  20. , td.department
  21. , tl.required_completion_date
  22. , td.status
  23. , td.final_status
  24. , tl.task_start_date
  25. , tl.created_date
  26. , tl.created_by
  27. , tl.updated_date
  28. , tl.updated_by
  29. , tl.task_header
  30. , u.username responsible_person
  31. ,( u.department + ' | ' + u.username) as dep_user_name
  32. , td.task_id
  33. , dbo.Get_chat_LastType(td.site,td.id,td.created_by) chatLastType
  34. from task_detail td
  35. left join task_list tl on td.task_id = tl.id AND td.site = tl.site
  36. left join users u on td.site = u.site and u.userId = td.responsible_person
  37. left join users u2 on td.site = u2.site and u2.userId = tl.task_initiator
  38. LEFT JOIN report_mapping_ipaddress rmi on rmi.department = u.department
  39. <where>
  40. td.site = #{site}
  41. and (tl.created_by=td.responsible_person OR dbo.Get_chat_LastType(td.site,td.id,td.created_by)!='有新回复')
  42. <if test="ipAddress != null and ipAddress != ''">
  43. and rmi.ipaddress like #{ipAddress}
  44. </if>
  45. <if test="taskInitiator != null and taskInitiator != ''">
  46. and tl.created_by like #{taskInitiator}
  47. </if>
  48. <if test="department != null and department != ''">
  49. and u.department like #{department}
  50. </if>
  51. <if test="customer != null and customer != ''">
  52. and tl.customer like #{customer}
  53. </if>
  54. <if test="project != null and project != ''">
  55. and tl.project like #{project}
  56. </if>
  57. <if test="status != null and status != ''">
  58. and td.status = #{status}
  59. </if>
  60. <if test="finalStatus != null and finalStatus != ''">
  61. and td.final_status = #{finalStatus}
  62. </if>
  63. <if test="responsiblePerson != null and responsiblePerson != ''">
  64. and UPPER(td.responsible_person) like UPPER(#{responsiblePerson})
  65. </if>
  66. <if test="startDate !=null ">
  67. and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
  68. </if>
  69. <if test="endDate !=null ">
  70. and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
  71. </if>
  72. <if test="finishStartDate != null ">
  73. and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
  74. </if>
  75. <if test="finishEndDate != null ">
  76. and tl.required_completion_date <![CDATA[ <= ]]> #{finishEndDate}
  77. </if>
  78. </where>
  79. </select>
  80. <select id="taskDetailReportList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
  81. select td.id
  82. , tl.project
  83. , tl.customer
  84. , tl.task_initiator
  85. , tl.task_description
  86. , td.department
  87. , tl.required_completion_date
  88. , td.status
  89. , tl.final_status
  90. , tl.task_start_date
  91. , tl.created_date
  92. , tl.created_by
  93. , tl.updated_date
  94. , tl.updated_by
  95. , tl.task_header
  96. , u.username as responsible_person
  97. , td.task_id
  98. from task_detail td
  99. left join task_list tl on td.task_id = tl.id AND td.site = tl.site
  100. left join users u on td.site = u.site and u.userId = td.responsible_person
  101. <where>
  102. td.site = #{site}
  103. <if test="department != null and department != ''">
  104. and tl.department like #{department}
  105. </if>
  106. <if test="customer != null and customer != ''">
  107. and tl.customer like #{customer}
  108. </if>
  109. <if test="status != null and status != ''">
  110. and tl.status = #{status}
  111. </if>
  112. <if test="responsiblePerson != null and responsiblePerson != ''">
  113. and td.responsible_person like #{responsiblePerson}
  114. </if>
  115. <if test="startDate !=null ">
  116. and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
  117. </if>
  118. <if test="endDate !=null ">
  119. and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
  120. </if>
  121. <if test="finishStartDate != null ">
  122. and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
  123. </if>
  124. <if test="finishEndDate != null ">
  125. and tl.required_completion_date <![CDATA[ <= ]]>#{finishEndDate}
  126. </if>
  127. </where>
  128. </select>
  129. </mapper>