<?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.system.mapper.WebofficeFjMapper">
    
    <resultMap type="WebofficeFj" id="WebofficeFjResult">
        <result property="webofficeId"    column="webOffice_id"    />
        <result property="fjId"    column="fj_id"    />
        <result property="version"    column="version"    />
        <result property="size"    column="size"    />
        <result property="name"    column="name"    />
        <result property="url"    column="url"    />
        <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="creatorId"    column="modifier_id"    />
        <result property="modifierId"    column="creator_id"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectWebofficeFjVo">
        select webOffice_id, fj_id, version, size, name, url, create_by, create_time, update_by, update_time,modifier_id,creator_id, remark from webOffice_fj
    </sql>

    <select id="selectWebofficeFjList" parameterType="WebofficeFj" resultMap="WebofficeFjResult">
        <include refid="selectWebofficeFjVo"/>
        <where>  
            <if test="fjId != null "> and fj_id = #{fjId}</if>
            <if test="version != null  and version != ''"> and version = #{version}</if>
            <if test="size != null  and size != ''"> and size = #{size}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="url != null  and url != ''"> and url = #{url}</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectWebofficeFjByWebofficeId" parameterType="Long" resultMap="WebofficeFjResult">
        <include refid="selectWebofficeFjVo"/>
        where webOffice_id = #{webofficeId}
    </select>
        
    <insert id="insertWebofficeFj" parameterType="WebofficeFj" useGeneratedKeys="true" keyProperty="webofficeId">
        insert into webOffice_fj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fjId != null">fj_id,</if>
            <if test="version != null">version,</if>
            <if test="size != null">size,</if>
            <if test="name != null and name != ''">name,</if>
            <if test="url != null">url,</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="creatorId != null">creator_id,</if>
            <if test="modifierId != null">modifier_id,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fjId != null">#{fjId},</if>
            <if test="version != null">#{version},</if>
            <if test="size != null">#{size},</if>
            <if test="name != null and name != ''">#{name},</if>
            <if test="url != null">#{url},</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="creatorId != null">#{creatorId},</if>
            <if test="modifierId != null">#{modifierId},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateWebofficeFj" parameterType="WebofficeFj">
        update webOffice_fj
        <trim prefix="SET" suffixOverrides=",">
            <if test="fjId != null">fj_id = #{fjId},</if>
            <if test="version != null">version = #{version},</if>
            <if test="size != null">size = #{size},</if>
            <if test="name != null and name != ''">name = #{name},</if>
            <if test="url != null">url = #{url},</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="creatorId != null">creator_id = #{creatorId},</if>
            <if test="modifierId != null">modifier_id = #{modifierId},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where webOffice_id = #{webofficeId}
    </update>

    <delete id="deleteWebofficeFjByWebofficeId" parameterType="Long">
        delete from webOffice_fj where webOffice_id = #{webofficeId}
    </delete>

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