<?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.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper">


    <select id="countWorkTicketTotalByCode" resultType="java.lang.Integer">
        select COUNT(1) from yxgl_gzp_main where WERKS=#{code}
    </select>

    <select id="countWorkTicketProcessingByCode" resultType="java.lang.Integer">
        select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT in
        ('01','02','03','04','05','06','07','08','09','10','11','12','15','16','17','20','21','22','23','24','25','26','27','28','29','30','31','32','33')
    </select>

    <select id="countWorkTicketInvalidatedByCode" resultType="java.lang.Integer">
        select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT in ('19','18')
    </select>

    <select id="countWorkTicketTerminatedByCode" resultType="java.lang.Integer">
        select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT in ('13','14')
    </select>

    <select id="countRegularTasksByCode" resultType="java.lang.Integer">
        SELECT COUNT(1) from yxgl_dqgz_dqrw where WERKS=#{code}
    </select>

    <select id="countInspectionTasksByCode" resultType="java.lang.Integer">
        select COUNT(1) from yxgl_xhjc_new_xjrw where WERKS=#{code}
    </select>

    <select id="countWorkOrderTotalByCode" resultType="java.lang.Integer">
        select COUNT(1) from fdgl_job_main where WERKS=#{code}
    </select>

    <select id="countWorkOrderInvalidatedByCode" resultType="java.lang.Integer">
        select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='4'
    </select>

    <select id="countWorkOrderToBeOpenedByCode" resultType="java.lang.Integer">
        select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='6'
    </select>

    <select id="countWorkOrderTerminatedByCode" resultType="java.lang.Integer">
        select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='3'
    </select>

    <select id="countWorkOrderStartByCode" resultType="java.lang.Integer">
        select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='1'
    </select>

    <select id="getDeviceCode" resultType="java.lang.String">
        select KKSBM from sjgl_zsj_zsbtz where WERKS=#{werks} and (KKSMS like #{value} or KKSMS like #{replaceValue})
    </select>
</mapper>
