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

    <resultMap type="SzxcCsFw" id="SzxcCsFwResult">
        <result property="id"    column="id"    />
        <result property="csId"    column="cs_id"    />
        <result property="fwId"    column="fw_id"    />
        <result property="fwName"    column="fw_name"    />
    </resultMap>

    <sql id="selectSzxcCsFwVo">
        select id, cs_id, fw_id, fw_name from szxc_cs_fw
    </sql>

    <select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult">
        <include refid="selectSzxcCsFwVo"/>
        <where>
            <if test="csId != null "> and cs_id = #{csId}</if>
            <if test="fwId != null "> and fw_id = #{fwId}</if>
            <if test="fwName != null  and fwName != ''"> and fw_name like concat('%', #{fwName}, '%')</if>
        </where>
    </select>

    <select id="selectSzxcCsFwById" parameterType="Long" resultMap="SzxcCsFwResult">
        <include refid="selectSzxcCsFwVo"/>
        where id = #{id}
    </select>

    <insert id="insertSzxcCsFw" parameterType="SzxcCsFw" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_cs_fw
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="csId != null">cs_id,</if>
            <if test="fwId != null">fw_id,</if>
            <if test="fwName != null and fwName != ''">fw_name,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="csId != null">#{csId},</if>
            <if test="fwId != null">#{fwId},</if>
            <if test="fwName != null and fwName != ''">#{fwName},</if>
        </trim>
    </insert>

    <update id="updateSzxcCsFw" parameterType="SzxcCsFw">
        update szxc_cs_fw
        <trim prefix="SET" suffixOverrides=",">
            <if test="csId != null">cs_id = #{csId},</if>
            <if test="fwId != null">fw_id = #{fwId},</if>
            <if test="fwName != null and fwName != ''">fw_name = #{fwName},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSzxcCsFwById" parameterType="Long">
        delete from szxc_cs_fw where id = #{id}
    </delete>

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