From 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 06 十二月 2023 08:41:32 +0800
Subject: [PATCH] bug
---
server/src/main/resources/mappers/WorkorderRecordExtMapper.xml | 153 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 120 insertions(+), 33 deletions(-)
diff --git a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
index 1d8fd97..86cb369 100644
--- a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
@@ -431,41 +431,126 @@
</where>
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,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_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
+ and a.TYPE = 1
+ <if test="rootDepartId != null">
+ 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 a.`CREATE_USER` = #{userId}
+ </if>
+ group by a.`WORKORDER_ID`
+ 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` 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(distinct(workorder_id)) as num
+ ,sum(salary) as totalSalary
+ from `workorder_record`
+ where `DELETED` =0 and `SALARY` >0
+ <if test="rootDepartId != null">
+ AND `ROOT_DEPART_ID` = #{rootDepartId}
+ </if>
+ <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.QUALIFIED_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 and b.root_depart_id=a.root_depart_id
+ left join workorder c on a.WORKORDER_ID=c.id
+ where to_days(a.create_time)=to_days(now()) and a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.status=4
+ <if test="procedureId != null">
+ AND a.`PROCEDURE_ID` = #{procedureId}
+ </if>
+ 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) )
+ <if test="procedureId != null">
+ AND a.`PROCEDURE_ID` = #{procedureId}
+ </if>
+ GROUP BY TO_DAYS(a.CREATE_TIME )
+ </select>
+ <select id="getUnqualifiedCateData" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.UnqualifiedCateModel">
+ SELECT sum(b.UNQUALIFIED_NUM) as unqualifiedNum,d.`NAME` as categoryName
+ from unqualified_record b
+ left join workorder_record a on b.RECORD_ID=a.id
+ left join workorder c on a.WORKORDER_ID=c.id
+ left join category d on b.CATEGORY_ID=d.id
+ where a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.`STATUS`=4 and a.deleted=0
+ and 7>TO_DAYS(now()) - TO_DAYS(a.CREATE_TIME )
+ <if test="procedureId != null">
+ AND a.`PROCEDURE_ID` = #{procedureId}
+ </if>
+ GROUP BY b.CATEGORY_ID
+ order by unqualifiedNum desc
+ limit 6
+ </select>
+ <select id="getRecordLog" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.RecordLogModel">
+ select a.CREATE_TIME as createTime,a.UNQUALIFIED_NUM as unqualifiedNum,a.QUALIFIED_NUM as qualifiedNum,
+ d.name as userName,c.name as materialName,c.code as materialCode,p.name as procedureName
+ from workorder_record a
+ left join material_distribute b on a.MATERIAL_ID=b.ID
+ left join material c on b.MATERIAL_ID=c.ID
+ left join company_user d on d.DELETED=0 and d.user_id=a.CREATE_USER and d.root_depart_id=a.root_depart_id
+ left join procedures p on a.PROCEDURE_ID=p.ID
+ left JOIN workorder e on e.id=a.WORKORDER_ID
+ where a.DELETED = 0 AND a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} AND e.`STATUS` = 4 and a.type=1
+ <if test="procedureId != null">
+ AND a.`PROCEDURE_ID` = #{procedureId}
+ </if>
+ ORDER BY a.CREATE_TIME desc
+
+ </select>
<select id="selectListNew" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO" resultMap="WorkorderRecordExtListVO">
SELECT
- `a`.`ID`,
- `a`.`DELETED`,
- `a`.`CREATE_USER`,
- `a`.`CREATE_TIME`,
- `a`.`UPDATE_USER`,
- `a`.`UPDATE_TIME`,
- `a`.`REMARK`,
- `a`.`ROOT_DEPART_ID`,
- `a`.`DEPART_ID`,
- `a`.`PLAN_ID`,
- `a`.`WORKORDER_ID`,
- `a`.`BATCH`,
- `a`.`FACTORY_ID`,
- `a`.`PROCEDURE_ID`,
- `a`.`PRO_DEVICE_ID`,
- `a`.`APPLIANCES_ID`,
- `a`.`PRO_DATE`,
- `a`.`TYPE`,
- `a`.`NUM`,
- `a`.`DONE_TYPE`,
- `a`.`MATERIAL_ID`,
- `a`.`UNIT_ID`,
- `a`.`MATERIAL_BATCH`,
- `a`.`CHECK_WAY`,
- `a`.`CHECK_USER_ID`,
- `a`.`QUALIFIED_NUM`,
- `a`.`UNQUALIFIED_NUM`,
- `a`.`CHECK_DATE`,
- `a`.`CHECK_INFO`,
- `a`.`QUALIFIED_APPLIANCE_ID`,
- `a`.`PRO_USERIDS`,
- `a`.MATERIAL_DONETYPE,`a`.MATERIAL_PROCEDURE_ID,`a`.RELOBJ_ID,`a`.RELOBJ_TYPE,
- `dmodel`.`ID` AS DMODEL_ID,
+ `a`.*, ROUND(a.SALARY / 100 ,2) as salaryYuan,
+ `dmodel`.`ID` AS DMODEL_ID,
`dmodel`.`DELETED` AS DMODEL_DELETED,
`dmodel`.`CREATE_USER` AS DMODEL_CREATE_USER,
`dmodel`.`CREATE_TIME` AS DMODEL_CREATE_TIME,
@@ -1427,6 +1512,7 @@
RELOBJ_TYPE,
`DURATION`,
`SALARY`,
+ `SALARY_PRICE`,
`SALARY_NUM`,
`SALARY_TIMES`,
`SALARY_UNQUALIFIED`,
@@ -1471,6 +1557,7 @@
#{item.relobjType},
#{item.duration},
#{item.salary},
+ #{item.salaryPrice},
#{item.salaryNum},
#{item.salaryTimes},
#{item.salaryUnqualified},
--
Gitblit v1.9.3