jiangping
2023-08-18 5dfbc4af25ab4f5e8d75f99c6e889b5004a49ef0
server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
@@ -469,7 +469,7 @@
  <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(id) as num
    ,count(distinct(a.workorder_id)) as num
    ,sum(salary) as totalSalary
    from `workorder_record`
    where `DELETED` =0 and `SALARY` >0
@@ -495,6 +495,9 @@
    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
    <if test="procedureId != null">
      AND  a.`PROCEDURE_ID` = #{procedureId}
    </if>
    GROUP BY a.CREATE_USER
    ORDER By doneNum desc
    limit 10
@@ -506,7 +509,41 @@
    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 TO_DAYS(d.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
    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
    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
    <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">