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.

44 lines
2.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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.xujie.sys.modules.pms.mapper.EamReportMapper">
  4. <select id="searchEamObjectSumReport" resultType="EamObjectSumReportData">
  5. select a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc,sum(qtyAll) qtyAll
  6. ,sum(qtyFinished) qtyFinished,sum(qtyUnFinishied) qtyUnFinishied,sum(qtycancelled) qtycancelled
  7. , Round(sum(qtyFinished) *100.0/sum(qtyAll),2) as finishPercent
  8. from (
  9. select a.Site,a.ObjectID,b.ObjectDesc,b.FamilyID,b.GroupID,1 as qtyAll,case WHEN a.Status='已完工' then 1 else 0 end as qtyFinished, case WHEN a.Status='未开工' then 1 else 0 end as qtyUnFinishied, case WHEN a.Status='已取消' then 1 else 0 end as qtycancelled
  10. from eam_workOrder a left join eam_object b on a.Site=b.Site and a.ObjectID =b.ObjectID
  11. <where>
  12. <if test="query.site != null and query.site != ''">
  13. AND a.site = #{query.site}
  14. </if>
  15. <if test="query.objectID != null and query.objectID != ''">
  16. AND a.ObjectID like '%' + #{query.objectID} +'%'
  17. </if>
  18. <if test="query.objectDesc != null and query.objectDesc != ''">
  19. AND b.ObjectDesc like '%' + #{query.objectDesc} +'%'
  20. </if>
  21. <if test="query.familyID != null and query.familyID != ''">
  22. AND b.FamilyID like '%' + #{query.familyID}+'%'
  23. </if>
  24. <if test="query.groupID != null and query.groupID != ''">
  25. AND b.GroupID = #{query.groupID}
  26. </if>
  27. <if test="query.functionType != null and query.functionType != ''">
  28. AND a.functionType = #{query.functionType}
  29. </if>
  30. <if test="query.startDate != null ">
  31. AND a.PlanDate >= #{query.startDate}
  32. </if>
  33. <if test="query.endDate != null ">
  34. AND #{query.endDate} >= a.PlanDate
  35. </if>
  36. </where>
  37. ) a left join eam_family c on a.Site=c.Site and a.FamilyID=c.FamilyID
  38. left join eam_group d on a.Site=d.Site and a.GroupID=d.GroupID
  39. Group by a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc
  40. </select>
  41. </mapper>