<?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.carrier.mapper.BizCarrierRejectMapper">

    <resultMap type="cn.ezhizao.project.business.carrier.domain.BizCarrierReject" id="BizCarrierRejectResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizCarrierReject" resultMap="BizCarrierRejectResult">
        SELECT t1.*,t2.code FROM biz_carrier_reject t1 left join biz_carrier t2 on t1.carrier_id = t2.id
        left join biz_carrier_category t3 on t2.category_id = t3.id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="categoryId != null  and categoryId != ''"> AND t2.category_id = #{categoryId}</if>
            <if test="code != null  and code != ''"> AND t2.code like concat('%',#{code},'%')</if>
            <if test="isAbandoned != null "> AND t1.is_abandoned = #{isAbandoned}</if>
        </trim>
        order by t1.create_time desc
    </select>

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