From af00e89990ae9757cc9261cbe560873c2066b69c Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 18 八月 2023 14:34:11 +0800
Subject: [PATCH] 大屏统计
---
server/src/main/resources/mappers/WorkorderRecordExtMapper.xml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
index 3f53846..8633066 100644
--- a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
@@ -432,29 +432,41 @@
limit 1
</select>
<select id="userSalaryPage" parameterType="doumeemes.dao.ext.dto.QueryUserSalaryListDTO" resultType="doumeemes.dao.ext.vo.UserSalaryListVO">
-
select a.WORKORDER_ID,b.`CODE` as workorderCode,c.`NAME` as materialName,c.code as materialCode
- ,d.name as unitName,a.PROCEDURE_ID,f.`NAME` as procedureName
- ,sum(CASE WHEN a.DONE_TYPE=0 THEN a.num ELSE 0 END ) as qualifiedNum
- ,sum(CASE WHEN a.DONE_TYPE=0 THEN 0 ELSE a.num END ) as unQualifiedNum
+ ,d.name as unitName,a.PROCEDURE_ID,f.`NAME` as procedureName,a.CREATE_USER as userId
+ ,sum(a.QUALIFIED_NUM) as qualifiedNum
+ ,sum(a.UNQUALIFIED_NUM) as unQualifiedNum
,sum(a.num) as NUM
from `workorder_record` a
left join workorder b on a.WORKORDER_ID=b.id
- left join material c on b.MATERIAL_ID = c.ID
- left join unit_distribute d on a.UNIT_ID = d.ID
+ left join material_distribute m on b.MATERIAL_ID = m.ID
+ left join material c on m.MATERIAL_ID = c.ID
+ left join unit d on a.UNIT_ID = d.ID
left join procedures f on a.PROCEDURE_ID =f.ID
where a.DELETED = 0
<if test="rootDepartId != null">
- AND `ROOT_DEPART_ID` = #{rootDepartId}
+ AND a.`ROOT_DEPART_ID` = #{rootDepartId}
+ </if>
+ <if test="procedureId != null">
+ AND a.`PROCEDURE_ID` = #{procedureId}
+ </if>
+ <if test="materialName != null and materialName !=''">
+ AND (c.`name` like concat('%', #{materialName},'%') or c.`code` like concat('%', #{materialName},'%'))
+ </if>
+ <if test="startDate != null and startDate != ''">
+ AND a.`CREATE_TIME` >= concat(#{startDate},' 00:00:00')
+ </if>
+ <if test="endDate != null and endDate != ''">
+ AND concat(#{endDate},' 23:59:59') >= a.`CREATE_TIME`
</if>
<if test="userId != null">
- AND `CREATE_USER` = #{userId}
+ AND a.`CREATE_USER` = #{userId}
</if>
group by a.`WORKORDER_ID`
- <!--order by a.`CREATE_TIME` desc-->
+ order by a.CREATE_TIME desc
</select>
<select id="salaryStatistic" parameterType="doumeemes.dao.ext.dto.QuerySalaryStatisticDTO" resultType="doumeemes.dao.ext.vo.SalaryStatisticsListVO">
- select `CREATE_USER` ,sum(CASE WHEN salary_type=0 THEN salary ELSE 0 END ) as jijiaSalry
+ select `CREATE_USER` as userId ,sum(CASE WHEN salary_type=0 THEN salary ELSE 0 END ) as jijianSalary
,sum(CASE WHEN salary_type=0 THEN 0 ELSE salary END ) as jishiSalary
,count(id) as num
,sum(salary) as totalSalary
@@ -466,9 +478,36 @@
<if test="userId != null">
AND `CREATE_USER` = #{userId}
</if>
+ <if test="startDate != null and startDate != ''">
+ AND `CREATE_TIME` >= concat(#{startDate},' 00:00:00')
+ </if>
+ <if test="endDate != null and endDate != ''">
+ AND concat(#{endDate},' 23:59:59') >= `CREATE_TIME`
+ </if>
group by `CREATE_USER`
<!-- order by `CREATE_TIME` desc-->
</select>
+ <select id="getUserProduceTopData" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.UserProduceTopModel">
+ SELECT sum(a.num) as doneNum,b.user_id as userId,b.`NAME` as userName,b.PHONE
+ from workorder_record a
+ left join company_user b on b.DELETED=0 and b.user_id=a.CREATE_USER
+ left join workorder c on a.WORKORDER_ID=c.id
+ where a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and s.status=4
+ GROUP BY a.CREATE_USER
+ ORDER By doneNum desc
+ limit 10
+ </select>
+ <select id="getUnqualified7DayData" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.Unqualified7DayModel">
+ SELECT sum(a.UNQUALIFIED_NUM) as unqualifiedNum,a.CREATE_TIME
+ from workorder_record a
+ left join workorder c on a.WORKORDER_ID=c.id
+ where a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.`STATUS`=4
+ and 7 > (TO_DAYS(now()) - TO_DAYS(a.CREATE_TIME) )
+ GROUP BY TO_DAYS(a.CREATE_TIME )
+
+ </select>
<select id="selectListNew" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO" resultMap="WorkorderRecordExtListVO">
SELECT
`a`.`ID`,
--
Gitblit v1.9.3