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.

86 lines
4.7 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
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. <select id="searchEamOperatorSumReport" resultType="EamObjectSumReportData">
  42. select a.Site,a.Operator,a.OperatorName,a.department,a.adminLevelID,b.adminLevelDesc,sum(qtyAll) qtyAll
  43. ,sum(qtyFinished) qtyFinished,sum(qtyUnFinishied) qtyUnFinishied,sum(qtycancelled) qtycancelled
  44. , Round(sum(qtyFinished) *100.0/sum(qtyAll),2) as finishPercent,sum(workTime) workTime
  45. from (
  46. select a.Site,a.ActualOperator Operator,dbo.eam_Get_eamAdminName(a.Site,a.ActualOperator) OperatorName,
  47. b.department,b.LevelID adminLevelID, isnull(a.workTime,0) workTime
  48. ,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
  49. from eam_workOrder a left join eam_admin b on a.Site=b.Site and a.ActualOperator =b.AdminID
  50. <where>
  51. and a.ActualOperator is not null
  52. <if test="query.site != null and query.site != ''">
  53. AND a.site = #{query.site}
  54. </if>
  55. <if test="query.operator != null and query.operator != ''">
  56. AND a.ActualOperator like '%' + #{query.operator} +'%'
  57. </if>
  58. <if test="query.operatorName != null and query.operatorName != ''">
  59. AND dbo.eam_Get_eamAdminName(a.Site,a.ActualOperator) like '%' + #{query.operatorName} +'%'
  60. </if>
  61. <if test="query.department != null and query.department != ''">
  62. AND b.department like '%' + #{query.department}+'%'
  63. </if>
  64. <if test="query.adminLevelID != null and query.adminLevelID != ''">
  65. AND b.LevelID = #{query.adminLevelID}
  66. </if>
  67. <if test="query.functionType != null and query.functionType != ''">
  68. AND a.functionType = #{query.functionType}
  69. </if>
  70. <if test="query.startDate != null ">
  71. AND a.PlanDate >= #{query.startDate}
  72. </if>
  73. <if test="query.endDate != null ">
  74. AND #{query.endDate} >= a.PlanDate
  75. </if>
  76. </where>
  77. ) a left join eam_adminLevel b on a.Site=b.Site and a.adminLevelID=b.AdminLevelID
  78. Group by a.Site,a.Operator,a.OperatorName,a.department,a.adminLevelID,b.adminLevelDesc
  79. </select>
  80. </mapper>