<?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.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper">
    <select id="getMaxReceivedNumber" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(SUBSTR(received_number, 6, 3)), 0) + 1
        FROM official_document_received
        WHERE YEAR(received_date) = YEAR(NOW())
        and received_type = 'rt_administrative'
    </select>
    <select id="getMaxMeetingNumber" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(SUBSTR(received_number, 6, 3)), 0) + 1
        FROM official_document_received
        WHERE YEAR(received_date) = YEAR(NOW())
          and received_type = 'rt_meeting'
    </select>

</mapper>