<?_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>






    _

    1. _<!-- 查询当月上班巡检员ID数组 --><br /> _<select id="selectMonthTargAttIds" resultType="java.lang.Integer"><br /> SELECT att.staff_id AS staff_id FROM attendance AS `att` WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m');<br /> </select>
    2. _<!-- 查询上月上班巡检员ID数组 --><br /> _<select id="selectPreMonthTargAttIds" resultType="java.lang.Integer"><br /> SELECT att.staff_id AS staff_id FROM attendance AS `att` WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH),'%Y-%m');<br /> </select>
    3. _<!-- 查询两月前巡检员ID数组 --><br /> _<select id="selectPre2MonthTargAttIds" resultType="java.lang.Integer"><br /> SELECT att.staff_id AS staff_id FROM attendance AS `att` WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 2 MONTH),'%Y-%m');<br /> </select>
    4. _<!-- 查询当月巡检员人数 --><br /> _<select id="selectMonthAttQt" resultType="java.lang.Integer"><br /> SELECT IFNULL(COUNT(DISTINCT(att.`staff_id`)),0) AS ins_qt FROM attendance AS `att`<br /> WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m')<br /> </select>
    5. _<!-- 查询上月巡检员人数 --><br /> _<select id="selectPreMonthAttQt" resultType="java.lang.Integer"><br /> SELECT IFNULL(COUNT(DISTINCT(att.`staff_id`)),0) AS ins_qt FROM attendance AS `att`<br /> WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH),'%Y-%m')<br /> </select>
    6. _<!-- 查询两月前巡检员人数 --><br /> _<select id="selectPre2MonthAttQt" resultType="java.lang.Integer"><br /> SELECT IFNULL(COUNT(DISTINCT(att.`staff_id`)),0) AS ins_qt FROM attendance AS `att`<br /> WHERE DATE_FORMAT(`att`.start_work,'%Y-%m') = DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 2 MONTH),'%Y-%m')<br /> </select><br /></mapper>