SignReportMapper.xml 2.4 KB
<?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.ruoyi.mapper.SignReportMappper">
    <select id="querySignReport" resultType="com.ruoyi.domain.dss.app.vo.SignReportVo">
        select (
        select count(jobCode)checkNum from(
        select si.jobCode  jobCode from sign_in si  where si.create_time like CONCAT(#{dateStr},'%') GROUP by si.jobCode
        )t)checkNum
        ,(
        select count(jobCode)exceptionNum from(
        select si.jobCode from sign_in si where si.create_time like CONCAT(#{dateStr},'%') and si.ex_type <![CDATA[ <> ]]>0 GROUP by si.jobCode
        )t1)exceptionNum
        ,(
        select count(jobCode)exceptionNum from(
        select si.jobCode from sign_in si where si.create_time like CONCAT(#{dateStr},'%') and si.ex_type =3 GROUP by si.jobCode
        )t1)alcoholNum
    </select>

    <select id="querySignReportGroupByDayOfError" resultType="com.ruoyi.domain.dss.app.entity.SignReportGroupByDay">
        select jobCode ,dateStr from(
            select jobCode,DATE_FORMAT(si.create_time,'%Y-%m-%d') dateStr from sign_in si where si.create_time like CONCAT(#{dateStr},'%') AND si.ex_type1 BETWEEN #{startVal} and #{endVal} and si.ex_type1<![CDATA[ <> ]]>#{alcoholVal}
        )t group by dateStr,jobCode
    </select>
    
    <select id="querySignReportAlcoholGroupByDay" resultType="com.ruoyi.domain.dss.app.entity.SignReportGroupByDay">
        select jobCode ,dateStr from(
        select jobCode,DATE_FORMAT(si.create_time,'%Y-%m-%d') dateStr from sign_in si where si.create_time like CONCAT(#{dateStr},'%') AND si.ex_type=3
        )t group by dateStr,jobCode
    </select>
    <select id="querySignReportAlcoholMonthGroupByDay"  resultType="com.ruoyi.domain.dss.app.vo.SignReportGroupByVo">
        select dateStr,sum(alcohol_Num) alcoholNum,sum(early_Signing) earlySigning,sum(late_Signing) lateSigning,sum(normal_Signing) normalSigning from(
        select DATE_FORMAT(srds.dateStr,'%Y-%m')dateStr ,alcohol_Num,early_Signing,late_Signing,normal_Signing from sign_report_day_summary srds
        <where>
            <foreach collection="dateStrs" item="value" separator=" or " open="(" close=")">
                srds.dateStr like  CONCAT(#{value},'%')
            </foreach>
        </where>
        )myt group by dateStr order by dateStr
    </select>
</mapper>