<?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.company.mapper.BizCompanyMapper">

    <resultMap type="cn.ezhizao.project.business.company.domain.BizCompany" id="BizCompanyResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizCompany" resultMap="BizCompanyResult">
        SELECT * FROM biz_company
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="companyCode != null  and companyCode != ''"> AND company_code = #{companyCode}</if>
            <if test="companyName != null  and companyName != ''"> AND company_name like concat('%', #{companyName}, '%')</if>
            <if test="companyAlias != null  and companyAlias != ''"> AND company_alias = #{companyAlias}</if>
            <if test="mnemonicCode != null  and mnemonicCode != ''"> AND mnemonic_code = #{mnemonicCode}</if>
            <if test="region != null  and region != ''"> AND region = #{region}</if>
            <if test="salemanCode != null  and salemanCode != ''"> AND saleman_code = #{salemanCode}</if>
        </trim>
    </select>

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