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

    <resultMap type="cn.ezhizao.project.business.accessories.domain.BizAccessories" id="BizAccessoriesResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizAccessories" resultMap="BizAccessoriesResult">
        SELECT * FROM biz_accessories
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="accessoriesCode != null  and accessoriesCode != ''"> AND accessories_code like concat('%',#{accessoriesCode},'%')</if>
            <if test="itype != null  and itype != ''"> AND itype = #{itype}</if>
            <if test="cusven != null  and cusven != ''"> AND cusven = #{cusven}</if>
            <if test="description != null  and description != ''"> AND description like concat('%',#{description},'%')</if>
            <if test="unit != null  and unit != ''"> AND unit = #{unit}</if>
            <if test="cruser != null  and cruser != ''"> AND cruser = #{cruser}</if>
            <if test="mddate != null "> AND mddate = #{mddate}</if>
            <if test="mduser != null  and mduser != ''"> AND mduser = #{mduser}</if>
            <if test="pouom != null  and pouom != ''"> AND pouom = #{pouom}</if>
            <if test="htype != null  and htype != ''"> AND htype = #{htype}</if>
            <if test="htyna != null  and htyna != ''"> AND htyna = #{htyna}</if>
            <if test="writeruser != null  and writeruser != ''"> AND writeruser = #{writeruser}</if>
            <if test="monthUseAmount != null "> AND month_use_amount = #{monthUseAmount}</if>
            <if test="ltype != null  and ltype != ''"> AND ltype = #{ltype}</if>
            <if test="deliveryDate != null "> AND delivery_date = #{deliveryDate}</if>
            <if test="safetyStock != null "> AND safety_stock = #{safetyStock}</if>
            <if test="price != null "> AND price = #{price}</if>
            <if test="status != null  and status != ''"> AND status = #{status}</if>
            <if test="crdate != null "> AND crdate = #{crdate}</if>
            <if test="ecoMark != null  and ecoMark != ''"> AND eco_mark = #{ecoMark}</if>
            <if test="conversionRatio != null "> AND conversion_ratio = #{conversionRatio}</if>
            <if test="writedate != null "> AND writedate = #{writedate}</if>
            <if test="packageStandard != null  and packageStandard != ''"> AND package_standard = #{packageStandard}</if>
            <if test="ypart != null  and ypart != ''"> AND ypart = #{ypart}</if>
            <if test="yamt != null "> AND yamt = #{yamt}</if>
            <if test="monthAvgPrice != null "> AND month_avg_price = #{monthAvgPrice}</if>
            <if test="ftype != null  and ftype != ''"> AND ftype = #{ftype}</if>
            <if test="ktype != null  and ktype != ''"> AND ktype = #{ktype}</if>
            <if test="ktyts != null "> AND ktyts = #{ktyts}</if>
            <if test="facno != null  and facno != ''"> AND facno = #{facno}</if>
        </trim>
    </select>

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