<?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.kakarote.hrm.mapper.HrmEmployeeContactsMapper">

    <select id="verifyUnique" resultType="java.lang.Integer">
        select count(1) from wk_hrm_employee_contacts a
        left join wk_hrm_employee b on a.employee_id = b.employee_id
        where b.is_del = 0 and ${fieldName} = #{value}
        <if test="contactsId != null">
            and a.contacts_id != #{contactsId}
        </if>
    </select>
</mapper>
