<?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="cn.com.countrygarden.bi.main.dao.routine.RoutineManagerMapper">
    <delete id="deleteOne">
        DELETE FROM routine_manager
        WHERE year = #{year} AND month = #{month}
            AND organ_name = #{organName}
    </delete>


    <select id="selectExcelData" resultType="cn.com.countrygarden.bi.main.model.routine.RoutineManager">
        SELECT DISTINCT order_number orderNumber,sort,organ_name organName,onjob_number onjobNumber,hight_manager hightManager,manager manager,deputy_manager deputyManager,supervisor supervisor,deputy_supervisor deputySupervisor
            ,trainee trainee,fenghuang_manager fenghuangManager,middle_school middleSchool,high_school highSchool,college college
            ,undergraduate_college undergraduateCollege,after_60 manager,after_60 after60,after_70 after70,after_80 after80
            ,after_90 after90,after_00 after00,dimission_number_month dimissionNumberMonth,dimission_number_total dimissionNumberTotal
            ,wastage_rate_month wastageRateMonth,wastage_rate_total wastageRateTotal
        FROM routine_manager
        WHERE 1=1
            <if test="year !=null and year != ''"> and year = #{year}</if>
            <if test="month !=null and month != ''"> and month = #{month}</if>
            <if test="organName !=null and organName != ''"> and organ_name LIKE CONCAT('%',#{organName},'%') </if>
        ORDER BY sort
    </select>
    <select id="selecMaxSort" resultType="java.lang.Integer">
        SELECT MAX(sort) sort
        FROM routine_manager
        WHERE year = #{year} AND month = #{month}
    </select>
</mapper>