<?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.spider.quartz.mapper.JapanUnqualifiedGoodsZhMapper">
    
    <resultMap type="JapanUnqualifiedGoodsZh" id="JapanUnqualifiedGoodsZhResult">
        <result property="id"    column="id"    />
        <result property="goodsName"    column="goods_name"    />
        <result property="phone"    column="phone"    />
        <result property="copingMethod"    column="coping_method"    />
        <result property="recallTime"    column="recall_time"    />
        <result property="specificInformation"    column="specific_information"    />
        <result property="referenceInformation"    column="reference_information"    />
        <result property="recycleCause"    column="recycle_cause"    />
        <result property="remark"    column="remark"    />
        <result property="spiderTime"    column="spider_time"    />
        <result property="detailsUrl"    column="details_url"    />
        <result property="createUser"    column="create_user"    />
        <result property="createDept"    column="create_dept"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="status"    column="status"    />
        <result property="translated"    column="translated"    />
        <result property="translatedTime"    column="translated_time"    />
        <result property="businessId"    column="business_id"    />
    </resultMap>

    <sql id="selectJapanUnqualifiedGoodsZhVo">
        select id, goods_name, phone, coping_method, recall_time, specific_information, reference_information, recycle_cause, remark, spider_time, details_url, create_user, create_dept, create_time, update_user, update_time, is_deleted, status, translated, translated_time, business_id from bus_japan_unqualified_goods_zh
    </sql>

    <select id="selectJapanUnqualifiedGoodsZhList" parameterType="JapanUnqualifiedGoodsZh" resultMap="JapanUnqualifiedGoodsZhResult">
        <include refid="selectJapanUnqualifiedGoodsZhVo"/>
        <where>  
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="copingMethod != null  and copingMethod != ''"> and coping_method = #{copingMethod}</if>
            <if test="recallTime != null "> and recall_time = #{recallTime}</if>
            <if test="specificInformation != null  and specificInformation != ''"> and specific_information = #{specificInformation}</if>
            <if test="referenceInformation != null  and referenceInformation != ''"> and reference_information = #{referenceInformation}</if>
            <if test="recycleCause != null  and recycleCause != ''"> and recycle_cause = #{recycleCause}</if>
            <if test="spiderTime != null "> and spider_time = #{spiderTime}</if>
            <if test="detailsUrl != null  and detailsUrl != ''"> and details_url = #{detailsUrl}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="createDept != null  and createDept != ''"> and create_dept = #{createDept}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="translated != null  and translated != ''"> and translated = #{translated}</if>
            <if test="translatedTime != null "> and translated_time = #{translatedTime}</if>
            <if test="businessId != null "> and business_id = #{businessId}</if>
        </where>
    </select>
    
    <select id="selectJapanUnqualifiedGoodsZhById" parameterType="Long" resultMap="JapanUnqualifiedGoodsZhResult">
        <include refid="selectJapanUnqualifiedGoodsZhVo"/>
        where id = #{id}
    </select>

    <insert id="insertJapanUnqualifiedGoodsZh" parameterType="JapanUnqualifiedGoodsZh" useGeneratedKeys="true" keyProperty="id">
        insert into bus_japan_unqualified_goods_zh
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="goodsName != null">goods_name,</if>
            <if test="phone != null">phone,</if>
            <if test="copingMethod != null">coping_method,</if>
            <if test="recallTime != null">recall_time,</if>
            <if test="specificInformation != null">specific_information,</if>
            <if test="referenceInformation != null">reference_information,</if>
            <if test="recycleCause != null">recycle_cause,</if>
            <if test="remark != null">remark,</if>
            <if test="spiderTime != null">spider_time,</if>
            <if test="detailsUrl != null">details_url,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createDept != null">create_dept,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDeleted != null">is_deleted,</if>
            <if test="status != null">status,</if>
            <if test="translated != null">translated,</if>
            <if test="translatedTime != null">translated_time,</if>
            <if test="businessId != null">business_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="goodsName != null">#{goodsName},</if>
            <if test="phone != null">#{phone},</if>
            <if test="copingMethod != null">#{copingMethod},</if>
            <if test="recallTime != null">#{recallTime},</if>
            <if test="specificInformation != null">#{specificInformation},</if>
            <if test="referenceInformation != null">#{referenceInformation},</if>
            <if test="recycleCause != null">#{recycleCause},</if>
            <if test="remark != null">#{remark},</if>
            <if test="spiderTime != null">#{spiderTime},</if>
            <if test="detailsUrl != null">#{detailsUrl},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createDept != null">#{createDept},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDeleted != null">#{isDeleted},</if>
            <if test="status != null">#{status},</if>
            <if test="translated != null">#{translated},</if>
            <if test="translatedTime != null">#{translatedTime},</if>
            <if test="businessId != null">#{businessId},</if>
         </trim>
    </insert>

    <update id="updateJapanUnqualifiedGoodsZh" parameterType="JapanUnqualifiedGoodsZh">
        update bus_japan_unqualified_goods_zh
        <trim prefix="SET" suffixOverrides=",">
            <if test="goodsName != null">goods_name = #{goodsName},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="copingMethod != null">coping_method = #{copingMethod},</if>
            <if test="recallTime != null">recall_time = #{recallTime},</if>
            <if test="specificInformation != null">specific_information = #{specificInformation},</if>
            <if test="referenceInformation != null">reference_information = #{referenceInformation},</if>
            <if test="recycleCause != null">recycle_cause = #{recycleCause},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="spiderTime != null">spider_time = #{spiderTime},</if>
            <if test="detailsUrl != null">details_url = #{detailsUrl},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createDept != null">create_dept = #{createDept},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDeleted != null">is_deleted = #{isDeleted},</if>
            <if test="status != null">status = #{status},</if>
            <if test="translated != null">translated = #{translated},</if>
            <if test="translatedTime != null">translated_time = #{translatedTime},</if>
            <if test="businessId != null">business_id = #{businessId},</if>
        </trim>
        where business_id = #{id}
    </update>

    <delete id="deleteJapanUnqualifiedGoodsZhById" parameterType="Long">
        delete from bus_japan_unqualified_goods_zh where id = #{id}
    </delete>

    <delete id="deleteJapanUnqualifiedGoodsZhByIds" parameterType="String">
        delete from bus_japan_unqualified_goods_zh where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>