Fixiaobai
2023-08-29 093f3d39a5c58fe88f7880899ff00fb6b92c35b8
inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -4,7 +4,7 @@
    <select id="selectInspectsList" resultType="map">
        select i.id,
        i.code icode,
        type,
        i.type type,
        DATE_FORMAT(`form_time`,'%Y-%m-%d'),
        supplier,
        im.code mcode,
@@ -110,7 +110,7 @@
        from lims_laboratory.inspection
        where state = 1
          and type = 0
          and create_time = #{dayofWeek}
          and create_time = #{time}
    </select>
    <!--查询该日期的成品检验数量-->
@@ -119,6 +119,64 @@
        from lims_laboratory.inspection
        where state = 1
          and type in (1, 2)
          and create_time = #{dayofWeek}
          and create_time = #{time}
    </select>
    <!--查询该日期的原材料合格数量-->
    <select id="getOkMaterByDay" resultType="java.lang.Long">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type = 0
          and inspection_status = 1
          and end_time = #{time}
    </select>
    <!--查询该日期的成品合格数量-->
    <select id="getOkFinByDay" resultType="java.lang.Long">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type in (1, 2)
          and inspection_status = 1
          and end_time = #{time}
    </select>
    <!--查询该月的原材料检验数量-->
    <select id="getMaterByMonth" resultType="java.lang.Integer">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type = 0
          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
    </select>
    <!--查询该月的成品检验数量-->
    <select id="getFinByMonth" resultType="java.lang.Integer">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type in (1, 2)
          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
    </select>
    <!--查询该月的原材料合格率-->
    <select id="getOkMaterByMonth" resultType="java.lang.Long">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type = 0
          and inspection_status = 1
          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
    </select>
    <!--查询该月的成品合格率-->
    <select id="getOkFinByMonth" resultType="java.lang.Long">
        select count(id)
        from lims_laboratory.inspection
        where state = 1
          and type in (1, 2)
          and inspection_status = 1
          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
    </select>
</mapper>