<?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.fs.qw.mapper.FsAppContactWayMapper">

    <resultMap type="FsAppContactWay" id="FsAppContactWayResult">
        <result property="id"    column="id"    />
        <result property="corpName"    column="corp_name"    />
        <result property="corpId"    column="corp_id"    />
        <result property="qwUserIds"    column="qw_user_ids"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="companyId"    column="company_id"    />
        <result property="status"    column="status"    />
        <result property="name"    column="name"    />
    </resultMap>

    <sql id="selectFsAppContactWayVo">
        select id, corp_name,corp_id,qw_user_ids,name, create_time, update_time, company_id, status from fs_app_contact_way
    </sql>

    <select id="selectFsAppContactWayList" parameterType="FsAppContactWay" resultMap="FsAppContactWayResult">
        <include refid="selectFsAppContactWayVo"/>
        <where>
            <if test="companyId != null "> and company_id = #{companyId}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="corpId != null "> and corp_id = #{corpId}</if>
        </where>
    </select>

    <select id="selectFsAppContactWayById" parameterType="Long" resultMap="FsAppContactWayResult">
        <include refid="selectFsAppContactWayVo"/>
        where id = #{id}
    </select>

    <insert id="insertFsAppContactWay" parameterType="FsAppContactWay" useGeneratedKeys="true" keyProperty="id">
        insert into fs_app_contact_way
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="corpName != null">corp_name,</if>
            <if test="corpId != null">corp_id,</if>
            <if test="qwUserIds != null">qw_user_ids,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="companyId != null">company_id,</if>
            <if test="status != null">status,</if>
            <if test="name != null">name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="corpName != null">#{corpName},</if>
            <if test="corpId != null">#{corpId},</if>
            <if test="qwUserIds != null">#{qwUserIds},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="companyId != null">#{companyId},</if>
            <if test="status != null">#{status},</if>
            <if test="name != null">#{name},</if>
         </trim>
    </insert>

    <update id="updateFsAppContactWay" parameterType="FsAppContactWay">
        update fs_app_contact_way
        <trim prefix="SET" suffixOverrides=",">
            <if test="corpName != null">corp_name = #{corpName},</if>
            <if test="corpId != null">corp_id = #{corpId},</if>
            <if test="qwUserIds != null">qw_user_ids = #{qwUserIds},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="companyId != null">company_id = #{companyId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="name != null">name = #{name},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFsAppContactWayById" parameterType="Long">
        delete from fs_app_contact_way where id = #{id}
    </delete>

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