<?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.hotwj.platform.resourceManagement.personnelConfig.mapper.HotPersonnelConfigMapper">
    <select id="checkPhoneExist" resultType="Long">
        SELECT COUNT(1)
        FROM hot_personnel_config p
        LEFT JOIN hot_gov_enterprise_unit u ON p.unit_id = u.id
        WHERE p.is_deleted = 0
        AND p.mobile = #{mobile}
        AND u.unit_type = #{unitType}
        <if test="excludeId != null">
            AND p.id != #{excludeId}
        </if>
    </select>
</mapper>
