<?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.ruoyi.shipping.mapper.TConditionAccessoryMapper">
    
    <resultMap type="TConditionAccessory" id="TConditionAccessoryResult">
        <result property="fId"    column="f_id"    />
        <result property="fPid"    column="f_pid"    />
        <result property="fOrgId"    column="f_org_id"    />
        <result property="fLineno"    column="f_lineno"    />
        <result property="fName"    column="f_name"    />
        <result property="fDesc"    column="f_desc"    />
        <result property="fUrl"    column="f_url"    />
        <result property="fStatus"    column="f_status"    />
        <result property="fThumbnailUrl"    column="f_thumbnail_url"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTConditionAccessoryVo">
        select f_id, f_pid, f_org_id, f_lineno, f_name, f_desc, f_url, f_status, f_thumbnail_url, del_flag, create_by, create_time, update_by, update_time, remark from t_condition_accessory
    </sql>

    <select id="selectTConditionAccessoryList" parameterType="TConditionAccessory" resultMap="TConditionAccessoryResult">
        <include refid="selectTConditionAccessoryVo"/>
        <where>  
            <if test="fPid != null "> and f_pid = #{fPid}</if>
            <if test="fOrgId != null "> and f_org_id = #{fOrgId}</if>
            <if test="fLineno != null "> and f_lineno = #{fLineno}</if>
            <if test="fName != null  and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
            <if test="fDesc != null  and fDesc != ''"> and f_desc = #{fDesc}</if>
            <if test="fUrl != null  and fUrl != ''"> and f_url = #{fUrl}</if>
            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
            <if test="fThumbnailUrl != null  and fThumbnailUrl != ''"> and f_thumbnail_url = #{fThumbnailUrl}</if>
        </where>
    </select>
    
    <select id="selectTConditionAccessoryById" parameterType="Long" resultMap="TConditionAccessoryResult">
        <include refid="selectTConditionAccessoryVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTConditionAccessory" parameterType="TConditionAccessory" useGeneratedKeys="true" keyProperty="fId">
        insert into t_condition_accessory
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fPid != null">f_pid,</if>
            <if test="fOrgId != null">f_org_id,</if>
            <if test="fLineno != null">f_lineno,</if>
            <if test="fName != null">f_name,</if>
            <if test="fDesc != null">f_desc,</if>
            <if test="fUrl != null">f_url,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="fThumbnailUrl != null">f_thumbnail_url,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fPid != null">#{fPid},</if>
            <if test="fOrgId != null">#{fOrgId},</if>
            <if test="fLineno != null">#{fLineno},</if>
            <if test="fName != null">#{fName},</if>
            <if test="fDesc != null">#{fDesc},</if>
            <if test="fUrl != null">#{fUrl},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="fThumbnailUrl != null">#{fThumbnailUrl},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTConditionAccessory" parameterType="TConditionAccessory">
        update t_condition_accessory
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="fOrgId != null">f_org_id = #{fOrgId},</if>
            <if test="fLineno != null">f_lineno = #{fLineno},</if>
            <if test="fName != null">f_name = #{fName},</if>
            <if test="fDesc != null">f_desc = #{fDesc},</if>
            <if test="fUrl != null">f_url = #{fUrl},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="fThumbnailUrl != null">f_thumbnail_url = #{fThumbnailUrl},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTConditionAccessoryById" parameterType="Long">
        delete from t_condition_accessory where f_id = #{fId}
    </delete>

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