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

    <resultMap type="cn.ezhizao.project.business.domain.BizDayworkCarrier" id="BizDayworkCarrierResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizDayworkCarrier" resultMap="BizDayworkCarrierResult">
        SELECT * FROM biz_daywork_carrier
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="carrierCode != null  and carrierCode != ''"> AND carrier_code = #{carrierCode}</if>
            <if test="isChanged != null "> AND is_changed = #{isChanged}</if>
            <if test="dayworkId!= null "> AND daywork_id = #{dayworkId}</if>
        </trim>
    </select>

    <update id="removeByDayworkIds" parameterType="java.util.List">
        UPDATE biz_daywork_carrier
        SET is_changed = 1
        WHERE daywork_id IN
        <foreach collection="ids" item="daywork" index="index" open="(" separator="," close=")">
            #{daywork}
        </foreach>
    </update>

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