<?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.syzy.mapper.BCustomerUniversitiesMapper">
    
    <resultMap type="BCustomerUniversities" id="BCustomerUniversitiesResult">
        <result property="id"    column="id"    />
        <result property="customerCode"    column="customerCode"    />
        <result property="universityId"    column="universityId"    />
        <result property="createTime"    column="createTime"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectBCustomerUniversitiesVo">
        select id, customerCode, universityId, createTime, status from b_customer_universities
    </sql>

    <select id="selectBCustomerUniversitiesList" parameterType="BCustomerUniversities" resultMap="BCustomerUniversitiesResult">
        <include refid="selectBCustomerUniversitiesVo"/>
        <where>  
            <if test="customerCode != null  and customerCode != ''"> and customerCode = #{customerCode}</if>
            <if test="universityId != null "> and universityId = #{universityId}</if>
            <if test="createTime != null "> and createTime = #{createTime}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectBCustomerUniversitiesById" parameterType="Long" resultMap="BCustomerUniversitiesResult">
        <include refid="selectBCustomerUniversitiesVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBCustomerUniversities" parameterType="BCustomerUniversities" useGeneratedKeys="true" keyProperty="id">
        insert into b_customer_universities
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="customerCode != null">customerCode,</if>
            <if test="universityId != null">universityId,</if>
            <if test="createTime != null">createTime,</if>
            <if test="status != null">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="customerCode != null">#{customerCode},</if>
            <if test="universityId != null">#{universityId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="status != null">#{status},</if>
         </trim>
    </insert>

    <update id="updateBCustomerUniversities" parameterType="BCustomerUniversities">
        update b_customer_universities
        <trim prefix="SET" suffixOverrides=",">
            <if test="customerCode != null">customerCode = #{customerCode},</if>
            <if test="universityId != null">universityId = #{universityId},</if>
            <if test="createTime != null">createTime = #{createTime},</if>
            <if test="status != null">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBCustomerUniversitiesById" parameterType="Long">
        delete from b_customer_universities where id = #{id}
    </delete>

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