|
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xujie.sys.modules.pms.mapper.EamReportMapper"> <select id="searchEamObjectSumReport" resultType="EamObjectSumReportData"> select a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc,sum(qtyAll) qtyAll ,sum(qtyFinished) qtyFinished,sum(qtyUnFinishied) qtyUnFinishied,sum(qtycancelled) qtycancelled , Round(sum(qtyFinished) *100.0/sum(qtyAll),2) as finishPercent from ( 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 from eam_workOrder a left join eam_object b on a.Site=b.Site and a.ObjectID =b.ObjectID <where> <if test="query.site != null and query.site != ''"> AND a.site = #{query.site} </if> <if test="query.objectID != null and query.objectID != ''"> AND a.ObjectID like '%' + #{query.objectID} +'%' </if> <if test="query.objectDesc != null and query.objectDesc != ''"> AND b.ObjectDesc like '%' + #{query.objectDesc} +'%' </if> <if test="query.familyID != null and query.familyID != ''"> AND b.FamilyID like '%' + #{query.familyID}+'%' </if> <if test="query.groupID != null and query.groupID != ''"> AND b.GroupID = #{query.groupID} </if> <if test="query.functionType != null and query.functionType != ''"> AND a.functionType = #{query.functionType} </if> <if test="query.startDate != null "> AND a.PlanDate >= #{query.startDate} </if> <if test="query.endDate != null "> AND #{query.endDate} >= a.PlanDate </if> </where>
) a left join eam_family c on a.Site=c.Site and a.FamilyID=c.FamilyID left join eam_group d on a.Site=d.Site and a.GroupID=d.GroupID
Group by a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc </select>
</mapper>
|