<?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.ezhizao.project.business.companyContactor.mapper.BizCompanyContactorMapper">

    <resultMap type="cn.ezhizao.project.business.companyContactor.domain.BizCompanyContactor" id="BizCompanyContactorResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizCompanyContactor" resultMap="BizCompanyContactorResult">
        SELECT * FROM biz_company_contactor
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="fromType != null  and fromType != ''"> AND from_type = #{fromType}</if>
            <if test="name != null  and name != ''"> AND name like concat('%', #{name}, '%')</if>
            <if test="position != null  and position != ''"> AND position = #{position}</if>
            <if test="gender != null  and gender != ''"> AND gender = #{gender}</if>
            <if test="phone != null  and phone != ''"> AND phone = #{phone}</if>
            <if test="contactType != null  and contactType != ''"> AND contact_type = #{contactType}</if>
            <if test="email != null  and email != ''"> AND email = #{email}</if>
            <if test="isMain != null  and isMain != ''"> AND is_main = #{isMain}</if>
            <if test="companyId != null and companyId != ''"> AND company_id = #{companyId}</if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_company_contactor
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <if test="companyId != null">
                company_id = #{companyId} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
